repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
matomo-org/matomo
core/Period/Range.php
Range.parseDateRange
public static function parseDateRange($dateString) { $matched = preg_match('/^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),(([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})|today|now|yesterday)$/D', trim($dateString), $regs); if (empty($matched)) { return false; } return $regs; }
php
public static function parseDateRange($dateString) { $matched = preg_match('/^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),(([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})|today|now|yesterday)$/D', trim($dateString), $regs); if (empty($matched)) { return false; } return $regs; }
[ "public", "static", "function", "parseDateRange", "(", "$", "dateString", ")", "{", "$", "matched", "=", "preg_match", "(", "'/^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),(([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})|today|now|yesterday)$/D'", ",", "trim", "(", "$", "dateString", ")", ",", "$"...
Given a date string, returns `false` if not a date range, or returns the array containing start and end dates. @param string $dateString @return mixed array(1 => dateStartString, 2 => dateEndString) or `false` if the input was not a date range.
[ "Given", "a", "date", "string", "returns", "false", "if", "not", "a", "date", "range", "or", "returns", "the", "array", "containing", "start", "and", "end", "dates", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L291-L300
train
Parse date range
[ 30522, 2270, 10763, 3853, 11968, 6924, 24932, 22043, 1006, 1002, 5246, 18886, 3070, 1007, 1063, 1002, 10349, 1027, 3653, 2290, 1035, 2674, 1006, 1005, 1013, 1034, 1006, 1031, 1014, 1011, 1023, 1033, 1063, 1018, 1065, 1011, 1031, 1014, 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...
opencart/opencart
upload/system/engine/loader.php
Loader.language
public function language($route, $key = '') { // Sanitize the call $route = preg_replace('/[^a-zA-Z0-9_\-\/]/', '', (string)$route); // Keep the original trigger $trigger = $route; $result = $this->registry->get('event')->trigger('language/' . $trigger . '/before', array(&$route, &$key)); if ($result && !$result instanceof Exception) { $output = $result; } else { $output = $this->registry->get('language')->load($route, $key); } $result = $this->registry->get('event')->trigger('language/' . $trigger . '/after', array(&$route, &$key, &$output)); if ($result && !$result instanceof Exception) { $output = $result; } return $output; }
php
public function language($route, $key = '') { // Sanitize the call $route = preg_replace('/[^a-zA-Z0-9_\-\/]/', '', (string)$route); // Keep the original trigger $trigger = $route; $result = $this->registry->get('event')->trigger('language/' . $trigger . '/before', array(&$route, &$key)); if ($result && !$result instanceof Exception) { $output = $result; } else { $output = $this->registry->get('language')->load($route, $key); } $result = $this->registry->get('event')->trigger('language/' . $trigger . '/after', array(&$route, &$key, &$output)); if ($result && !$result instanceof Exception) { $output = $result; } return $output; }
[ "public", "function", "language", "(", "$", "route", ",", "$", "key", "=", "''", ")", "{", "// Sanitize the call", "$", "route", "=", "preg_replace", "(", "'/[^a-zA-Z0-9_\\-\\/]/'", ",", "''", ",", "(", "string", ")", "$", "route", ")", ";", "// Keep the o...
Language @param string $route @param string $key @return array
[ "Language" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/system/engine/loader.php#L200-L222
train
Load the language for the route and key
[ 30522, 2270, 3853, 2653, 1006, 1002, 2799, 1010, 1002, 3145, 1027, 1005, 1005, 1007, 1063, 1013, 1013, 2624, 25090, 4371, 1996, 2655, 1002, 2799, 1027, 3653, 2290, 1035, 5672, 1006, 1005, 1013, 1031, 1034, 1037, 1011, 23564, 1011, 1062, 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/Hashing/BcryptHasher.php
BcryptHasher.make
public function make($value, array $options = []) { $hash = password_hash($value, PASSWORD_BCRYPT, [ 'cost' => $this->cost($options), ]); if ($hash === false) { throw new RuntimeException('Bcrypt hashing not supported.'); } return $hash; }
php
public function make($value, array $options = []) { $hash = password_hash($value, PASSWORD_BCRYPT, [ 'cost' => $this->cost($options), ]); if ($hash === false) { throw new RuntimeException('Bcrypt hashing not supported.'); } return $hash; }
[ "public", "function", "make", "(", "$", "value", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "hash", "=", "password_hash", "(", "$", "value", ",", "PASSWORD_BCRYPT", ",", "[", "'cost'", "=>", "$", "this", "->", "cost", "(", "$", "op...
Hash the given value. @param string $value @param array $options @return string @throws \RuntimeException
[ "Hash", "the", "given", "value", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Hashing/BcryptHasher.php#L45-L56
train
Create a hash of a value using Bcrypt
[ 30522, 2270, 3853, 2191, 1006, 1002, 3643, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 23325, 1027, 20786, 1035, 23325, 1006, 1002, 3643, 1010, 20786, 1035, 4647, 2854, 13876, 1010, 1031, 1005, 3465, 1005, 1027, 1028, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.arrayIntersectFunc
public function arrayIntersectFunc($array1, $array2) { if ($array1 instanceof Collection && $array2 instanceof Collection) { return $array1->intersect($array2); } return array_intersect($array1, $array2); }
php
public function arrayIntersectFunc($array1, $array2) { if ($array1 instanceof Collection && $array2 instanceof Collection) { return $array1->intersect($array2); } return array_intersect($array1, $array2); }
[ "public", "function", "arrayIntersectFunc", "(", "$", "array1", ",", "$", "array2", ")", "{", "if", "(", "$", "array1", "instanceof", "Collection", "&&", "$", "array2", "instanceof", "Collection", ")", "{", "return", "$", "array1", "->", "intersect", "(", ...
Wrapper for array_intersect() method @param array $array1 @param array $array2 @return array
[ "Wrapper", "for", "array_intersect", "()", "method" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L959-L966
train
Array Intersects 2 arrays
[ 30522, 2270, 3853, 9140, 18447, 2545, 22471, 11263, 12273, 1006, 1002, 9140, 2487, 1010, 1002, 9140, 2475, 1007, 1063, 2065, 1006, 1002, 9140, 2487, 6013, 11253, 3074, 1004, 1004, 1002, 9140, 2475, 6013, 11253, 3074, 1007, 30524, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
ArrayNodeDefinition.getNodeBuilder
protected function getNodeBuilder() { if (null === $this->nodeBuilder) { $this->nodeBuilder = new NodeBuilder(); } return $this->nodeBuilder->setParent($this); }
php
protected function getNodeBuilder() { if (null === $this->nodeBuilder) { $this->nodeBuilder = new NodeBuilder(); } return $this->nodeBuilder->setParent($this); }
[ "protected", "function", "getNodeBuilder", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "nodeBuilder", ")", "{", "$", "this", "->", "nodeBuilder", "=", "new", "NodeBuilder", "(", ")", ";", "}", "return", "$", "this", "->", "nodeBuilder", ...
Returns a node builder to be used to add children and prototype. @return NodeBuilder The node builder
[ "Returns", "a", "node", "builder", "to", "be", "used", "to", "add", "children", "and", "prototype", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L381-L388
train
Get NodeBuilder
[ 30522, 5123, 3853, 2131, 3630, 3207, 8569, 23891, 2099, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 13045, 8569, 23891, 2099, 1007, 1063, 1002, 2023, 1011, 1028, 13045, 8569, 23891, 2099, 1027, 2047, 13045...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Capsule/Manager.php
Manager.setupManager
protected function setupManager() { $factory = new ConnectionFactory($this->container); $this->manager = new DatabaseManager($this->container, $factory); }
php
protected function setupManager() { $factory = new ConnectionFactory($this->container); $this->manager = new DatabaseManager($this->container, $factory); }
[ "protected", "function", "setupManager", "(", ")", "{", "$", "factory", "=", "new", "ConnectionFactory", "(", "$", "this", "->", "container", ")", ";", "$", "this", "->", "manager", "=", "new", "DatabaseManager", "(", "$", "this", "->", "container", ",", ...
Build the database manager instance. @return void
[ "Build", "the", "database", "manager", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Capsule/Manager.php#L59-L64
train
Setup the database manager
[ 30522, 5123, 3853, 16437, 24805, 4590, 1006, 1007, 1063, 1002, 4713, 1027, 2047, 4434, 21450, 1006, 1002, 2023, 1011, 1028, 11661, 1007, 1025, 1002, 2023, 1011, 1028, 3208, 1027, 2047, 7809, 24805, 4590, 1006, 1002, 2023, 1011, 1028, 11661,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Monolog/Handler/FirePHPHandler.php
FirePHPHandler.sendHeader
protected function sendHeader($header, $content) { if (!self::$sendHeaders) { return; } if ($this->response) { $this->response->headers->set($header, $content); } else { $this->headers[$header] = $content; } }
php
protected function sendHeader($header, $content) { if (!self::$sendHeaders) { return; } if ($this->response) { $this->response->headers->set($header, $content); } else { $this->headers[$header] = $content; } }
[ "protected", "function", "sendHeader", "(", "$", "header", ",", "$", "content", ")", "{", "if", "(", "!", "self", "::", "$", "sendHeaders", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "response", ")", "{", "$", "this", "->", "respon...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php#L62-L73
train
Send header to response
[ 30522, 5123, 3853, 4604, 4974, 2121, 1006, 1002, 20346, 1010, 1002, 4180, 1007, 1063, 2065, 1006, 999, 2969, 1024, 1024, 1002, 4604, 4974, 2545, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 1002, 2023, 1011, 1028, 3433, 1007, 1063, 1002, 202...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/NaiveBayes.php
NaiveBayes.calculateStatistics
private function calculateStatistics(string $label, array $samples): void { $this->std[$label] = array_fill(0, $this->featureCount, 0); $this->mean[$label] = array_fill(0, $this->featureCount, 0); $this->dataType[$label] = array_fill(0, $this->featureCount, self::CONTINUOS); $this->discreteProb[$label] = array_fill(0, $this->featureCount, self::CONTINUOS); for ($i = 0; $i < $this->featureCount; ++$i) { // Get the values of nth column in the samples array // Mean::arithmetic is called twice, can be optimized $values = array_column($samples, $i); $numValues = count($values); // if the values contain non-numeric data, // then it should be treated as nominal/categorical/discrete column if ($values !== array_filter($values, 'is_numeric')) { $this->dataType[$label][$i] = self::NOMINAL; $this->discreteProb[$label][$i] = array_count_values($values); $db = &$this->discreteProb[$label][$i]; $db = array_map(function ($el) use ($numValues) { return $el / $numValues; }, $db); } else { $this->mean[$label][$i] = Mean::arithmetic($values); // Add epsilon in order to avoid zero stdev $this->std[$label][$i] = 1e-10 + StandardDeviation::population($values, false); } } }
php
private function calculateStatistics(string $label, array $samples): void { $this->std[$label] = array_fill(0, $this->featureCount, 0); $this->mean[$label] = array_fill(0, $this->featureCount, 0); $this->dataType[$label] = array_fill(0, $this->featureCount, self::CONTINUOS); $this->discreteProb[$label] = array_fill(0, $this->featureCount, self::CONTINUOS); for ($i = 0; $i < $this->featureCount; ++$i) { // Get the values of nth column in the samples array // Mean::arithmetic is called twice, can be optimized $values = array_column($samples, $i); $numValues = count($values); // if the values contain non-numeric data, // then it should be treated as nominal/categorical/discrete column if ($values !== array_filter($values, 'is_numeric')) { $this->dataType[$label][$i] = self::NOMINAL; $this->discreteProb[$label][$i] = array_count_values($values); $db = &$this->discreteProb[$label][$i]; $db = array_map(function ($el) use ($numValues) { return $el / $numValues; }, $db); } else { $this->mean[$label][$i] = Mean::arithmetic($values); // Add epsilon in order to avoid zero stdev $this->std[$label][$i] = 1e-10 + StandardDeviation::population($values, false); } } }
[ "private", "function", "calculateStatistics", "(", "string", "$", "label", ",", "array", "$", "samples", ")", ":", "void", "{", "$", "this", "->", "std", "[", "$", "label", "]", "=", "array_fill", "(", "0", ",", "$", "this", "->", "featureCount", ",", ...
Calculates vital statistics for each label & feature. Stores these values in private array in order to avoid repeated calculation
[ "Calculates", "vital", "statistics", "for", "each", "label", "&", "feature", ".", "Stores", "these", "values", "in", "private", "array", "in", "order", "to", "avoid", "repeated", "calculation" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/NaiveBayes.php#L108-L134
train
Calculates statistics for the label
[ 30522, 2797, 3853, 18422, 9153, 16774, 6558, 1006, 5164, 1002, 3830, 1010, 9140, 1002, 8168, 1007, 30524, 1031, 1002, 3830, 1033, 1027, 9140, 1035, 6039, 1006, 1014, 1010, 1002, 2023, 1011, 1028, 3444, 3597, 16671, 1010, 1014, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/VarDumper/Dumper/CliDumper.php
CliDumper.enterHash
public function enterHash(Cursor $cursor, $type, $class, $hasChild) { $this->dumpKey($cursor); $attr = $cursor->attr; if ($this->collapseNextHash) { $cursor->skipChildren = true; $this->collapseNextHash = $hasChild = false; } $class = $this->utf8Encode($class); if (Cursor::HASH_OBJECT === $type) { $prefix = $class && 'stdClass' !== $class ? $this->style('note', $class, $attr).' {' : '{'; } elseif (Cursor::HASH_RESOURCE === $type) { $prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' '); } else { $prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class, $attr).' [' : '['; } if ($cursor->softRefCount || 0 < $cursor->softRefHandle) { $prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), ['count' => $cursor->softRefCount]); } elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) { $prefix .= $this->style('ref', '&'.$cursor->hardRefTo, ['count' => $cursor->hardRefCount]); } elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) { $prefix = substr($prefix, 0, -1); } $this->line .= $prefix; if ($hasChild) { $this->dumpLine($cursor->depth); } }
php
public function enterHash(Cursor $cursor, $type, $class, $hasChild) { $this->dumpKey($cursor); $attr = $cursor->attr; if ($this->collapseNextHash) { $cursor->skipChildren = true; $this->collapseNextHash = $hasChild = false; } $class = $this->utf8Encode($class); if (Cursor::HASH_OBJECT === $type) { $prefix = $class && 'stdClass' !== $class ? $this->style('note', $class, $attr).' {' : '{'; } elseif (Cursor::HASH_RESOURCE === $type) { $prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' '); } else { $prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class, $attr).' [' : '['; } if ($cursor->softRefCount || 0 < $cursor->softRefHandle) { $prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), ['count' => $cursor->softRefCount]); } elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) { $prefix .= $this->style('ref', '&'.$cursor->hardRefTo, ['count' => $cursor->hardRefCount]); } elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) { $prefix = substr($prefix, 0, -1); } $this->line .= $prefix; if ($hasChild) { $this->dumpLine($cursor->depth); } }
[ "public", "function", "enterHash", "(", "Cursor", "$", "cursor", ",", "$", "type", ",", "$", "class", ",", "$", "hasChild", ")", "{", "$", "this", "->", "dumpKey", "(", "$", "cursor", ")", ";", "$", "attr", "=", "$", "cursor", "->", "attr", ";", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/CliDumper.php#L274-L306
train
Enter a hash statement.
[ 30522, 2270, 3853, 4607, 14949, 2232, 1006, 12731, 25301, 2099, 1002, 12731, 25301, 2099, 1010, 1002, 2828, 1010, 1002, 2465, 1010, 1002, 30524, 1028, 2012, 16344, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 7859, 2638, 18413, 14949, 2232, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Scheduler/IntervalTrait.php
IntervalTrait.at
public function at($expression) { $this->at = $expression; $this->executionTime = CronExpression::factory($expression); return $this; }
php
public function at($expression) { $this->at = $expression; $this->executionTime = CronExpression::factory($expression); return $this; }
[ "public", "function", "at", "(", "$", "expression", ")", "{", "$", "this", "->", "at", "=", "$", "expression", ";", "$", "this", "->", "executionTime", "=", "CronExpression", "::", "factory", "(", "$", "expression", ")", ";", "return", "$", "this", ";"...
Set the Job execution time. compo @param string $expression @return self
[ "Set", "the", "Job", "execution", "time", ".", "compo" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/IntervalTrait.php#L22-L28
train
Set the execution time expression
[ 30522, 2270, 3853, 2012, 1006, 1002, 3670, 1007, 1063, 1002, 2023, 1011, 1028, 2012, 1027, 1002, 3670, 1025, 1002, 2023, 1011, 1028, 7781, 7292, 1027, 13675, 5643, 2595, 20110, 3258, 1024, 1024, 4713, 1006, 1002, 3670, 1007, 1025, 2709, 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/Security/Core/Encoder/Pbkdf2PasswordEncoder.php
Pbkdf2PasswordEncoder.encodePassword
public function encodePassword($raw, $salt) { if ($this->isPasswordTooLong($raw)) { throw new BadCredentialsException('Invalid password.'); } if (!\in_array($this->algorithm, hash_algos(), true)) { throw new \LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm)); } $digest = hash_pbkdf2($this->algorithm, $raw, $salt, $this->iterations, $this->length, true); return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest); }
php
public function encodePassword($raw, $salt) { if ($this->isPasswordTooLong($raw)) { throw new BadCredentialsException('Invalid password.'); } if (!\in_array($this->algorithm, hash_algos(), true)) { throw new \LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm)); } $digest = hash_pbkdf2($this->algorithm, $raw, $salt, $this->iterations, $this->length, true); return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest); }
[ "public", "function", "encodePassword", "(", "$", "raw", ",", "$", "salt", ")", "{", "if", "(", "$", "this", "->", "isPasswordTooLong", "(", "$", "raw", ")", ")", "{", "throw", "new", "BadCredentialsException", "(", "'Invalid password.'", ")", ";", "}", ...
{@inheritdoc} @throws \LogicException when the algorithm is not supported
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php#L55-L68
train
Encode the password using the hash algorithm
[ 30522, 2270, 3853, 4372, 16044, 15194, 18351, 1006, 1002, 6315, 1010, 1002, 5474, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 15194, 18351, 3406, 12898, 3070, 1006, 1002, 6315, 1007, 1007, 1063, 5466, 2047, 2919, 16748, 16454, 263...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HttpClient/Response/MockResponse.php
MockResponse.writeRequest
private static function writeRequest(self $response, array $options, ResponseInterface $mock) { $onProgress = $options['on_progress'] ?? static function () {}; $response->info += $mock->getInfo() ?: []; // simulate "size_upload" if it is set if (isset($response->info['size_upload'])) { $response->info['size_upload'] = 0.0; } // simulate "total_time" if it is set if (isset($response->info['total_time'])) { $response->info['total_time'] = microtime(true) - $response->info['start_time']; } // "notify" DNS resolution $onProgress(0, 0, $response->info); // consume the request body if (\is_resource($body = $options['body'] ?? '')) { $data = stream_get_contents($body); if (isset($response->info['size_upload'])) { $response->info['size_upload'] += \strlen($data); } } elseif ($body instanceof \Closure) { while ('' !== $data = $body(16372)) { if (!\is_string($data)) { throw new TransportException(sprintf('Return value of the "body" option callback must be string, %s returned.', \gettype($data))); } // "notify" upload progress if (isset($response->info['size_upload'])) { $response->info['size_upload'] += \strlen($data); } $onProgress(0, 0, $response->info); } } }
php
private static function writeRequest(self $response, array $options, ResponseInterface $mock) { $onProgress = $options['on_progress'] ?? static function () {}; $response->info += $mock->getInfo() ?: []; // simulate "size_upload" if it is set if (isset($response->info['size_upload'])) { $response->info['size_upload'] = 0.0; } // simulate "total_time" if it is set if (isset($response->info['total_time'])) { $response->info['total_time'] = microtime(true) - $response->info['start_time']; } // "notify" DNS resolution $onProgress(0, 0, $response->info); // consume the request body if (\is_resource($body = $options['body'] ?? '')) { $data = stream_get_contents($body); if (isset($response->info['size_upload'])) { $response->info['size_upload'] += \strlen($data); } } elseif ($body instanceof \Closure) { while ('' !== $data = $body(16372)) { if (!\is_string($data)) { throw new TransportException(sprintf('Return value of the "body" option callback must be string, %s returned.', \gettype($data))); } // "notify" upload progress if (isset($response->info['size_upload'])) { $response->info['size_upload'] += \strlen($data); } $onProgress(0, 0, $response->info); } } }
[ "private", "static", "function", "writeRequest", "(", "self", "$", "response", ",", "array", "$", "options", ",", "ResponseInterface", "$", "mock", ")", "{", "$", "onProgress", "=", "$", "options", "[", "'on_progress'", "]", "??", "static", "function", "(", ...
Simulates sending the request.
[ "Simulates", "sending", "the", "request", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/MockResponse.php#L194-L232
train
Write the request to the response
[ 30522, 2797, 10763, 3853, 3213, 2063, 15500, 1006, 2969, 1002, 3433, 1010, 9140, 1002, 7047, 1010, 3433, 18447, 2121, 12172, 1002, 12934, 1007, 1063, 1002, 2006, 21572, 17603, 4757, 1027, 1002, 7047, 1031, 1005, 2006, 1035, 5082, 1005, 1033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.mapWithKeys
public function mapWithKeys(callable $callback) { $result = []; foreach ($this->items as $key => $value) { $assoc = $callback($value, $key); foreach ($assoc as $mapKey => $mapValue) { $result[$mapKey] = $mapValue; } } return new static($result); }
php
public function mapWithKeys(callable $callback) { $result = []; foreach ($this->items as $key => $value) { $assoc = $callback($value, $key); foreach ($assoc as $mapKey => $mapValue) { $result[$mapKey] = $mapValue; } } return new static($result); }
[ "public", "function", "mapWithKeys", "(", "callable", "$", "callback", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "assoc", "=", "$", "callback", "(",...
Run an associative map over each of the items. The callback should return an associative array with a single key/value pair. @param callable $callback @return static
[ "Run", "an", "associative", "map", "over", "each", "of", "the", "items", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1192-L1205
train
Maps all items with a callback function.
[ 30522, 2270, 3853, 4949, 24415, 14839, 2015, 1006, 2655, 3085, 1002, 2655, 5963, 1007, 1063, 1002, 2765, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 5167, 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...
laravel/framework
src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php
ConcurrencyLimiter.release
protected function release($key, $id) { $this->redis->eval($this->releaseScript(), 1, $key, $id); }
php
protected function release($key, $id) { $this->redis->eval($this->releaseScript(), 1, $key, $id); }
[ "protected", "function", "release", "(", "$", "key", ",", "$", "id", ")", "{", "$", "this", "->", "redis", "->", "eval", "(", "$", "this", "->", "releaseScript", "(", ")", ",", "1", ",", "$", "key", ",", "$", "id", ")", ";", "}" ]
Release the lock. @param string $key @param string $id @return void
[ "Release", "the", "lock", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php#L143-L146
train
Release the cache entry
[ 30522, 5123, 3853, 2713, 1006, 1002, 3145, 1010, 1002, 8909, 1007, 1063, 1002, 2023, 1011, 1028, 2417, 2483, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Console/ExtendCommand.php
ExtendCommand.copy
protected function copy($from, $to = null) { if (is_array($from) && is_null($to)) { foreach ($from as $key => $value) { $this->copy($key, $value); } return; } if (!file_exists($from)) { return; } $to = $this->extensionPath($to); $this->filesystem->copy($from, $to); }
php
protected function copy($from, $to = null) { if (is_array($from) && is_null($to)) { foreach ($from as $key => $value) { $this->copy($key, $value); } return; } if (!file_exists($from)) { return; } $to = $this->extensionPath($to); $this->filesystem->copy($from, $to); }
[ "protected", "function", "copy", "(", "$", "from", ",", "$", "to", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "from", ")", "&&", "is_null", "(", "$", "to", ")", ")", "{", "foreach", "(", "$", "from", "as", "$", "key", "=>", "$", ...
Copy files to extension path. @param string|array $from @param string|null $to
[ "Copy", "files", "to", "extension", "path", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ExtendCommand.php#L277-L294
train
Copy file from one directory to another
[ 30522, 5123, 3853, 6100, 1006, 1002, 2013, 1010, 1002, 2000, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 2013, 1007, 1004, 1004, 2003, 1035, 19701, 1006, 1002, 2000, 1007, 1007, 1063, 18921, 6776, 1006, 1002, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
HasManyThrough.prepareQueryBuilder
protected function prepareQueryBuilder($columns = ['*']) { $builder = $this->query->applyScopes(); return $builder->addSelect( $this->shouldSelect($builder->getQuery()->columns ? [] : $columns) ); }
php
protected function prepareQueryBuilder($columns = ['*']) { $builder = $this->query->applyScopes(); return $builder->addSelect( $this->shouldSelect($builder->getQuery()->columns ? [] : $columns) ); }
[ "protected", "function", "prepareQueryBuilder", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "builder", "=", "$", "this", "->", "query", "->", "applyScopes", "(", ")", ";", "return", "$", "builder", "->", "addSelect", "(", "$", "this", "->...
Prepare the query builder for query execution. @param array $columns @return \Illuminate\Database\Eloquent\Builder
[ "Prepare", "the", "query", "builder", "for", "query", "execution", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php#L484-L491
train
Prepares the query builder for the query.
[ 30522, 5123, 3853, 7374, 4226, 2854, 8569, 23891, 2099, 1006, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 1002, 12508, 1027, 1002, 2023, 1011, 1028, 23032, 1011, 1028, 6611, 26127, 2015, 1006, 1007, 1025, 2709, 1002, 12508, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Columns/Dimension.php
Dimension.addSegment
protected function addSegment(Segment $segment) { if (!$segment->getSegment() && $this->segmentName) { $segment->setSegment($this->segmentName); } if (!$segment->getType()) { $metricTypes = array(self::TYPE_NUMBER, self::TYPE_FLOAT, self::TYPE_MONEY, self::TYPE_DURATION_S, self::TYPE_DURATION_MS); if (in_array($this->getType(), $metricTypes, $strict = true)) { $segment->setType(Segment::TYPE_METRIC); } else { $segment->setType(Segment::TYPE_DIMENSION); } } if (!$segment->getCategoryId() && $this->category) { $segment->setCategory($this->category); } if (!$segment->getName() && $this->nameSingular) { $segment->setName($this->nameSingular); } $sqlSegment = $segment->getSqlSegment(); if (empty($sqlSegment) && !$segment->getUnionOfSegments()) { if (!empty($this->sqlSegment)) { $segment->setSqlSegment($this->sqlSegment); } elseif ($this->dbTableName && $this->columnName) { $segment->setSqlSegment($this->dbTableName . '.' . $this->columnName); } else { throw new Exception('Segment cannot be added because no sql segment is set'); } } if (!$this->suggestedValuesCallback) { // we can generate effecient value callback for enums automatically $enum = $this->getEnumColumnValues(); if (!empty($enum)) { $this->suggestedValuesCallback = function ($idSite, $maxValuesToReturn) use ($enum) { $values = array_values($enum); return array_slice($values, 0, $maxValuesToReturn); }; } } if (!$this->acceptValues) { // we can generate accept values for enums automatically $enum = $this->getEnumColumnValues(); if (!empty($enum)) { $enumValues = array_values($enum); $enumValues = array_slice($enumValues, 0, 20); $this->acceptValues = 'Eg. ' . implode(', ', $enumValues); }; } if ($this->acceptValues && !$segment->getAcceptValues()) { $segment->setAcceptedValues($this->acceptValues); } if (!$this->sqlFilterValue && !$segment->getSqlFilter() && !$segment->getSqlFilterValue()) { // no sql filter configured, we try to configure automatically for enums $enum = $this->getEnumColumnValues(); if (!empty($enum)) { $this->sqlFilterValue = function ($value, $sqlSegmentName) use ($enum) { if (isset($enum[$value])) { return $value; } $id = array_search($value, $enum); if ($id === false) { $id = array_search(strtolower(trim(urldecode($value))), $enum); if ($id === false) { throw new \Exception("Invalid '$sqlSegmentName' segment value $value"); } } return $id; }; }; } if ($this->suggestedValuesCallback && !$segment->getSuggestedValuesCallback()) { $segment->setSuggestedValuesCallback($this->suggestedValuesCallback); } if ($this->sqlFilterValue && !$segment->getSqlFilterValue()) { $segment->setSqlFilterValue($this->sqlFilterValue); } if ($this->sqlFilter && !$segment->getSqlFilter()) { $segment->setSqlFilter($this->sqlFilter); } if (!$this->allowAnonymous) { $segment->setRequiresAtLeastViewAccess(true); } $this->segments[] = $segment; }
php
protected function addSegment(Segment $segment) { if (!$segment->getSegment() && $this->segmentName) { $segment->setSegment($this->segmentName); } if (!$segment->getType()) { $metricTypes = array(self::TYPE_NUMBER, self::TYPE_FLOAT, self::TYPE_MONEY, self::TYPE_DURATION_S, self::TYPE_DURATION_MS); if (in_array($this->getType(), $metricTypes, $strict = true)) { $segment->setType(Segment::TYPE_METRIC); } else { $segment->setType(Segment::TYPE_DIMENSION); } } if (!$segment->getCategoryId() && $this->category) { $segment->setCategory($this->category); } if (!$segment->getName() && $this->nameSingular) { $segment->setName($this->nameSingular); } $sqlSegment = $segment->getSqlSegment(); if (empty($sqlSegment) && !$segment->getUnionOfSegments()) { if (!empty($this->sqlSegment)) { $segment->setSqlSegment($this->sqlSegment); } elseif ($this->dbTableName && $this->columnName) { $segment->setSqlSegment($this->dbTableName . '.' . $this->columnName); } else { throw new Exception('Segment cannot be added because no sql segment is set'); } } if (!$this->suggestedValuesCallback) { // we can generate effecient value callback for enums automatically $enum = $this->getEnumColumnValues(); if (!empty($enum)) { $this->suggestedValuesCallback = function ($idSite, $maxValuesToReturn) use ($enum) { $values = array_values($enum); return array_slice($values, 0, $maxValuesToReturn); }; } } if (!$this->acceptValues) { // we can generate accept values for enums automatically $enum = $this->getEnumColumnValues(); if (!empty($enum)) { $enumValues = array_values($enum); $enumValues = array_slice($enumValues, 0, 20); $this->acceptValues = 'Eg. ' . implode(', ', $enumValues); }; } if ($this->acceptValues && !$segment->getAcceptValues()) { $segment->setAcceptedValues($this->acceptValues); } if (!$this->sqlFilterValue && !$segment->getSqlFilter() && !$segment->getSqlFilterValue()) { // no sql filter configured, we try to configure automatically for enums $enum = $this->getEnumColumnValues(); if (!empty($enum)) { $this->sqlFilterValue = function ($value, $sqlSegmentName) use ($enum) { if (isset($enum[$value])) { return $value; } $id = array_search($value, $enum); if ($id === false) { $id = array_search(strtolower(trim(urldecode($value))), $enum); if ($id === false) { throw new \Exception("Invalid '$sqlSegmentName' segment value $value"); } } return $id; }; }; } if ($this->suggestedValuesCallback && !$segment->getSuggestedValuesCallback()) { $segment->setSuggestedValuesCallback($this->suggestedValuesCallback); } if ($this->sqlFilterValue && !$segment->getSqlFilterValue()) { $segment->setSqlFilterValue($this->sqlFilterValue); } if ($this->sqlFilter && !$segment->getSqlFilter()) { $segment->setSqlFilter($this->sqlFilter); } if (!$this->allowAnonymous) { $segment->setRequiresAtLeastViewAccess(true); } $this->segments[] = $segment; }
[ "protected", "function", "addSegment", "(", "Segment", "$", "segment", ")", "{", "if", "(", "!", "$", "segment", "->", "getSegment", "(", ")", "&&", "$", "this", "->", "segmentName", ")", "{", "$", "segment", "->", "setSegment", "(", "$", "this", "->",...
Adds a new segment. It automatically sets the SQL segment depending on the column name in case none is set already. @see \Piwik\Columns\Dimension::addSegment() @param Segment $segment @api
[ "Adds", "a", "new", "segment", ".", "It", "automatically", "sets", "the", "SQL", "segment", "depending", "on", "the", "column", "name", "in", "case", "none", "is", "set", "already", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/Dimension.php#L535-L636
train
Adds a new segment to the list of available types
[ 30522, 5123, 3853, 9909, 13910, 3672, 1006, 6903, 1002, 6903, 1007, 1063, 2065, 1006, 999, 1002, 6903, 1011, 1028, 4152, 13910, 3672, 1006, 1007, 1004, 1004, 1002, 2023, 1011, 1028, 6903, 18442, 1007, 1063, 1002, 6903, 1011, 1028, 4520, 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/Stopwatch/Section.php
Section.getEvent
public function getEvent($name) { if (!isset($this->events[$name])) { throw new \LogicException(sprintf('Event "%s" is not known.', $name)); } return $this->events[$name]; }
php
public function getEvent($name) { if (!isset($this->events[$name])) { throw new \LogicException(sprintf('Event "%s" is not known.', $name)); } return $this->events[$name]; }
[ "public", "function", "getEvent", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "events", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "sprintf", "(", "'Event \"%s\" is not known.'", ...
Returns a specific event by name. @param string $name The event name @return StopwatchEvent The event @throws \LogicException When the event is not known
[ "Returns", "a", "specific", "event", "by", "name", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L180-L187
train
Get an event by name
[ 30522, 2270, 3853, 2131, 18697, 3372, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2824, 1031, 1002, 2171, 1033, 1007, 1007, 1063, 5466, 2047, 1032, 7961, 10288, 24422, 1006, 9043, 2546, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/Handlers/PhpError.php
PhpError.renderJsonErrorMessage
protected function renderJsonErrorMessage(Throwable $error) { $json = [ 'message' => 'Slim Application Error', ]; if ($this->displayErrorDetails) { $json['error'] = []; do { $json['error'][] = [ 'type' => get_class($error), 'code' => $error->getCode(), 'message' => $error->getMessage(), 'file' => $error->getFile(), 'line' => $error->getLine(), 'trace' => explode("\n", $error->getTraceAsString()), ]; } while ($error = $error->getPrevious()); } return json_encode($json, JSON_PRETTY_PRINT); }
php
protected function renderJsonErrorMessage(Throwable $error) { $json = [ 'message' => 'Slim Application Error', ]; if ($this->displayErrorDetails) { $json['error'] = []; do { $json['error'][] = [ 'type' => get_class($error), 'code' => $error->getCode(), 'message' => $error->getMessage(), 'file' => $error->getFile(), 'line' => $error->getLine(), 'trace' => explode("\n", $error->getTraceAsString()), ]; } while ($error = $error->getPrevious()); } return json_encode($json, JSON_PRETTY_PRINT); }
[ "protected", "function", "renderJsonErrorMessage", "(", "Throwable", "$", "error", ")", "{", "$", "json", "=", "[", "'message'", "=>", "'Slim Application Error'", ",", "]", ";", "if", "(", "$", "this", "->", "displayErrorDetails", ")", "{", "$", "json", "[",...
Render JSON error @param Throwable $error @return string
[ "Render", "JSON", "error" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Handlers/PhpError.php#L137-L159
train
Render json error message
[ 30522, 5123, 3853, 17552, 22578, 5643, 18933, 10867, 7971, 4270, 1006, 5466, 3085, 1002, 7561, 1007, 1063, 1002, 1046, 3385, 1027, 1031, 1005, 4471, 1005, 1027, 1028, 1005, 11754, 4646, 7561, 1005, 1010, 1033, 1025, 2065, 1006, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.addMutatedAttributesToArray
protected function addMutatedAttributesToArray(array $attributes, array $mutatedAttributes) { foreach ($mutatedAttributes as $key) { // We want to spin through all the mutated attributes for this model and call // the mutator for the attribute. We cache off every mutated attributes so // we don't have to constantly check on attributes that actually change. if (! array_key_exists($key, $attributes)) { continue; } // Next, we will call the mutator for this attribute so that we can get these // mutated attribute's actual values. After we finish mutating each of the // attributes we will return this final array of the mutated attributes. $attributes[$key] = $this->mutateAttributeForArray( $key, $attributes[$key] ); } return $attributes; }
php
protected function addMutatedAttributesToArray(array $attributes, array $mutatedAttributes) { foreach ($mutatedAttributes as $key) { // We want to spin through all the mutated attributes for this model and call // the mutator for the attribute. We cache off every mutated attributes so // we don't have to constantly check on attributes that actually change. if (! array_key_exists($key, $attributes)) { continue; } // Next, we will call the mutator for this attribute so that we can get these // mutated attribute's actual values. After we finish mutating each of the // attributes we will return this final array of the mutated attributes. $attributes[$key] = $this->mutateAttributeForArray( $key, $attributes[$key] ); } return $attributes; }
[ "protected", "function", "addMutatedAttributesToArray", "(", "array", "$", "attributes", ",", "array", "$", "mutatedAttributes", ")", "{", "foreach", "(", "$", "mutatedAttributes", "as", "$", "key", ")", "{", "// We want to spin through all the mutated attributes for this...
Add the mutated attributes to the attributes array. @param array $attributes @param array $mutatedAttributes @return array
[ "Add", "the", "mutated", "attributes", "to", "the", "attributes", "array", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L145-L164
train
Add mutated attributes to the attributes array
[ 30522, 5123, 3853, 5587, 28120, 4383, 19321, 3089, 8569, 22199, 10441, 11335, 2100, 1006, 9140, 1002, 12332, 1010, 9140, 1002, 14163, 16238, 19321, 3089, 8569, 4570, 1007, 1063, 18921, 6776, 1006, 1002, 14163, 16238, 19321, 3089, 8569, 4570, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Connection/TcpConnection.php
TcpConnection.baseRead
public function baseRead($socket, $check_eof = true) { // SSL handshake. if ($this->transport === 'ssl' && $this->_sslHandshakeCompleted !== true) { if ($this->doSslHandshake($socket)) { $this->_sslHandshakeCompleted = true; if ($this->_sendBuffer) { Worker::$globalEvent->add($socket, EventInterface::EV_WRITE, array($this, 'baseWrite')); } } else { return; } } set_error_handler(function(){}); $buffer = fread($socket, self::READ_BUFFER_SIZE); restore_error_handler(); // Check connection closed. if ($buffer === '' || $buffer === false) { if ($check_eof && (feof($socket) || !is_resource($socket) || $buffer === false)) { $this->destroy(); return; } } else { $this->bytesRead += strlen($buffer); $this->_recvBuffer .= $buffer; } // If the application layer protocol has been set up. if ($this->protocol !== null) { $parser = $this->protocol; while ($this->_recvBuffer !== '' && !$this->_isPaused) { // The current packet length is known. if ($this->_currentPackageLength) { // Data is not enough for a package. if ($this->_currentPackageLength > strlen($this->_recvBuffer)) { break; } } else { // Get current package length. set_error_handler(function($code, $msg, $file, $line){ Worker::safeEcho("$msg in file $file on line $line\n"); }); $this->_currentPackageLength = $parser::input($this->_recvBuffer, $this); restore_error_handler(); // The packet length is unknown. if ($this->_currentPackageLength === 0) { break; } elseif ($this->_currentPackageLength > 0 && $this->_currentPackageLength <= $this->maxPackageSize) { // Data is not enough for a package. if ($this->_currentPackageLength > strlen($this->_recvBuffer)) { break; } } // Wrong package. else { Worker::safeEcho('error package. package_length=' . var_export($this->_currentPackageLength, true)); $this->destroy(); return; } } // The data is enough for a packet. self::$statistics['total_request']++; // The current packet length is equal to the length of the buffer. if (strlen($this->_recvBuffer) === $this->_currentPackageLength) { $one_request_buffer = $this->_recvBuffer; $this->_recvBuffer = ''; } else { // Get a full package from the buffer. $one_request_buffer = substr($this->_recvBuffer, 0, $this->_currentPackageLength); // Remove the current package from the receive buffer. $this->_recvBuffer = substr($this->_recvBuffer, $this->_currentPackageLength); } // Reset the current packet length to 0. $this->_currentPackageLength = 0; if (!$this->onMessage) { continue; } try { // Decode request buffer before Emitting onMessage callback. call_user_func($this->onMessage, $this, $parser::decode($one_request_buffer, $this)); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } return; } if ($this->_recvBuffer === '' || $this->_isPaused) { return; } // Applications protocol is not set. self::$statistics['total_request']++; if (!$this->onMessage) { $this->_recvBuffer = ''; return; } try { call_user_func($this->onMessage, $this, $this->_recvBuffer); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } // Clean receive buffer. $this->_recvBuffer = ''; }
php
public function baseRead($socket, $check_eof = true) { // SSL handshake. if ($this->transport === 'ssl' && $this->_sslHandshakeCompleted !== true) { if ($this->doSslHandshake($socket)) { $this->_sslHandshakeCompleted = true; if ($this->_sendBuffer) { Worker::$globalEvent->add($socket, EventInterface::EV_WRITE, array($this, 'baseWrite')); } } else { return; } } set_error_handler(function(){}); $buffer = fread($socket, self::READ_BUFFER_SIZE); restore_error_handler(); // Check connection closed. if ($buffer === '' || $buffer === false) { if ($check_eof && (feof($socket) || !is_resource($socket) || $buffer === false)) { $this->destroy(); return; } } else { $this->bytesRead += strlen($buffer); $this->_recvBuffer .= $buffer; } // If the application layer protocol has been set up. if ($this->protocol !== null) { $parser = $this->protocol; while ($this->_recvBuffer !== '' && !$this->_isPaused) { // The current packet length is known. if ($this->_currentPackageLength) { // Data is not enough for a package. if ($this->_currentPackageLength > strlen($this->_recvBuffer)) { break; } } else { // Get current package length. set_error_handler(function($code, $msg, $file, $line){ Worker::safeEcho("$msg in file $file on line $line\n"); }); $this->_currentPackageLength = $parser::input($this->_recvBuffer, $this); restore_error_handler(); // The packet length is unknown. if ($this->_currentPackageLength === 0) { break; } elseif ($this->_currentPackageLength > 0 && $this->_currentPackageLength <= $this->maxPackageSize) { // Data is not enough for a package. if ($this->_currentPackageLength > strlen($this->_recvBuffer)) { break; } } // Wrong package. else { Worker::safeEcho('error package. package_length=' . var_export($this->_currentPackageLength, true)); $this->destroy(); return; } } // The data is enough for a packet. self::$statistics['total_request']++; // The current packet length is equal to the length of the buffer. if (strlen($this->_recvBuffer) === $this->_currentPackageLength) { $one_request_buffer = $this->_recvBuffer; $this->_recvBuffer = ''; } else { // Get a full package from the buffer. $one_request_buffer = substr($this->_recvBuffer, 0, $this->_currentPackageLength); // Remove the current package from the receive buffer. $this->_recvBuffer = substr($this->_recvBuffer, $this->_currentPackageLength); } // Reset the current packet length to 0. $this->_currentPackageLength = 0; if (!$this->onMessage) { continue; } try { // Decode request buffer before Emitting onMessage callback. call_user_func($this->onMessage, $this, $parser::decode($one_request_buffer, $this)); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } return; } if ($this->_recvBuffer === '' || $this->_isPaused) { return; } // Applications protocol is not set. self::$statistics['total_request']++; if (!$this->onMessage) { $this->_recvBuffer = ''; return; } try { call_user_func($this->onMessage, $this, $this->_recvBuffer); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } // Clean receive buffer. $this->_recvBuffer = ''; }
[ "public", "function", "baseRead", "(", "$", "socket", ",", "$", "check_eof", "=", "true", ")", "{", "// SSL handshake.", "if", "(", "$", "this", "->", "transport", "===", "'ssl'", "&&", "$", "this", "->", "_sslHandshakeCompleted", "!==", "true", ")", "{", ...
Base read handler. @param resource $socket @param bool $check_eof @return void
[ "Base", "read", "handler", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Connection/TcpConnection.php#L577-L691
train
Base Read method.
[ 30522, 2270, 3853, 2918, 16416, 2094, 1006, 1002, 22278, 1010, 1002, 4638, 1035, 1041, 11253, 1027, 2995, 1007, 1063, 1013, 1013, 7020, 2140, 2398, 20459, 2063, 1012, 2065, 1006, 1002, 2023, 1011, 1028, 3665, 1027, 1027, 1027, 1005, 7020, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CmsException.php
CmsException.processPhp
protected function processPhp(Exception $exception) { /* * Fatal Error */ if ($exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException) { $check = false; // Expected: */modules/cms/classes/CodeParser.php(165) : eval()'d code line 7 if (strpos($exception->getFile(), 'CodeParser.php')) { $check = true; } // Expected: */storage/cms/cache/39/05/home.htm.php if (strpos($exception->getFile(), $this->compoundObject->getFileName() . '.php')) { $check = true; } if (!$check) { return false; } /* * Errors occurring the PHP code base class (Cms\Classes\CodeBase) */ } else { $trace = $exception->getTrace(); if (isset($trace[1]['class'])) { $class = $trace[1]['class']; if (!is_subclass_of($class, CodeBase::class)) { return false; } } } $this->message = $exception->getMessage(); // Offset the php, namespace and bracket tags from the generated class. $this->line = $exception->getLine() - 3; // Find where the php code section begins $offsetArray = SectionParser::parseOffset($this->compoundObject->getContent()); $this->line += $offsetArray['code']; // Account for line 0 $this->line--; return true; }
php
protected function processPhp(Exception $exception) { /* * Fatal Error */ if ($exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException) { $check = false; // Expected: */modules/cms/classes/CodeParser.php(165) : eval()'d code line 7 if (strpos($exception->getFile(), 'CodeParser.php')) { $check = true; } // Expected: */storage/cms/cache/39/05/home.htm.php if (strpos($exception->getFile(), $this->compoundObject->getFileName() . '.php')) { $check = true; } if (!$check) { return false; } /* * Errors occurring the PHP code base class (Cms\Classes\CodeBase) */ } else { $trace = $exception->getTrace(); if (isset($trace[1]['class'])) { $class = $trace[1]['class']; if (!is_subclass_of($class, CodeBase::class)) { return false; } } } $this->message = $exception->getMessage(); // Offset the php, namespace and bracket tags from the generated class. $this->line = $exception->getLine() - 3; // Find where the php code section begins $offsetArray = SectionParser::parseOffset($this->compoundObject->getContent()); $this->line += $offsetArray['code']; // Account for line 0 $this->line--; return true; }
[ "protected", "function", "processPhp", "(", "Exception", "$", "exception", ")", "{", "/*\n * Fatal Error\n */", "if", "(", "$", "exception", "instanceof", "\\", "Symfony", "\\", "Component", "\\", "Debug", "\\", "Exception", "\\", "FatalErrorException"...
Override properties of an exception specific to the PHP section of a CMS object. @param \Exception $exception The exception to modify. @return bool
[ "Override", "properties", "of", "an", "exception", "specific", "to", "the", "PHP", "section", "of", "a", "CMS", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsException.php#L143-L191
train
Checks if the exception is a fatal error and sets the message and line number
[ 30522, 5123, 3853, 2832, 8458, 2361, 1006, 6453, 1002, 6453, 1007, 1063, 1013, 1008, 1008, 10611, 7561, 1008, 1013, 2065, 1006, 1002, 6453, 6013, 11253, 1032, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 2139, 8569, 2290, 1032, 6453, 1032, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Facades/Date.php
Date.resolveFacadeInstance
protected static function resolveFacadeInstance($name) { if (! isset(static::$resolvedInstance[$name]) && ! isset(static::$app, static::$app[$name])) { $class = static::DEFAULT_FACADE; static::swap(new $class); } return parent::resolveFacadeInstance($name); }
php
protected static function resolveFacadeInstance($name) { if (! isset(static::$resolvedInstance[$name]) && ! isset(static::$app, static::$app[$name])) { $class = static::DEFAULT_FACADE; static::swap(new $class); } return parent::resolveFacadeInstance($name); }
[ "protected", "static", "function", "resolveFacadeInstance", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "resolvedInstance", "[", "$", "name", "]", ")", "&&", "!", "isset", "(", "static", "::", "$", "app", ",", "static...
Resolve the facade root instance from the container. @param string $name @return mixed
[ "Resolve", "the", "facade", "root", "instance", "from", "the", "container", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Facades/Date.php#L105-L114
train
Protected resolveFacadeInstance
[ 30522, 5123, 10763, 3853, 10663, 7011, 21869, 7076, 26897, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 10763, 1024, 1024, 1002, 10395, 7076, 26897, 1031, 1002, 2171, 1033, 1007, 1004, 1004, 999, 26354, 3388, 1006, 1076...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/ContainerBuilder.php
ContainerBuilder.addDefinitions
public function addDefinitions(array $definitions) { foreach ($definitions as $id => $definition) { $this->setDefinition($id, $definition); } }
php
public function addDefinitions(array $definitions) { foreach ($definitions as $id => $definition) { $this->setDefinition($id, $definition); } }
[ "public", "function", "addDefinitions", "(", "array", "$", "definitions", ")", "{", "foreach", "(", "$", "definitions", "as", "$", "id", "=>", "$", "definition", ")", "{", "$", "this", "->", "setDefinition", "(", "$", "id", ",", "$", "definition", ")", ...
Adds the service definitions. @param Definition[] $definitions An array of service definitions
[ "Adds", "the", "service", "definitions", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L948-L953
train
Add definitions to the language
[ 30522, 2270, 3853, 5587, 3207, 16294, 22753, 2015, 1006, 9140, 1002, 15182, 1007, 1063, 18921, 6776, 1006, 1002, 15182, 2004, 1002, 8909, 1027, 1028, 1002, 6210, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 3207, 16294, 22753, 1006, 1002, 8909...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
HasOneOrMany.matchMany
public function matchMany(array $models, Collection $results, $relation) { return $this->matchOneOrMany($models, $results, $relation, 'many'); }
php
public function matchMany(array $models, Collection $results, $relation) { return $this->matchOneOrMany($models, $results, $relation, 'many'); }
[ "public", "function", "matchMany", "(", "array", "$", "models", ",", "Collection", "$", "results", ",", "$", "relation", ")", "{", "return", "$", "this", "->", "matchOneOrMany", "(", "$", "models", ",", "$", "results", ",", "$", "relation", ",", "'many'"...
Match the eagerly loaded results to their many parents. @param array $models @param \Illuminate\Database\Eloquent\Collection $results @param string $relation @return array
[ "Match", "the", "eagerly", "loaded", "results", "to", "their", "many", "parents", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php#L112-L115
train
Match one or many
[ 30522, 2270, 3853, 2674, 2386, 2100, 1006, 9140, 1002, 4275, 1010, 3074, 1002, 3463, 1010, 1002, 7189, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2674, 5643, 2953, 2386, 2100, 1006, 1002, 4275, 1010, 1002, 3463, 1010, 1002, 7189, 1010, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.sort
public function sort($functionCallback, $columnSortedBy) { $this->setTableSortedBy($columnSortedBy); usort($this->rows, $functionCallback); if ($this->isSortRecursiveEnabled()) { foreach ($this->getRowsWithoutSummaryRow() as $row) { $subTable = $row->getSubtable(); if ($subTable) { $subTable->enableRecursiveSort(); $subTable->sort($functionCallback, $columnSortedBy); } } } }
php
public function sort($functionCallback, $columnSortedBy) { $this->setTableSortedBy($columnSortedBy); usort($this->rows, $functionCallback); if ($this->isSortRecursiveEnabled()) { foreach ($this->getRowsWithoutSummaryRow() as $row) { $subTable = $row->getSubtable(); if ($subTable) { $subTable->enableRecursiveSort(); $subTable->sort($functionCallback, $columnSortedBy); } } } }
[ "public", "function", "sort", "(", "$", "functionCallback", ",", "$", "columnSortedBy", ")", "{", "$", "this", "->", "setTableSortedBy", "(", "$", "columnSortedBy", ")", ";", "usort", "(", "$", "this", "->", "rows", ",", "$", "functionCallback", ")", ";", ...
Sorts the DataTable rows using the supplied callback function. @param string $functionCallback A comparison callback compatible with {@link usort}. @param string $columnSortedBy The column name `$functionCallback` sorts by. This is stored so we can determine how the DataTable was sorted in the future.
[ "Sorts", "the", "DataTable", "rows", "using", "the", "supplied", "callback", "function", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L399-L414
train
Sort the table by a callback
[ 30522, 2270, 3853, 4066, 1006, 1002, 3853, 9289, 20850, 8684, 1010, 1002, 7753, 15613, 3762, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 10880, 21748, 3064, 3762, 1006, 1002, 7753, 15613, 3762, 1007, 1025, 2149, 11589, 1006, 1002, 2023, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Redirector.php
Redirector.refresh
public function refresh($status = 302, $headers = []) { return $this->to($this->generator->getRequest()->path(), $status, $headers); }
php
public function refresh($status = 302, $headers = []) { return $this->to($this->generator->getRequest()->path(), $status, $headers); }
[ "public", "function", "refresh", "(", "$", "status", "=", "302", ",", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "to", "(", "$", "this", "->", "generator", "->", "getRequest", "(", ")", "->", "path", "(", ")", ",", "$",...
Create a new redirect response to the current URI. @param int $status @param array $headers @return \Illuminate\Http\RedirectResponse
[ "Create", "a", "new", "redirect", "response", "to", "the", "current", "URI", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Redirector.php#L69-L72
train
Refreshes the page to the current URL
[ 30522, 2270, 3853, 25416, 21898, 1006, 1002, 3570, 1027, 22060, 1010, 1002, 20346, 2015, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2000, 1006, 1002, 2023, 1011, 1028, 13103, 1011, 1028, 2131, 2890, 15500, 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...
matomo-org/matomo
libs/Zend/Db/Table/Abstract.php
Zend_Db_Table_Abstract._order
protected function _order(Zend_Db_Table_Select $select, $order) { if (!is_array($order)) { $order = array($order); } foreach ($order as $val) { $select->order($val); } return $select; }
php
protected function _order(Zend_Db_Table_Select $select, $order) { if (!is_array($order)) { $order = array($order); } foreach ($order as $val) { $select->order($val); } return $select; }
[ "protected", "function", "_order", "(", "Zend_Db_Table_Select", "$", "select", ",", "$", "order", ")", "{", "if", "(", "!", "is_array", "(", "$", "order", ")", ")", "{", "$", "order", "=", "array", "(", "$", "order", ")", ";", "}", "foreach", "(", ...
Generate ORDER clause from user-supplied string or array @param string|array $order OPTIONAL An SQL ORDER clause. @return Zend_Db_Table_Select
[ "Generate", "ORDER", "clause", "from", "user", "-", "supplied", "string", "or", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L1508-L1519
train
Order the result set
[ 30522, 5123, 3853, 1035, 2344, 1006, 16729, 2094, 1035, 16962, 1035, 2795, 1035, 7276, 1002, 7276, 1010, 1002, 30524, 9140, 1006, 1002, 2344, 1007, 1025, 1065, 18921, 6776, 1006, 1002, 2344, 2004, 1002, 11748, 1007, 1063, 1002, 7276, 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...
matomo-org/matomo
core/AssetManager.php
AssetManager.getMergedStylesheet
public function getMergedStylesheet() { $mergedAsset = $this->getMergedStylesheetAsset(); $assetFetcher = new StylesheetUIAssetFetcher(Manager::getInstance()->getLoadedPluginsName(), $this->theme); $assetMerger = new StylesheetUIAssetMerger($mergedAsset, $assetFetcher, $this->cacheBuster); $assetMerger->generateFile(); return $mergedAsset; }
php
public function getMergedStylesheet() { $mergedAsset = $this->getMergedStylesheetAsset(); $assetFetcher = new StylesheetUIAssetFetcher(Manager::getInstance()->getLoadedPluginsName(), $this->theme); $assetMerger = new StylesheetUIAssetMerger($mergedAsset, $assetFetcher, $this->cacheBuster); $assetMerger->generateFile(); return $mergedAsset; }
[ "public", "function", "getMergedStylesheet", "(", ")", "{", "$", "mergedAsset", "=", "$", "this", "->", "getMergedStylesheetAsset", "(", ")", ";", "$", "assetFetcher", "=", "new", "StylesheetUIAssetFetcher", "(", "Manager", "::", "getInstance", "(", ")", "->", ...
Return the css merged file absolute location. If there is none, the generation process will be triggered. @return UIAsset
[ "Return", "the", "css", "merged", "file", "absolute", "location", ".", "If", "there", "is", "none", "the", "generation", "process", "will", "be", "triggered", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/AssetManager.php#L158-L169
train
Get merged stylesheet
[ 30522, 2270, 3853, 2131, 5017, 5999, 21756, 4244, 21030, 2102, 1006, 1007, 1063, 1002, 5314, 27241, 2102, 1027, 1002, 2023, 1011, 1028, 2131, 5017, 5999, 21756, 4244, 21030, 10230, 13462, 1006, 1007, 1025, 1002, 11412, 7959, 10649, 2121, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Common.php
Common.sendResponseCode
public static function sendResponseCode($code) { $messages = array( 200 => 'Ok', 204 => 'No Response', 301 => 'Moved Permanently', 302 => 'Found', 304 => 'Not Modified', 400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'Not Found', 500 => 'Internal Server Error', 503 => 'Service Unavailable', ); if (!array_key_exists($code, $messages)) { throw new Exception('Response code not supported: ' . $code); } if (strpos(PHP_SAPI, '-fcgi') === false) { $key = 'HTTP/1.1'; if (array_key_exists('SERVER_PROTOCOL', $_SERVER) && strlen($_SERVER['SERVER_PROTOCOL']) < 15 && strlen($_SERVER['SERVER_PROTOCOL']) > 1) { $key = $_SERVER['SERVER_PROTOCOL']; } } else { // FastCGI $key = 'Status:'; } $message = $messages[$code]; Common::sendHeader($key . ' ' . $code . ' ' . $message); }
php
public static function sendResponseCode($code) { $messages = array( 200 => 'Ok', 204 => 'No Response', 301 => 'Moved Permanently', 302 => 'Found', 304 => 'Not Modified', 400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'Not Found', 500 => 'Internal Server Error', 503 => 'Service Unavailable', ); if (!array_key_exists($code, $messages)) { throw new Exception('Response code not supported: ' . $code); } if (strpos(PHP_SAPI, '-fcgi') === false) { $key = 'HTTP/1.1'; if (array_key_exists('SERVER_PROTOCOL', $_SERVER) && strlen($_SERVER['SERVER_PROTOCOL']) < 15 && strlen($_SERVER['SERVER_PROTOCOL']) > 1) { $key = $_SERVER['SERVER_PROTOCOL']; } } else { // FastCGI $key = 'Status:'; } $message = $messages[$code]; Common::sendHeader($key . ' ' . $code . ' ' . $message); }
[ "public", "static", "function", "sendResponseCode", "(", "$", "code", ")", "{", "$", "messages", "=", "array", "(", "200", "=>", "'Ok'", ",", "204", "=>", "'No Response'", ",", "301", "=>", "'Moved Permanently'", ",", "302", "=>", "'Found'", ",", "304", ...
Sends the given response code if supported. @param int $code Eg 204 @throws Exception
[ "Sends", "the", "given", "response", "code", "if", "supported", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L1196-L1231
train
Send Response Code
[ 30522, 2270, 10763, 3853, 4604, 6072, 26029, 3366, 16044, 1006, 1002, 3642, 1007, 1063, 1002, 7696, 1027, 9140, 1006, 3263, 1027, 30524, 1027, 1028, 1005, 2179, 1005, 1010, 23859, 1027, 1028, 1005, 2025, 6310, 1005, 1010, 4278, 1027, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/FormConfigBuilder.php
FormConfigBuilder.setType
public function setType(ResolvedFormTypeInterface $type) { if ($this->locked) { throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } $this->type = $type; return $this; }
php
public function setType(ResolvedFormTypeInterface $type) { if ($this->locked) { throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } $this->type = $type; return $this; }
[ "public", "function", "setType", "(", "ResolvedFormTypeInterface", "$", "type", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "BadMethodCallException", "(", "'FormConfigBuilder methods cannot be accessed anymore once the builder is turned into ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormConfigBuilder.php#L642-L651
train
Set the type of the form
[ 30522, 2270, 3853, 2275, 13874, 1006, 10395, 14192, 13874, 18447, 2121, 12172, 1002, 2828, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 2919, 11368, 6806, 16409, 24164, 2595, 24422, 1006, 1005, 2433, 8663, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Referrers/SearchEngine.php
SearchEngine.getLogoFromUrl
public function getLogoFromUrl($url) { $pathInPiwik = 'plugins/Morpheus/icons/dist/searchEngines/%s.png'; $pathWithCode = sprintf($pathInPiwik, $this->getHostFromUrl($url)); $absolutePath = PIWIK_INCLUDE_PATH . '/' . $pathWithCode; if (file_exists($absolutePath)) { return $pathWithCode; } return sprintf($pathInPiwik, 'xx'); }
php
public function getLogoFromUrl($url) { $pathInPiwik = 'plugins/Morpheus/icons/dist/searchEngines/%s.png'; $pathWithCode = sprintf($pathInPiwik, $this->getHostFromUrl($url)); $absolutePath = PIWIK_INCLUDE_PATH . '/' . $pathWithCode; if (file_exists($absolutePath)) { return $pathWithCode; } return sprintf($pathInPiwik, 'xx'); }
[ "public", "function", "getLogoFromUrl", "(", "$", "url", ")", "{", "$", "pathInPiwik", "=", "'plugins/Morpheus/icons/dist/searchEngines/%s.png'", ";", "$", "pathWithCode", "=", "sprintf", "(", "$", "pathInPiwik", ",", "$", "this", "->", "getHostFromUrl", "(", "$",...
Return search engine logo path by URL @param string $url @return string path @see plugins/Morpheus/icons/dist/searchEnginges/
[ "Return", "search", "engine", "logo", "path", "by", "URL" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/SearchEngine.php#L465-L474
train
Get Logo from URL
[ 30522, 2270, 3853, 2131, 21197, 11253, 21716, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1063, 1002, 4130, 2378, 8197, 9148, 2243, 1027, 1005, 13354, 7076, 1013, 22822, 22809, 1013, 18407, 1013, 4487, 3367, 1013, 3945, 13159, 10586, 1013, 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...
overtrue/wechat
src/Kernel/AccessToken.php
AccessToken.getToken
public function getToken(bool $refresh = false): array { $cacheKey = $this->getCacheKey(); $cache = $this->getCache(); if (!$refresh && $cache->has($cacheKey)) { return $cache->get($cacheKey); } $token = $this->requestToken($this->getCredentials(), true); $this->setToken($token[$this->tokenKey], $token['expires_in'] ?? 7200); return $token; }
php
public function getToken(bool $refresh = false): array { $cacheKey = $this->getCacheKey(); $cache = $this->getCache(); if (!$refresh && $cache->has($cacheKey)) { return $cache->get($cacheKey); } $token = $this->requestToken($this->getCredentials(), true); $this->setToken($token[$this->tokenKey], $token['expires_in'] ?? 7200); return $token; }
[ "public", "function", "getToken", "(", "bool", "$", "refresh", "=", "false", ")", ":", "array", "{", "$", "cacheKey", "=", "$", "this", "->", "getCacheKey", "(", ")", ";", "$", "cache", "=", "$", "this", "->", "getCache", "(", ")", ";", "if", "(", ...
@param bool $refresh @return array @throws \EasyWeChat\Kernel\Exceptions\HttpException @throws \Psr\SimpleCache\InvalidArgumentException @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
[ "@param", "bool", "$refresh" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/AccessToken.php#L108-L122
train
Get token from the API
[ 30522, 2270, 3853, 2131, 18715, 2368, 1006, 22017, 2140, 1002, 25416, 21898, 1027, 6270, 1007, 1024, 9140, 1063, 1002, 17053, 14839, 1027, 1002, 2023, 1011, 1028, 2131, 3540, 5403, 14839, 1006, 1007, 1025, 1002, 17053, 1027, 1002, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/PluginManager.php
PluginManager.findByNamespace
public function findByNamespace($namespace) { if (!$this->hasPlugin($namespace)) { return null; } $classId = $this->getIdentifier($namespace); return $this->plugins[$classId]; }
php
public function findByNamespace($namespace) { if (!$this->hasPlugin($namespace)) { return null; } $classId = $this->getIdentifier($namespace); return $this->plugins[$classId]; }
[ "public", "function", "findByNamespace", "(", "$", "namespace", ")", "{", "if", "(", "!", "$", "this", "->", "hasPlugin", "(", "$", "namespace", ")", ")", "{", "return", "null", ";", "}", "$", "classId", "=", "$", "this", "->", "getIdentifier", "(", ...
Returns a plugin registration class based on its namespace (Author\Plugin).
[ "Returns", "a", "plugin", "registration", "class", "based", "on", "its", "namespace", "(", "Author", "\\", "Plugin", ")", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L332-L341
train
Find a plugin by its namespace
[ 30522, 2270, 3853, 2424, 3762, 18442, 23058, 1006, 1002, 3415, 15327, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2038, 24759, 15916, 2378, 1006, 1002, 3415, 15327, 1007, 1007, 1063, 2709, 19701, 1025, 1065, 1002, 2465, 3593, 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/RouteUrlGenerator.php
RouteUrlGenerator.to
public function to($route, $parameters = [], $absolute = false) { $domain = $this->getRouteDomain($route, $parameters); // First we will construct the entire URI including the root and query string. Once it // has been constructed, we'll make sure we don't have any missing parameters or we // will need to throw the exception to let the developers know one was not given. $uri = $this->addQueryString($this->url->format( $root = $this->replaceRootParameters($route, $domain, $parameters), $this->replaceRouteParameters($route->uri(), $parameters), $route ), $parameters); if (preg_match('/\{.*?\}/', $uri)) { throw UrlGenerationException::forMissingParameters($route); } // Once we have ensured that there are no missing parameters in the URI we will encode // the URI and prepare it for returning to the developer. If the URI is supposed to // be absolute, we will return it as-is. Otherwise we will remove the URL's root. $uri = strtr(rawurlencode($uri), $this->dontEncode); if (! $absolute) { $uri = preg_replace('#^(//|[^/?])+#', '', $uri); if ($base = $this->request->getBaseUrl()) { $uri = preg_replace('#^'.$base.'#i', '', $uri); } return '/'.ltrim($uri, '/'); } return $uri; }
php
public function to($route, $parameters = [], $absolute = false) { $domain = $this->getRouteDomain($route, $parameters); // First we will construct the entire URI including the root and query string. Once it // has been constructed, we'll make sure we don't have any missing parameters or we // will need to throw the exception to let the developers know one was not given. $uri = $this->addQueryString($this->url->format( $root = $this->replaceRootParameters($route, $domain, $parameters), $this->replaceRouteParameters($route->uri(), $parameters), $route ), $parameters); if (preg_match('/\{.*?\}/', $uri)) { throw UrlGenerationException::forMissingParameters($route); } // Once we have ensured that there are no missing parameters in the URI we will encode // the URI and prepare it for returning to the developer. If the URI is supposed to // be absolute, we will return it as-is. Otherwise we will remove the URL's root. $uri = strtr(rawurlencode($uri), $this->dontEncode); if (! $absolute) { $uri = preg_replace('#^(//|[^/?])+#', '', $uri); if ($base = $this->request->getBaseUrl()) { $uri = preg_replace('#^'.$base.'#i', '', $uri); } return '/'.ltrim($uri, '/'); } return $uri; }
[ "public", "function", "to", "(", "$", "route", ",", "$", "parameters", "=", "[", "]", ",", "$", "absolute", "=", "false", ")", "{", "$", "domain", "=", "$", "this", "->", "getRouteDomain", "(", "$", "route", ",", "$", "parameters", ")", ";", "// Fi...
Generate a URL for the given route. @param \Illuminate\Routing\Route $route @param array $parameters @param bool $absolute @return string @throws \Illuminate\Routing\Exceptions\UrlGenerationException
[ "Generate", "a", "URL", "for", "the", "given", "route", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteUrlGenerator.php#L77-L110
train
Generate the URL for the given route and parameters
[ 30522, 2270, 3853, 2000, 1006, 1002, 2799, 1010, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 7619, 1027, 6270, 1007, 1063, 1002, 5884, 1027, 1002, 2023, 1011, 1028, 2131, 25849, 9626, 2378, 1006, 1002, 2799, 1010, 1002, 11709, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/Loader/ChainLoader.php
ChainLoader.load
public function load(TemplateReferenceInterface $template) { foreach ($this->loaders as $loader) { if (false !== $storage = $loader->load($template)) { return $storage; } } return false; }
php
public function load(TemplateReferenceInterface $template) { foreach ($this->loaders as $loader) { if (false !== $storage = $loader->load($template)) { return $storage; } } return false; }
[ "public", "function", "load", "(", "TemplateReferenceInterface", "$", "template", ")", "{", "foreach", "(", "$", "this", "->", "loaders", "as", "$", "loader", ")", "{", "if", "(", "false", "!==", "$", "storage", "=", "$", "loader", "->", "load", "(", "...
Loads a template. @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise
[ "Loads", "a", "template", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Loader/ChainLoader.php#L49-L58
train
Load a template
[ 30522, 2270, 3853, 7170, 1006, 23561, 2890, 25523, 18447, 2121, 12172, 1002, 23561, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 7170, 2545, 2004, 1002, 7170, 2121, 1007, 1063, 2065, 1006, 6270, 999, 1027, 1027, 1002, 5527, 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/Database/Query/Builder.php
Builder.insertGetId
public function insertGetId(array $values, $sequence = null) { $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); $values = $this->cleanBindings($values); return $this->processor->processInsertGetId($this, $sql, $values, $sequence); }
php
public function insertGetId(array $values, $sequence = null) { $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); $values = $this->cleanBindings($values); return $this->processor->processInsertGetId($this, $sql, $values, $sequence); }
[ "public", "function", "insertGetId", "(", "array", "$", "values", ",", "$", "sequence", "=", "null", ")", "{", "$", "sql", "=", "$", "this", "->", "grammar", "->", "compileInsertGetId", "(", "$", "this", ",", "$", "values", ",", "$", "sequence", ")", ...
Insert a new record and get the value of the primary key. @param array $values @param string|null $sequence @return int
[ "Insert", "a", "new", "record", "and", "get", "the", "value", "of", "the", "primary", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2651-L2658
train
Insert and get ID statement
[ 30522, 30524, 18150, 3593, 1006, 1002, 2023, 1010, 1002, 5300, 1010, 1002, 5537, 1007, 1025, 1002, 5300, 1027, 1002, 2023, 1011, 1028, 4550, 8428, 4667, 2015, 1006, 1002, 5300, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 13151, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Simple/PhpArrayCache.php
PhpArrayCache.get
public function get($key, $default = null) { if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); } if (null === $this->values) { $this->initialize(); } if (!isset($this->keys[$key])) { return $this->pool->get($key, $default); } $value = $this->values[$this->keys[$key]]; if ('N;' === $value) { return null; } if ($value instanceof \Closure) { try { return $value(); } catch (\Throwable $e) { return $default; } } return $value; }
php
public function get($key, $default = null) { if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); } if (null === $this->values) { $this->initialize(); } if (!isset($this->keys[$key])) { return $this->pool->get($key, $default); } $value = $this->values[$this->keys[$key]]; if ('N;' === $value) { return null; } if ($value instanceof \Closure) { try { return $value(); } catch (\Throwable $e) { return $default; } } return $value; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "\\", "is_string", "(", "$", "key", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Cache key must be string, \"%s\"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/PhpArrayCache.php#L61-L86
train
Get a value from the cache
[ 30522, 2270, 3853, 2131, 1006, 1002, 3145, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 5164, 1006, 1002, 3145, 1007, 1007, 1063, 5466, 2047, 19528, 2906, 22850, 15781, 2595, 24422, 1006, 9043, 2546, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/API.php
API.updateUser
public function updateUser($userLogin, $password = false, $email = false, $alias = false, $_isPasswordHashed = false, $passwordConfirmation = false) { $requirePasswordConfirmation = self::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION; $isEmailNotificationOnInConfig = Config::getInstance()->General['enable_update_users_email']; self::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION = true; Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin); $this->checkUserIsNotAnonymous($userLogin); $this->checkUserExists($userLogin); $userInfo = $this->model->getUser($userLogin); $token_auth = $userInfo['token_auth']; $changeShouldRequirePasswordConfirmation = false; $passwordHasBeenUpdated = false; if (empty($password)) { $password = false; } else { $changeShouldRequirePasswordConfirmation = true; $password = Common::unsanitizeInputValue($password); if (!$_isPasswordHashed) { UsersManager::checkPassword($password); $password = UsersManager::getPasswordHash($password); } $passwordInfo = $this->password->info($password); if (!isset($passwordInfo['algo']) || 0 >= $passwordInfo['algo']) { // password may have already been fully hashed $password = $this->password->hash($password); } $passwordHasBeenUpdated = true; } if (empty($alias)) { $alias = $userInfo['alias']; } if (empty($email)) { $email = $userInfo['email']; } if ($email != $userInfo['email']) { $this->checkEmail($email); $changeShouldRequirePasswordConfirmation = true; } if ($changeShouldRequirePasswordConfirmation && $requirePasswordConfirmation) { if (empty($passwordConfirmation)) { throw new Exception(Piwik::translate('UsersManager_ConfirmWithPassword')); } $passwordConfirmation = Common::unsanitizeInputValue($passwordConfirmation); $loginCurrentUser = Piwik::getCurrentUserLogin(); if (!$this->passwordVerifier->isPasswordCorrect($loginCurrentUser, $passwordConfirmation)) { throw new Exception(Piwik::translate('UsersManager_CurrentPasswordNotCorrect')); } } $alias = $this->getCleanAlias($alias, $userLogin); $this->model->updateUser($userLogin, $password, $email, $alias, $token_auth); Cache::deleteTrackerCache(); if ($email != $userInfo['email'] && $isEmailNotificationOnInConfig) { $this->sendEmailChangedEmail($userInfo, $email); } if ($passwordHasBeenUpdated && $requirePasswordConfirmation && $isEmailNotificationOnInConfig) { $this->sendPasswordChangedEmail($userInfo); } /** * Triggered after an existing user has been updated. * Event notify about password change. * * @param string $userLogin The user's login handle. * @param boolean $passwordHasBeenUpdated Flag containing information about password change. */ Piwik::postEvent('UsersManager.updateUser.end', array($userLogin, $passwordHasBeenUpdated, $email, $password, $alias)); }
php
public function updateUser($userLogin, $password = false, $email = false, $alias = false, $_isPasswordHashed = false, $passwordConfirmation = false) { $requirePasswordConfirmation = self::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION; $isEmailNotificationOnInConfig = Config::getInstance()->General['enable_update_users_email']; self::$UPDATE_USER_REQUIRE_PASSWORD_CONFIRMATION = true; Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin); $this->checkUserIsNotAnonymous($userLogin); $this->checkUserExists($userLogin); $userInfo = $this->model->getUser($userLogin); $token_auth = $userInfo['token_auth']; $changeShouldRequirePasswordConfirmation = false; $passwordHasBeenUpdated = false; if (empty($password)) { $password = false; } else { $changeShouldRequirePasswordConfirmation = true; $password = Common::unsanitizeInputValue($password); if (!$_isPasswordHashed) { UsersManager::checkPassword($password); $password = UsersManager::getPasswordHash($password); } $passwordInfo = $this->password->info($password); if (!isset($passwordInfo['algo']) || 0 >= $passwordInfo['algo']) { // password may have already been fully hashed $password = $this->password->hash($password); } $passwordHasBeenUpdated = true; } if (empty($alias)) { $alias = $userInfo['alias']; } if (empty($email)) { $email = $userInfo['email']; } if ($email != $userInfo['email']) { $this->checkEmail($email); $changeShouldRequirePasswordConfirmation = true; } if ($changeShouldRequirePasswordConfirmation && $requirePasswordConfirmation) { if (empty($passwordConfirmation)) { throw new Exception(Piwik::translate('UsersManager_ConfirmWithPassword')); } $passwordConfirmation = Common::unsanitizeInputValue($passwordConfirmation); $loginCurrentUser = Piwik::getCurrentUserLogin(); if (!$this->passwordVerifier->isPasswordCorrect($loginCurrentUser, $passwordConfirmation)) { throw new Exception(Piwik::translate('UsersManager_CurrentPasswordNotCorrect')); } } $alias = $this->getCleanAlias($alias, $userLogin); $this->model->updateUser($userLogin, $password, $email, $alias, $token_auth); Cache::deleteTrackerCache(); if ($email != $userInfo['email'] && $isEmailNotificationOnInConfig) { $this->sendEmailChangedEmail($userInfo, $email); } if ($passwordHasBeenUpdated && $requirePasswordConfirmation && $isEmailNotificationOnInConfig) { $this->sendPasswordChangedEmail($userInfo); } /** * Triggered after an existing user has been updated. * Event notify about password change. * * @param string $userLogin The user's login handle. * @param boolean $passwordHasBeenUpdated Flag containing information about password change. */ Piwik::postEvent('UsersManager.updateUser.end', array($userLogin, $passwordHasBeenUpdated, $email, $password, $alias)); }
[ "public", "function", "updateUser", "(", "$", "userLogin", ",", "$", "password", "=", "false", ",", "$", "email", "=", "false", ",", "$", "alias", "=", "false", ",", "$", "_isPasswordHashed", "=", "false", ",", "$", "passwordConfirmation", "=", "false", ...
Updates a user in the database. Only login and password are required (case when we update the password). If password or email changes, it is required to also specify the password of the current user needs to be specified to confirm this change. @see addUser() for all the parameters
[ "Updates", "a", "user", "in", "the", "database", ".", "Only", "login", "and", "password", "are", "required", "(", "case", "when", "we", "update", "the", "password", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L852-L938
train
Updates a user s password
[ 30522, 2270, 3853, 10651, 20330, 1006, 1002, 5310, 21197, 2378, 1010, 1002, 20786, 1027, 6270, 1010, 1002, 10373, 1027, 6270, 1010, 1002, 14593, 1027, 6270, 1010, 1002, 1035, 2003, 15194, 18351, 14949, 9072, 1027, 6270, 1010, 1002, 20786, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Util/XmlUtils.php
XmlUtils.loadFile
public static function loadFile($file, $schemaOrCallable = null) { $content = @file_get_contents($file); if ('' === trim($content)) { throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file)); } try { return static::parse($content, $schemaOrCallable); } catch (InvalidXmlException $e) { throw new XmlParsingException(sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious()); } }
php
public static function loadFile($file, $schemaOrCallable = null) { $content = @file_get_contents($file); if ('' === trim($content)) { throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file)); } try { return static::parse($content, $schemaOrCallable); } catch (InvalidXmlException $e) { throw new XmlParsingException(sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious()); } }
[ "public", "static", "function", "loadFile", "(", "$", "file", ",", "$", "schemaOrCallable", "=", "null", ")", "{", "$", "content", "=", "@", "file_get_contents", "(", "$", "file", ")", ";", "if", "(", "''", "===", "trim", "(", "$", "content", ")", ")...
Loads an XML file. @param string $file An XML file path @param string|callable|null $schemaOrCallable An XSD schema file path, a callable, or null to disable validation @return \DOMDocument @throws \InvalidArgumentException When loading of XML file returns error @throws XmlParsingException When XML parsing returns any errors @throws \RuntimeException When DOM extension is missing
[ "Loads", "an", "XML", "file", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Util/XmlUtils.php#L123-L135
train
Load a XML file and return the array of children.
[ 30522, 2270, 10763, 3853, 7170, 8873, 2571, 1006, 1002, 5371, 1010, 1002, 8040, 28433, 2953, 9289, 20470, 2571, 1027, 19701, 1007, 1063, 30524, 1027, 12241, 1006, 1002, 4180, 1007, 1007, 1063, 5466, 2047, 1032, 19528, 2906, 22850, 15781, 25...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.addDateBasedWhere
protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') { $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); if (! $value instanceof Expression) { $this->addBinding($value, 'where'); } return $this; }
php
protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') { $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); if (! $value instanceof Expression) { $this->addBinding($value, 'where'); } return $this; }
[ "protected", "function", "addDateBasedWhere", "(", "$", "type", ",", "$", "column", ",", "$", "operator", ",", "$", "value", ",", "$", "boolean", "=", "'and'", ")", "{", "$", "this", "->", "wheres", "[", "]", "=", "compact", "(", "'column'", ",", "'t...
Add a date based (year, month, day, time) statement to the query. @param string $type @param string $column @param string $operator @param mixed $value @param string $boolean @return $this
[ "Add", "a", "date", "based", "(", "year", "month", "day", "time", ")", "statement", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1313-L1322
train
Adds a date based where clause to the list of where clauses
[ 30522, 5123, 3853, 5587, 13701, 15058, 2094, 2860, 5886, 2063, 1006, 1002, 2828, 1010, 1002, 5930, 1010, 1002, 6872, 1010, 1002, 3643, 1010, 1002, 22017, 20898, 1027, 1005, 1998, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 2073, 2015, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Console/ExtendCommand.php
ExtendCommand.makeDir
protected function makeDir($paths = '') { foreach ((array) $paths as $path) { $path = $this->extensionPath($path); $this->filesystem->makeDirectory($path, 0755, true, true); } }
php
protected function makeDir($paths = '') { foreach ((array) $paths as $path) { $path = $this->extensionPath($path); $this->filesystem->makeDirectory($path, 0755, true, true); } }
[ "protected", "function", "makeDir", "(", "$", "paths", "=", "''", ")", "{", "foreach", "(", "(", "array", ")", "$", "paths", "as", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "extensionPath", "(", "$", "path", ")", ";", "$", "this...
Make new directory. @param array|string $paths
[ "Make", "new", "directory", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ExtendCommand.php#L301-L308
train
Make directory for all extension paths
[ 30522, 5123, 3853, 2191, 4305, 2099, 1006, 1002, 10425, 1027, 1005, 1005, 1007, 1063, 18921, 6776, 1006, 1006, 9140, 1007, 1002, 10425, 2004, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 5331, 15069, 1006, 1002, 4130, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Frame/Factory.php
Factory.decorate_frame
static function decorate_frame(Frame $frame, Dompdf $dompdf, Frame $root = null) { if (is_null($dompdf)) { throw new Exception("The DOMPDF argument is required"); } $style = $frame->get_style(); // Floating (and more generally out-of-flow) elements are blocks // http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/ if (!$frame->is_in_flow() && in_array($style->display, Style::$INLINE_TYPES)) { $style->display = "block"; } $display = $style->display; switch ($display) { case "flex": //FIXME: display type not yet supported case "table-caption": //FIXME: display type not yet supported case "block": $positioner = "Block"; $decorator = "Block"; $reflower = "Block"; break; case "inline-flex": //FIXME: display type not yet supported case "inline-block": $positioner = "Inline"; $decorator = "Block"; $reflower = "Block"; break; case "inline": $positioner = "Inline"; if ($frame->is_text_node()) { $decorator = "Text"; $reflower = "Text"; } else { if ($style->float !== "none") { $decorator = "Block"; $reflower = "Block"; } else { $decorator = "Inline"; $reflower = "Inline"; } } break; case "table": $positioner = "Block"; $decorator = "Table"; $reflower = "Table"; break; case "inline-table": $positioner = "Inline"; $decorator = "Table"; $reflower = "Table"; break; case "table-row-group": case "table-header-group": case "table-footer-group": $positioner = "NullPositioner"; $decorator = "TableRowGroup"; $reflower = "TableRowGroup"; break; case "table-row": $positioner = "NullPositioner"; $decorator = "TableRow"; $reflower = "TableRow"; break; case "table-cell": $positioner = "TableCell"; $decorator = "TableCell"; $reflower = "TableCell"; break; case "list-item": $positioner = "Block"; $decorator = "Block"; $reflower = "Block"; break; case "-dompdf-list-bullet": if ($style->list_style_position === "inside") { $positioner = "Inline"; } else { $positioner = "ListBullet"; } if ($style->list_style_image !== "none") { $decorator = "ListBulletImage"; } else { $decorator = "ListBullet"; } $reflower = "ListBullet"; break; case "-dompdf-image": $positioner = "Inline"; $decorator = "Image"; $reflower = "Image"; break; case "-dompdf-br": $positioner = "Inline"; $decorator = "Inline"; $reflower = "Inline"; break; default: // FIXME: should throw some sort of warning or something? case "none": if ($style->_dompdf_keep !== "yes") { // Remove the node and the frame $frame->get_parent()->remove_child($frame); return; } $positioner = "NullPositioner"; $decorator = "NullFrameDecorator"; $reflower = "NullFrameReflower"; break; } // Handle CSS position $position = $style->position; if ($position === "absolute") { $positioner = "Absolute"; } else { if ($position === "fixed") { $positioner = "Fixed"; } } $node = $frame->get_node(); // Handle nodeName if ($node->nodeName === "img") { $style->display = "-dompdf-image"; $decorator = "Image"; $reflower = "Image"; } $decorator = "Dompdf\\FrameDecorator\\$decorator"; $reflower = "Dompdf\\FrameReflower\\$reflower"; /** @var AbstractFrameDecorator $deco */ $deco = new $decorator($frame, $dompdf); $deco->set_positioner(self::getPositionerInstance($positioner)); $deco->set_reflower(new $reflower($deco, $dompdf->getFontMetrics())); if ($root) { $deco->set_root($root); } if ($display === "list-item") { // Insert a list-bullet frame $xml = $dompdf->getDom(); $bullet_node = $xml->createElement("bullet"); // arbitrary choice $b_f = new Frame($bullet_node); $node = $frame->get_node(); $parent_node = $node->parentNode; if ($parent_node) { if (!$parent_node->hasAttribute("dompdf-children-count")) { $xpath = new DOMXPath($xml); $count = $xpath->query("li", $parent_node)->length; $parent_node->setAttribute("dompdf-children-count", $count); } if (is_numeric($node->getAttribute("value"))) { $index = intval($node->getAttribute("value")); } else { if (!$parent_node->hasAttribute("dompdf-counter")) { $index = ($parent_node->hasAttribute("start") ? $parent_node->getAttribute("start") : 1); } else { $index = (int)$parent_node->getAttribute("dompdf-counter") + 1; } } $parent_node->setAttribute("dompdf-counter", $index); $bullet_node->setAttribute("dompdf-counter", $index); } $new_style = $dompdf->getCss()->create_style(); $new_style->display = "-dompdf-list-bullet"; $new_style->inherit($style); $b_f->set_style($new_style); $deco->prepend_child(Factory::decorate_frame($b_f, $dompdf, $root)); } return $deco; }
php
static function decorate_frame(Frame $frame, Dompdf $dompdf, Frame $root = null) { if (is_null($dompdf)) { throw new Exception("The DOMPDF argument is required"); } $style = $frame->get_style(); // Floating (and more generally out-of-flow) elements are blocks // http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/ if (!$frame->is_in_flow() && in_array($style->display, Style::$INLINE_TYPES)) { $style->display = "block"; } $display = $style->display; switch ($display) { case "flex": //FIXME: display type not yet supported case "table-caption": //FIXME: display type not yet supported case "block": $positioner = "Block"; $decorator = "Block"; $reflower = "Block"; break; case "inline-flex": //FIXME: display type not yet supported case "inline-block": $positioner = "Inline"; $decorator = "Block"; $reflower = "Block"; break; case "inline": $positioner = "Inline"; if ($frame->is_text_node()) { $decorator = "Text"; $reflower = "Text"; } else { if ($style->float !== "none") { $decorator = "Block"; $reflower = "Block"; } else { $decorator = "Inline"; $reflower = "Inline"; } } break; case "table": $positioner = "Block"; $decorator = "Table"; $reflower = "Table"; break; case "inline-table": $positioner = "Inline"; $decorator = "Table"; $reflower = "Table"; break; case "table-row-group": case "table-header-group": case "table-footer-group": $positioner = "NullPositioner"; $decorator = "TableRowGroup"; $reflower = "TableRowGroup"; break; case "table-row": $positioner = "NullPositioner"; $decorator = "TableRow"; $reflower = "TableRow"; break; case "table-cell": $positioner = "TableCell"; $decorator = "TableCell"; $reflower = "TableCell"; break; case "list-item": $positioner = "Block"; $decorator = "Block"; $reflower = "Block"; break; case "-dompdf-list-bullet": if ($style->list_style_position === "inside") { $positioner = "Inline"; } else { $positioner = "ListBullet"; } if ($style->list_style_image !== "none") { $decorator = "ListBulletImage"; } else { $decorator = "ListBullet"; } $reflower = "ListBullet"; break; case "-dompdf-image": $positioner = "Inline"; $decorator = "Image"; $reflower = "Image"; break; case "-dompdf-br": $positioner = "Inline"; $decorator = "Inline"; $reflower = "Inline"; break; default: // FIXME: should throw some sort of warning or something? case "none": if ($style->_dompdf_keep !== "yes") { // Remove the node and the frame $frame->get_parent()->remove_child($frame); return; } $positioner = "NullPositioner"; $decorator = "NullFrameDecorator"; $reflower = "NullFrameReflower"; break; } // Handle CSS position $position = $style->position; if ($position === "absolute") { $positioner = "Absolute"; } else { if ($position === "fixed") { $positioner = "Fixed"; } } $node = $frame->get_node(); // Handle nodeName if ($node->nodeName === "img") { $style->display = "-dompdf-image"; $decorator = "Image"; $reflower = "Image"; } $decorator = "Dompdf\\FrameDecorator\\$decorator"; $reflower = "Dompdf\\FrameReflower\\$reflower"; /** @var AbstractFrameDecorator $deco */ $deco = new $decorator($frame, $dompdf); $deco->set_positioner(self::getPositionerInstance($positioner)); $deco->set_reflower(new $reflower($deco, $dompdf->getFontMetrics())); if ($root) { $deco->set_root($root); } if ($display === "list-item") { // Insert a list-bullet frame $xml = $dompdf->getDom(); $bullet_node = $xml->createElement("bullet"); // arbitrary choice $b_f = new Frame($bullet_node); $node = $frame->get_node(); $parent_node = $node->parentNode; if ($parent_node) { if (!$parent_node->hasAttribute("dompdf-children-count")) { $xpath = new DOMXPath($xml); $count = $xpath->query("li", $parent_node)->length; $parent_node->setAttribute("dompdf-children-count", $count); } if (is_numeric($node->getAttribute("value"))) { $index = intval($node->getAttribute("value")); } else { if (!$parent_node->hasAttribute("dompdf-counter")) { $index = ($parent_node->hasAttribute("start") ? $parent_node->getAttribute("start") : 1); } else { $index = (int)$parent_node->getAttribute("dompdf-counter") + 1; } } $parent_node->setAttribute("dompdf-counter", $index); $bullet_node->setAttribute("dompdf-counter", $index); } $new_style = $dompdf->getCss()->create_style(); $new_style->display = "-dompdf-list-bullet"; $new_style->inherit($style); $b_f->set_style($new_style); $deco->prepend_child(Factory::decorate_frame($b_f, $dompdf, $root)); } return $deco; }
[ "static", "function", "decorate_frame", "(", "Frame", "$", "frame", ",", "Dompdf", "$", "dompdf", ",", "Frame", "$", "root", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "dompdf", ")", ")", "{", "throw", "new", "Exception", "(", "\"The DOMPDF...
Decorate a Frame @param Frame $frame The frame to decorate @param Dompdf $dompdf The dompdf instance @param Frame $root The frame to decorate @throws Exception @return AbstractFrameDecorator FIXME: this is admittedly a little smelly...
[ "Decorate", "a", "Frame" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame/Factory.php#L69-L271
train
Decorates a Frame with the Dompdf object
[ 30522, 10763, 3853, 29460, 1035, 4853, 1006, 4853, 1002, 4853, 1010, 14383, 17299, 2546, 1002, 14383, 17299, 2546, 1010, 4853, 1002, 7117, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 14383, 17299, 2546, 1007, 1007, 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/Framework/Form/Traits/FormTrait.php
FormTrait.render
public function render(string $layout = null, array $context = []) { if (null === $layout) { $layout = 'default'; } $grav = Grav::instance(); $block = HtmlBlock::create(); $block->disableCache(); $output = $this->getTemplate($layout)->render( ['grav' => $grav, 'config' => $grav['config'], 'block' => $block, 'form' => $this, 'layout' => $layout] + $context ); $block->setContent($output); return $block; }
php
public function render(string $layout = null, array $context = []) { if (null === $layout) { $layout = 'default'; } $grav = Grav::instance(); $block = HtmlBlock::create(); $block->disableCache(); $output = $this->getTemplate($layout)->render( ['grav' => $grav, 'config' => $grav['config'], 'block' => $block, 'form' => $this, 'layout' => $layout] + $context ); $block->setContent($output); return $block; }
[ "public", "function", "render", "(", "string", "$", "layout", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "if", "(", "null", "===", "$", "layout", ")", "{", "$", "layout", "=", "'default'", ";", "}", "$", "grav", "=", "Gra...
{@inheritdoc} @see FormInterface::render()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L372-L390
train
Render the form
[ 30522, 2270, 3853, 17552, 1006, 5164, 1002, 9621, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 9621, 1007, 1063, 1002, 9621, 1027, 1005, 12398, 1005, 1025, 1065, 1002, 24665, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/MediaManager.php
MediaManager.listFolderItems
protected function listFolderItems($folder, $filter, $sortBy) { $filter = $filter !== self::FILTER_EVERYTHING ? $filter : null; return MediaLibrary::instance()->listFolderContents($folder, $sortBy, $filter); }
php
protected function listFolderItems($folder, $filter, $sortBy) { $filter = $filter !== self::FILTER_EVERYTHING ? $filter : null; return MediaLibrary::instance()->listFolderContents($folder, $sortBy, $filter); }
[ "protected", "function", "listFolderItems", "(", "$", "folder", ",", "$", "filter", ",", "$", "sortBy", ")", "{", "$", "filter", "=", "$", "filter", "!==", "self", "::", "FILTER_EVERYTHING", "?", "$", "filter", ":", "null", ";", "return", "MediaLibrary", ...
Returns a list of folders and files in a Library folder. @param string $searchTerm @param string $filter @param string $sortBy @param array[System\Classes\MediaLibraryItem]
[ "Returns", "a", "list", "of", "folders", "and", "files", "in", "a", "Library", "folder", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L855-L860
train
List all items in a folder
[ 30522, 5123, 3853, 2862, 10371, 11124, 18532, 2015, 1006, 1002, 19622, 1010, 1002, 11307, 1010, 1002, 4066, 3762, 1007, 1063, 1002, 11307, 1027, 1002, 11307, 999, 1027, 1027, 2969, 1024, 1024, 11307, 1035, 2673, 1029, 1002, 11307, 1024, 197...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
WebServer.php
WebServer.onMessage
public function onMessage($connection) { // REQUEST_URI. $workerman_url_info = parse_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); if (!$workerman_url_info) { Http::header('HTTP/1.1 400 Bad Request'); $connection->close('<h1>400 Bad Request</h1>'); return; } $workerman_path = isset($workerman_url_info['path']) ? $workerman_url_info['path'] : '/'; $workerman_path_info = pathinfo($workerman_path); $workerman_file_extension = isset($workerman_path_info['extension']) ? $workerman_path_info['extension'] : ''; if ($workerman_file_extension === '') { $workerman_path = ($len = strlen($workerman_path)) && $workerman_path[$len - 1] === '/' ? $workerman_path . 'index.php' : $workerman_path . '/index.php'; $workerman_file_extension = 'php'; } $workerman_siteConfig = isset($this->serverRoot[$_SERVER['SERVER_NAME']]) ? $this->serverRoot[$_SERVER['SERVER_NAME']] : current($this->serverRoot); $workerman_root_dir = $workerman_siteConfig['root']; $workerman_file = "$workerman_root_dir/$workerman_path"; if(isset($workerman_siteConfig['additionHeader'])){ Http::header($workerman_siteConfig['additionHeader']); } if ($workerman_file_extension === 'php' && !is_file($workerman_file)) { $workerman_file = "$workerman_root_dir/index.php"; if (!is_file($workerman_file)) { $workerman_file = "$workerman_root_dir/index.html"; $workerman_file_extension = 'html'; } } // File exsits. if (is_file($workerman_file)) { // Security check. if ((!($workerman_request_realpath = realpath($workerman_file)) || !($workerman_root_dir_realpath = realpath($workerman_root_dir))) || 0 !== strpos($workerman_request_realpath, $workerman_root_dir_realpath) ) { Http::header('HTTP/1.1 400 Bad Request'); $connection->close('<h1>400 Bad Request</h1>'); return; } $workerman_file = realpath($workerman_file); // Request php file. if ($workerman_file_extension === 'php') { $workerman_cwd = getcwd(); chdir($workerman_root_dir); ini_set('display_errors', 'off'); ob_start(); // Try to include php file. try { // $_SERVER. $_SERVER['REMOTE_ADDR'] = $connection->getRemoteIp(); $_SERVER['REMOTE_PORT'] = $connection->getRemotePort(); include $workerman_file; } catch (\Exception $e) { // Jump_exit? if ($e->getMessage() != 'jump_exit') { Worker::safeEcho($e); } } $content = ob_get_clean(); ini_set('display_errors', 'on'); if (strtolower($_SERVER['HTTP_CONNECTION']) === "keep-alive") { $connection->send($content); } else { $connection->close($content); } chdir($workerman_cwd); return; } // Send file to client. return self::sendFile($connection, $workerman_file); } else { // 404 Http::header("HTTP/1.1 404 Not Found"); if(isset($workerman_siteConfig['custom404']) && file_exists($workerman_siteConfig['custom404'])){ $html404 = file_get_contents($workerman_siteConfig['custom404']); }else{ $html404 = '<html><head><title>404 File not found</title></head><body><center><h3>404 Not Found</h3></center></body></html>'; } $connection->close($html404); return; } }
php
public function onMessage($connection) { // REQUEST_URI. $workerman_url_info = parse_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); if (!$workerman_url_info) { Http::header('HTTP/1.1 400 Bad Request'); $connection->close('<h1>400 Bad Request</h1>'); return; } $workerman_path = isset($workerman_url_info['path']) ? $workerman_url_info['path'] : '/'; $workerman_path_info = pathinfo($workerman_path); $workerman_file_extension = isset($workerman_path_info['extension']) ? $workerman_path_info['extension'] : ''; if ($workerman_file_extension === '') { $workerman_path = ($len = strlen($workerman_path)) && $workerman_path[$len - 1] === '/' ? $workerman_path . 'index.php' : $workerman_path . '/index.php'; $workerman_file_extension = 'php'; } $workerman_siteConfig = isset($this->serverRoot[$_SERVER['SERVER_NAME']]) ? $this->serverRoot[$_SERVER['SERVER_NAME']] : current($this->serverRoot); $workerman_root_dir = $workerman_siteConfig['root']; $workerman_file = "$workerman_root_dir/$workerman_path"; if(isset($workerman_siteConfig['additionHeader'])){ Http::header($workerman_siteConfig['additionHeader']); } if ($workerman_file_extension === 'php' && !is_file($workerman_file)) { $workerman_file = "$workerman_root_dir/index.php"; if (!is_file($workerman_file)) { $workerman_file = "$workerman_root_dir/index.html"; $workerman_file_extension = 'html'; } } // File exsits. if (is_file($workerman_file)) { // Security check. if ((!($workerman_request_realpath = realpath($workerman_file)) || !($workerman_root_dir_realpath = realpath($workerman_root_dir))) || 0 !== strpos($workerman_request_realpath, $workerman_root_dir_realpath) ) { Http::header('HTTP/1.1 400 Bad Request'); $connection->close('<h1>400 Bad Request</h1>'); return; } $workerman_file = realpath($workerman_file); // Request php file. if ($workerman_file_extension === 'php') { $workerman_cwd = getcwd(); chdir($workerman_root_dir); ini_set('display_errors', 'off'); ob_start(); // Try to include php file. try { // $_SERVER. $_SERVER['REMOTE_ADDR'] = $connection->getRemoteIp(); $_SERVER['REMOTE_PORT'] = $connection->getRemotePort(); include $workerman_file; } catch (\Exception $e) { // Jump_exit? if ($e->getMessage() != 'jump_exit') { Worker::safeEcho($e); } } $content = ob_get_clean(); ini_set('display_errors', 'on'); if (strtolower($_SERVER['HTTP_CONNECTION']) === "keep-alive") { $connection->send($content); } else { $connection->close($content); } chdir($workerman_cwd); return; } // Send file to client. return self::sendFile($connection, $workerman_file); } else { // 404 Http::header("HTTP/1.1 404 Not Found"); if(isset($workerman_siteConfig['custom404']) && file_exists($workerman_siteConfig['custom404'])){ $html404 = file_get_contents($workerman_siteConfig['custom404']); }else{ $html404 = '<html><head><title>404 File not found</title></head><body><center><h3>404 Not Found</h3></center></body></html>'; } $connection->close($html404); return; } }
[ "public", "function", "onMessage", "(", "$", "connection", ")", "{", "// REQUEST_URI.", "$", "workerman_url_info", "=", "parse_url", "(", "'http://'", ".", "$", "_SERVER", "[", "'HTTP_HOST'", "]", ".", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", ";", "if...
Emit when http message coming. @param Connection\TcpConnection $connection @return void
[ "Emit", "when", "http", "message", "coming", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/WebServer.php#L151-L239
train
onMessage Callback function
[ 30522, 2270, 3853, 2006, 7834, 3736, 3351, 1006, 1002, 4434, 1007, 1063, 1013, 1013, 5227, 1035, 24471, 2072, 1012, 1002, 7309, 2386, 1035, 24471, 2140, 1035, 18558, 1027, 11968, 3366, 1035, 24471, 2140, 1006, 1005, 8299, 1024, 1013, 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...
getgrav/grav
system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
RequestHandlerTrait.handle
public function handle(ServerRequestInterface $request): ResponseInterface { $middleware = array_shift($this->middleware); // Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); }
php
public function handle(ServerRequestInterface $request): ResponseInterface { $middleware = array_shift($this->middleware); // Use default callable if there is no middleware. if ($middleware === null) { return \call_user_func($this->handler, $request); } if ($middleware instanceof MiddlewareInterface) { return $middleware->process($request, clone $this); } if (null === $this->container || !$this->container->has($middleware)) { throw new InvalidArgumentException( sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class), $middleware ); } array_unshift($this->middleware, $this->container->get($middleware)); return $this->handle($request); }
[ "public", "function", "handle", "(", "ServerRequestInterface", "$", "request", ")", ":", "ResponseInterface", "{", "$", "middleware", "=", "array_shift", "(", "$", "this", "->", "middleware", ")", ";", "// Use default callable if there is no middleware.", "if", "(", ...
{@inheritdoc} @throws InvalidArgumentException
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php#L35-L58
train
Handle the request and return the response.
[ 30522, 2270, 3853, 5047, 1006, 8241, 2890, 15500, 18447, 2121, 12172, 1002, 5227, 1007, 1024, 3433, 18447, 2121, 12172, 1063, 1002, 2690, 8059, 1027, 9140, 1035, 5670, 1006, 1002, 2023, 1011, 1028, 2690, 8059, 1007, 1025, 1013, 1013, 2224, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/File.php
Zend_Cache_Backend_File._fileGetContents
protected function _fileGetContents($file) { $result = false; if (!is_file($file)) { return false; } $f = @fopen($file, 'rb'); if ($f) { if ($this->_options['file_locking']) @flock($f, LOCK_SH); $result = stream_get_contents($f); if ($this->_options['file_locking']) @flock($f, LOCK_UN); @fclose($f); } return $result; }
php
protected function _fileGetContents($file) { $result = false; if (!is_file($file)) { return false; } $f = @fopen($file, 'rb'); if ($f) { if ($this->_options['file_locking']) @flock($f, LOCK_SH); $result = stream_get_contents($f); if ($this->_options['file_locking']) @flock($f, LOCK_UN); @fclose($f); } return $result; }
[ "protected", "function", "_fileGetContents", "(", "$", "file", ")", "{", "$", "result", "=", "false", ";", "if", "(", "!", "is_file", "(", "$", "file", ")", ")", "{", "return", "false", ";", "}", "$", "f", "=", "@", "fopen", "(", "$", "file", ","...
Return the file content of the given file @param string $file File complete path @return string File content (or false if problem)
[ "Return", "the", "file", "content", "of", "the", "given", "file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L954-L968
train
Get the contents of a file
[ 30522, 5123, 3853, 1035, 5371, 18150, 8663, 6528, 3215, 1006, 1002, 5371, 1007, 1063, 1002, 2765, 1027, 6270, 1025, 2065, 1006, 999, 2003, 1035, 5371, 1006, 1002, 5371, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 1002, 1042, 1027, 1030, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/DataCollector/ConfigDataCollector.php
ConfigDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { $this->data = [ 'app_name' => $this->name, 'app_version' => $this->version, 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, 'symfony_state' => 'unknown', 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'php_architecture' => PHP_INT_SIZE * 8, 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => \extension_loaded('xdebug'), 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), 'bundles' => [], 'sapi_name' => \PHP_SAPI, ]; if (isset($this->kernel)) { foreach ($this->kernel->getBundles() as $name => $bundle) { $this->data['bundles'][$name] = $this->hasVarDumper ? new LinkStub($bundle->getPath()) : $bundle->getPath(); } $this->data['symfony_state'] = $this->determineSymfonyState(); $this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION); $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE); $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE); $this->data['symfony_eom'] = $eom->format('F Y'); $this->data['symfony_eol'] = $eol->format('F Y'); } if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) { $this->data['php_version'] = $matches[1]; $this->data['php_version_extra'] = $matches[2]; } }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { $this->data = [ 'app_name' => $this->name, 'app_version' => $this->version, 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, 'symfony_state' => 'unknown', 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'php_architecture' => PHP_INT_SIZE * 8, 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => \extension_loaded('xdebug'), 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), 'bundles' => [], 'sapi_name' => \PHP_SAPI, ]; if (isset($this->kernel)) { foreach ($this->kernel->getBundles() as $name => $bundle) { $this->data['bundles'][$name] = $this->hasVarDumper ? new LinkStub($bundle->getPath()) : $bundle->getPath(); } $this->data['symfony_state'] = $this->determineSymfonyState(); $this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION); $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE); $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE); $this->data['symfony_eom'] = $eom->format('F Y'); $this->data['symfony_eol'] = $eol->format('F Y'); } if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) { $this->data['php_version'] = $matches[1]; $this->data['php_version_extra'] = $matches[2]; } }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "this", "->", "data", "=", "[", "'app_name'", "=>", "$", "this", "->", "name", ",",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php#L58-L96
train
Collects information about the application
[ 30522, 2270, 3853, 8145, 1006, 5227, 1002, 5227, 1010, 3433, 1002, 3433, 1010, 1032, 6453, 1002, 6453, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2951, 1027, 1031, 1005, 10439, 1035, 2171, 1005, 1027, 1028, 1002, 2023, 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...
symfony/symfony
src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php
SessionAuthenticationStrategy.onAuthentication
public function onAuthentication(Request $request, TokenInterface $token) { switch ($this->strategy) { case self::NONE: return; case self::MIGRATE: // Note: this logic is duplicated in several authentication listeners // until Symfony 5.0 due to a security fix with BC compat $request->getSession()->migrate(true); return; case self::INVALIDATE: $request->getSession()->invalidate(); return; default: throw new \RuntimeException(sprintf('Invalid session authentication strategy "%s"', $this->strategy)); } }
php
public function onAuthentication(Request $request, TokenInterface $token) { switch ($this->strategy) { case self::NONE: return; case self::MIGRATE: // Note: this logic is duplicated in several authentication listeners // until Symfony 5.0 due to a security fix with BC compat $request->getSession()->migrate(true); return; case self::INVALIDATE: $request->getSession()->invalidate(); return; default: throw new \RuntimeException(sprintf('Invalid session authentication strategy "%s"', $this->strategy)); } }
[ "public", "function", "onAuthentication", "(", "Request", "$", "request", ",", "TokenInterface", "$", "token", ")", "{", "switch", "(", "$", "this", "->", "strategy", ")", "{", "case", "self", "::", "NONE", ":", "return", ";", "case", "self", "::", "MIGR...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php#L43-L64
train
Called when the session authentication is done.
[ 30522, 2270, 3853, 2006, 4887, 10760, 16778, 10719, 1006, 5227, 1002, 5227, 1010, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 6942, 1006, 1002, 2023, 1011, 1028, 5656, 1007, 1063, 2553, 2969, 1024, 1024, 3904, 1024, 2709, 1025, 2553...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.createSelectWithConstraint
protected function createSelectWithConstraint($name) { return [explode(':', $name)[0], function ($query) use ($name) { $query->select(explode(',', explode(':', $name)[1])); }]; }
php
protected function createSelectWithConstraint($name) { return [explode(':', $name)[0], function ($query) use ($name) { $query->select(explode(',', explode(':', $name)[1])); }]; }
[ "protected", "function", "createSelectWithConstraint", "(", "$", "name", ")", "{", "return", "[", "explode", "(", "':'", ",", "$", "name", ")", "[", "0", "]", ",", "function", "(", "$", "query", ")", "use", "(", "$", "name", ")", "{", "$", "query", ...
Create a constraint to select the given columns for the relation. @param string $name @return array
[ "Create", "a", "constraint", "to", "select", "the", "given", "columns", "for", "the", "relation", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L1159-L1164
train
Create select with constraint
[ 30522, 5123, 3853, 9005, 12260, 6593, 24415, 8663, 20528, 18447, 1006, 1002, 2171, 1007, 1063, 2709, 1031, 15044, 1006, 1005, 1024, 1005, 1010, 1002, 2171, 1007, 1031, 1014, 1033, 1010, 3853, 1006, 1002, 23032, 1007, 2224, 1006, 1002, 2171,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Data/Validation.php
Validation.typeCheckboxes
public static function typeCheckboxes($value, array $params, array $field) { // Set multiple: true so checkboxes can easily use min/max counts to control number of options required $field['multiple'] = true; return self::typeArray((array) $value, $params, $field); }
php
public static function typeCheckboxes($value, array $params, array $field) { // Set multiple: true so checkboxes can easily use min/max counts to control number of options required $field['multiple'] = true; return self::typeArray((array) $value, $params, $field); }
[ "public", "static", "function", "typeCheckboxes", "(", "$", "value", ",", "array", "$", "params", ",", "array", "$", "field", ")", "{", "// Set multiple: true so checkboxes can easily use min/max counts to control number of options required", "$", "field", "[", "'multiple'"...
Custom input: checkbox list @param mixed $value Value to be validated. @param array $params Validation parameters. @param array $field Blueprint for the field. @return bool True if validation succeeded.
[ "Custom", "input", ":", "checkbox", "list" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L240-L246
train
Type checkboxes
[ 30522, 2270, 10763, 3853, 2828, 5403, 3600, 8758, 2229, 1006, 1002, 3643, 1010, 9140, 1002, 11498, 5244, 1010, 9140, 1002, 2492, 1007, 1063, 1013, 1013, 2275, 3674, 1024, 2995, 2061, 4638, 8758, 2229, 2064, 4089, 2224, 8117, 1013, 4098, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Kernel.php
Kernel.boot
public function boot() { if (true === $this->booted) { if (!$this->requestStackSize && $this->resetServices) { if ($this->container->has('services_resetter')) { $this->container->get('services_resetter')->reset(); } $this->resetServices = false; if ($this->debug) { $this->startTime = microtime(true); } } return; } if ($this->debug) { $this->startTime = microtime(true); } if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) { putenv('SHELL_VERBOSITY=3'); $_ENV['SHELL_VERBOSITY'] = 3; $_SERVER['SHELL_VERBOSITY'] = 3; } // init bundles $this->initializeBundles(); // init container $this->initializeContainer(); foreach ($this->getBundles() as $bundle) { $bundle->setContainer($this->container); $bundle->boot(); } $this->booted = true; }
php
public function boot() { if (true === $this->booted) { if (!$this->requestStackSize && $this->resetServices) { if ($this->container->has('services_resetter')) { $this->container->get('services_resetter')->reset(); } $this->resetServices = false; if ($this->debug) { $this->startTime = microtime(true); } } return; } if ($this->debug) { $this->startTime = microtime(true); } if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) { putenv('SHELL_VERBOSITY=3'); $_ENV['SHELL_VERBOSITY'] = 3; $_SERVER['SHELL_VERBOSITY'] = 3; } // init bundles $this->initializeBundles(); // init container $this->initializeContainer(); foreach ($this->getBundles() as $bundle) { $bundle->setContainer($this->container); $bundle->boot(); } $this->booted = true; }
[ "public", "function", "boot", "(", ")", "{", "if", "(", "true", "===", "$", "this", "->", "booted", ")", "{", "if", "(", "!", "$", "this", "->", "requestStackSize", "&&", "$", "this", "->", "resetServices", ")", "{", "if", "(", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L105-L141
train
Boots the application
[ 30522, 2270, 3853, 9573, 1006, 1007, 1063, 2065, 1006, 2995, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 9573, 2098, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 11186, 2696, 10603, 4697, 1004, 1004, 1002, 2023, 1011, 1028, 25141, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Column.php
Column.totalRow
public function totalRow($display = null) { $this->grid->addTotalRow($this->name, $display); return $this; }
php
public function totalRow($display = null) { $this->grid->addTotalRow($this->name, $display); return $this; }
[ "public", "function", "totalRow", "(", "$", "display", "=", "null", ")", "{", "$", "this", "->", "grid", "->", "addTotalRow", "(", "$", "this", "->", "name", ",", "$", "display", ")", ";", "return", "$", "this", ";", "}" ]
Add column to total-row. @param null $display @return $this
[ "Add", "column", "to", "total", "-", "row", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L401-L406
train
Add total row
[ 30522, 2270, 3853, 2561, 10524, 1006, 1002, 4653, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 8370, 1011, 1028, 5587, 3406, 9080, 10524, 1006, 1002, 2023, 1011, 1028, 2171, 1010, 1002, 4653, 1007, 1025, 2709, 1002, 2023, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php
AbstractLoader.newConstraint
protected function newConstraint($name, $options = null) { if (false !== strpos($name, '\\') && class_exists($name)) { $className = (string) $name; } elseif (false !== strpos($name, ':')) { list($prefix, $className) = explode(':', $name, 2); if (!isset($this->namespaces[$prefix])) { throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix)); } $className = $this->namespaces[$prefix].$className; } else { $className = self::DEFAULT_NAMESPACE.$name; } return new $className($options); }
php
protected function newConstraint($name, $options = null) { if (false !== strpos($name, '\\') && class_exists($name)) { $className = (string) $name; } elseif (false !== strpos($name, ':')) { list($prefix, $className) = explode(':', $name, 2); if (!isset($this->namespaces[$prefix])) { throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix)); } $className = $this->namespaces[$prefix].$className; } else { $className = self::DEFAULT_NAMESPACE.$name; } return new $className($options); }
[ "protected", "function", "newConstraint", "(", "$", "name", ",", "$", "options", "=", "null", ")", "{", "if", "(", "false", "!==", "strpos", "(", "$", "name", ",", "'\\\\'", ")", "&&", "class_exists", "(", "$", "name", ")", ")", "{", "$", "className"...
Creates a new constraint instance for the given constraint name. @param string $name The constraint name. Either a constraint relative to the default constraint namespace, or a fully qualified class name. Alternatively, the constraint may be preceded by a namespace alias and a colon. The namespace alias must have been defined using {@link addNamespaceAlias()}. @param mixed $options The constraint options @return Constraint @throws MappingException If the namespace prefix is undefined
[ "Creates", "a", "new", "constraint", "instance", "for", "the", "given", "constraint", "name", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php#L70-L87
train
Create a new Constraint
[ 30522, 5123, 3853, 2047, 8663, 20528, 18447, 1006, 1002, 2171, 1010, 1002, 7047, 1027, 19701, 1007, 1063, 2065, 1006, 6270, 999, 1027, 1027, 2358, 14536, 2891, 1006, 1002, 2171, 1010, 1005, 1032, 1032, 1005, 1007, 1004, 1004, 2465, 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
libs/HTML/QuickForm2/Renderer/Default.php
HTML_QuickForm2_Renderer_Default.markRequired
public function markRequired($elTpl, $required) { if ($required) { $this->hasRequired = true; $elTpl = str_replace(array('<qf:required>', '</qf:required>'), array('', ''), $elTpl); } else { $elTpl = preg_replace('!<qf:required>.*</qf:required>!isU', '', $elTpl); } return $elTpl; }
php
public function markRequired($elTpl, $required) { if ($required) { $this->hasRequired = true; $elTpl = str_replace(array('<qf:required>', '</qf:required>'), array('', ''), $elTpl); } else { $elTpl = preg_replace('!<qf:required>.*</qf:required>!isU', '', $elTpl); } return $elTpl; }
[ "public", "function", "markRequired", "(", "$", "elTpl", ",", "$", "required", ")", "{", "if", "(", "$", "required", ")", "{", "$", "this", "->", "hasRequired", "=", "true", ";", "$", "elTpl", "=", "str_replace", "(", "array", "(", "'<qf:required>'", "...
Marks element required or removes "required" block @param string Element template @param bool Whether element is required @return string Template with processed "required" block
[ "Marks", "element", "required", "or", "removes", "required", "block" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Default.php#L534-L544
train
Mark required elements in the elelector template
[ 30522, 2270, 3853, 2928, 2890, 15549, 5596, 1006, 1002, 3449, 25856, 2140, 1010, 1002, 3223, 1007, 1063, 2065, 1006, 1002, 3223, 1007, 1063, 1002, 2023, 1011, 1028, 2038, 2890, 15549, 5596, 1027, 2995, 1025, 1002, 3449, 25856, 2140, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/ContainerBuilder.php
ContainerBuilder.setAlias
public function setAlias($alias, $id) { $alias = (string) $alias; if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) { throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias)); } if (\is_string($id)) { $id = new Alias($id); } elseif (!$id instanceof Alias) { throw new InvalidArgumentException('$id must be a string, or an Alias object.'); } if ($alias === (string) $id) { throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); } unset($this->definitions[$alias], $this->removedIds[$alias]); return $this->aliasDefinitions[$alias] = $id; }
php
public function setAlias($alias, $id) { $alias = (string) $alias; if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) { throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias)); } if (\is_string($id)) { $id = new Alias($id); } elseif (!$id instanceof Alias) { throw new InvalidArgumentException('$id must be a string, or an Alias object.'); } if ($alias === (string) $id) { throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); } unset($this->definitions[$alias], $this->removedIds[$alias]); return $this->aliasDefinitions[$alias] = $id; }
[ "public", "function", "setAlias", "(", "$", "alias", ",", "$", "id", ")", "{", "$", "alias", "=", "(", "string", ")", "$", "alias", ";", "if", "(", "''", "===", "$", "alias", "||", "'\\\\'", "===", "$", "alias", "[", "-", "1", "]", "||", "\\", ...
Sets an alias for an existing service. @param string $alias The alias to create @param string|Alias $id The service to alias @return Alias @throws InvalidArgumentException if the id is not a string or an Alias @throws InvalidArgumentException if the alias is for itself
[ "Sets", "an", "alias", "for", "an", "existing", "service", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L833-L854
train
Sets an alias
[ 30522, 2270, 3853, 2275, 22786, 2015, 1006, 1002, 14593, 1010, 1002, 8909, 1007, 1063, 1002, 14593, 1027, 1006, 5164, 1007, 1002, 14593, 1025, 2065, 1006, 1005, 1005, 1027, 1027, 1027, 1002, 14593, 1064, 1064, 1005, 1032, 1032, 1005, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/models/Parameter.php
Parameter.set
public static function set($key, $value = null) { if (is_array($key)) { foreach ($key as $_key => $_value) { static::set($_key, $_value); } return true; } $record = static::findRecord($key); if (!$record) { $record = new static; list($namespace, $group, $item) = $record->parseKey($key); $record->namespace = $namespace; $record->group = $group; $record->item = $item; } $record->value = $value; $record->save(); static::$cache[$key] = $value; return true; }
php
public static function set($key, $value = null) { if (is_array($key)) { foreach ($key as $_key => $_value) { static::set($_key, $_value); } return true; } $record = static::findRecord($key); if (!$record) { $record = new static; list($namespace, $group, $item) = $record->parseKey($key); $record->namespace = $namespace; $record->group = $group; $record->item = $item; } $record->value = $value; $record->save(); static::$cache[$key] = $value; return true; }
[ "public", "static", "function", "set", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "_key", "=>", "$", "_value", ")", "{", "static", "::...
Stores a setting value to the database. @param string $key Specifies the setting key value, for example 'system:updates.check' @param mixed $value The setting value to store, serializable. @return bool
[ "Stores", "a", "setting", "value", "to", "the", "database", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/Parameter.php#L65-L88
train
Set a value in the cache
[ 30522, 2270, 10763, 3853, 2275, 1006, 1002, 3145, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 3145, 1007, 1007, 1063, 18921, 6776, 1006, 1002, 3145, 2004, 1002, 1035, 3145, 1027, 1028, 1002, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
BinaryFileResponse.setFile
public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { if (!$file instanceof File) { if ($file instanceof \SplFileInfo) { $file = new File($file->getPathname()); } else { $file = new File((string) $file); } } if (!$file->isReadable()) { throw new FileException('File must be readable.'); } $this->file = $file; if ($autoEtag) { $this->setAutoEtag(); } if ($autoLastModified) { $this->setAutoLastModified(); } if ($contentDisposition) { $this->setContentDisposition($contentDisposition); } return $this; }
php
public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { if (!$file instanceof File) { if ($file instanceof \SplFileInfo) { $file = new File($file->getPathname()); } else { $file = new File((string) $file); } } if (!$file->isReadable()) { throw new FileException('File must be readable.'); } $this->file = $file; if ($autoEtag) { $this->setAutoEtag(); } if ($autoLastModified) { $this->setAutoLastModified(); } if ($contentDisposition) { $this->setContentDisposition($contentDisposition); } return $this; }
[ "public", "function", "setFile", "(", "$", "file", ",", "$", "contentDisposition", "=", "null", ",", "$", "autoEtag", "=", "false", ",", "$", "autoLastModified", "=", "true", ")", "{", "if", "(", "!", "$", "file", "instanceof", "File", ")", "{", "if", ...
Sets the file to stream. @param \SplFileInfo|string $file The file to stream @param string $contentDisposition @param bool $autoEtag @param bool $autoLastModified @return $this @throws FileException
[ "Sets", "the", "file", "to", "stream", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php#L86-L115
train
Set the file to use
[ 30522, 2270, 3853, 2275, 8873, 2571, 1006, 1002, 5371, 1010, 1002, 4180, 10521, 26994, 1027, 19701, 1010, 1002, 8285, 12928, 2290, 1027, 6270, 1010, 1002, 8285, 8523, 21246, 7716, 7810, 1027, 2995, 1007, 1063, 2065, 1006, 999, 1002, 5371, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php
DateIntervalToArrayTransformer.reverseTransform
public function reverseTransform($value) { if (null === $value) { return; } if (!\is_array($value)) { throw new UnexpectedTypeException($value, 'array'); } if ('' === implode('', $value)) { return; } $emptyFields = []; foreach ($this->fields as $field) { if (!isset($value[$field])) { $emptyFields[] = $field; } } if (\count($emptyFields) > 0) { throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); } if (isset($value['invert']) && !\is_bool($value['invert'])) { throw new TransformationFailedException('The value of "invert" must be boolean'); } foreach (self::$availableFields as $field => $char) { if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) { throw new TransformationFailedException(sprintf('This amount of "%s" is invalid', $field)); } } try { if (!empty($value['weeks'])) { $interval = sprintf( 'P%sY%sM%sWT%sH%sM%sS', empty($value['years']) ? '0' : $value['years'], empty($value['months']) ? '0' : $value['months'], empty($value['weeks']) ? '0' : $value['weeks'], empty($value['hours']) ? '0' : $value['hours'], empty($value['minutes']) ? '0' : $value['minutes'], empty($value['seconds']) ? '0' : $value['seconds'] ); } else { $interval = sprintf( 'P%sY%sM%sDT%sH%sM%sS', empty($value['years']) ? '0' : $value['years'], empty($value['months']) ? '0' : $value['months'], empty($value['days']) ? '0' : $value['days'], empty($value['hours']) ? '0' : $value['hours'], empty($value['minutes']) ? '0' : $value['minutes'], empty($value['seconds']) ? '0' : $value['seconds'] ); } $dateInterval = new \DateInterval($interval); if (isset($value['invert'])) { $dateInterval->invert = $value['invert'] ? 1 : 0; } } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } return $dateInterval; }
php
public function reverseTransform($value) { if (null === $value) { return; } if (!\is_array($value)) { throw new UnexpectedTypeException($value, 'array'); } if ('' === implode('', $value)) { return; } $emptyFields = []; foreach ($this->fields as $field) { if (!isset($value[$field])) { $emptyFields[] = $field; } } if (\count($emptyFields) > 0) { throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); } if (isset($value['invert']) && !\is_bool($value['invert'])) { throw new TransformationFailedException('The value of "invert" must be boolean'); } foreach (self::$availableFields as $field => $char) { if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) { throw new TransformationFailedException(sprintf('This amount of "%s" is invalid', $field)); } } try { if (!empty($value['weeks'])) { $interval = sprintf( 'P%sY%sM%sWT%sH%sM%sS', empty($value['years']) ? '0' : $value['years'], empty($value['months']) ? '0' : $value['months'], empty($value['weeks']) ? '0' : $value['weeks'], empty($value['hours']) ? '0' : $value['hours'], empty($value['minutes']) ? '0' : $value['minutes'], empty($value['seconds']) ? '0' : $value['seconds'] ); } else { $interval = sprintf( 'P%sY%sM%sDT%sH%sM%sS', empty($value['years']) ? '0' : $value['years'], empty($value['months']) ? '0' : $value['months'], empty($value['days']) ? '0' : $value['days'], empty($value['hours']) ? '0' : $value['hours'], empty($value['minutes']) ? '0' : $value['minutes'], empty($value['seconds']) ? '0' : $value['seconds'] ); } $dateInterval = new \DateInterval($interval); if (isset($value['invert'])) { $dateInterval->invert = $value['invert'] ? 1 : 0; } } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } return $dateInterval; }
[ "public", "function", "reverseTransform", "(", "$", "value", ")", "{", "if", "(", "null", "===", "$", "value", ")", "{", "return", ";", "}", "if", "(", "!", "\\", "is_array", "(", "$", "value", ")", ")", "{", "throw", "new", "UnexpectedTypeException", ...
Transforms an interval array into a normalized date interval. @param array $value Interval array @return \DateInterval Normalized date interval @throws UnexpectedTypeException if the given value is not an array @throws TransformationFailedException if the value could not be transformed
[ "Transforms", "an", "interval", "array", "into", "a", "normalized", "date", "interval", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php#L114-L173
train
Transforms an array into a QtiComponent object
[ 30522, 2270, 3853, 7901, 6494, 3619, 14192, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3643, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1007, 1063, 5466, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/MultiSites/Dashboard.php
Dashboard.makeSitesFlatAndApplyGenericFilters
private function makeSitesFlatAndApplyGenericFilters(DataTable $table, $request) { // we handle limit here as we have to apply sort filter, then make sites flat, then apply limit filter. $filterOffset = $request['filter_offset']; $filterLimit = $request['filter_limit']; unset($request['filter_offset']); unset($request['filter_limit']); // filter_sort_column does not work correctly is a bug in MultiSites.getAll if (!empty($request['filter_sort_column']) && $request['filter_sort_column'] === 'nb_pageviews') { $request['filter_sort_column'] = 'Actions_nb_pageviews'; } elseif (!empty($request['filter_sort_column']) && $request['filter_sort_column'] === 'revenue') { $request['filter_sort_column'] = 'Goal_revenue'; } // make sure no limit filter is applied, we will do this manually $table->disableFilter('Limit'); // this will apply the sort filter /** @var DataTable $table */ $genericFilter = new DataTablePostProcessor('MultiSites', 'getAll', $request); $table = $genericFilter->applyGenericFilters($table); // make sure from now on the sites will be no longer sorted, they were already sorted $table->disableFilter('Sort'); // make sites flat and limit $table->filter('Piwik\Plugins\MultiSites\DataTable\Filter\NestedSitesLimiter', array($filterOffset, $filterLimit)); }
php
private function makeSitesFlatAndApplyGenericFilters(DataTable $table, $request) { // we handle limit here as we have to apply sort filter, then make sites flat, then apply limit filter. $filterOffset = $request['filter_offset']; $filterLimit = $request['filter_limit']; unset($request['filter_offset']); unset($request['filter_limit']); // filter_sort_column does not work correctly is a bug in MultiSites.getAll if (!empty($request['filter_sort_column']) && $request['filter_sort_column'] === 'nb_pageviews') { $request['filter_sort_column'] = 'Actions_nb_pageviews'; } elseif (!empty($request['filter_sort_column']) && $request['filter_sort_column'] === 'revenue') { $request['filter_sort_column'] = 'Goal_revenue'; } // make sure no limit filter is applied, we will do this manually $table->disableFilter('Limit'); // this will apply the sort filter /** @var DataTable $table */ $genericFilter = new DataTablePostProcessor('MultiSites', 'getAll', $request); $table = $genericFilter->applyGenericFilters($table); // make sure from now on the sites will be no longer sorted, they were already sorted $table->disableFilter('Sort'); // make sites flat and limit $table->filter('Piwik\Plugins\MultiSites\DataTable\Filter\NestedSitesLimiter', array($filterOffset, $filterLimit)); }
[ "private", "function", "makeSitesFlatAndApplyGenericFilters", "(", "DataTable", "$", "table", ",", "$", "request", ")", "{", "// we handle limit here as we have to apply sort filter, then make sites flat, then apply limit filter.", "$", "filterOffset", "=", "$", "request", "[", ...
Makes sure to not have any subtables anymore. So if $table is array( site1 site2 subtable => site3 site4 site5 site6 site7 ) it will return array( site1 site2 site3 site4 site5 site6 site7 ) in a sorted order @param DataTable $table @param array $request
[ "Makes", "sure", "to", "not", "have", "any", "subtables", "anymore", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MultiSites/Dashboard.php#L308-L336
train
This method is used to make all the sites flat and limit the result set.
[ 30522, 2797, 3853, 3084, 7616, 10258, 6790, 8943, 9397, 2135, 6914, 22420, 8873, 21928, 2015, 1006, 2951, 10880, 1002, 2795, 1010, 1002, 5227, 1007, 1063, 1013, 1013, 2057, 5047, 5787, 2182, 2004, 2057, 2031, 2000, 6611, 4066, 11307, 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
core/Updates/2.10.0-b5.php
Updates_2_10_0_b5.updateBrowserArchives
public static function updateBrowserArchives($table) { // rename old UserSettings archives where no DeviceDetection archives exists Db::exec(sprintf("UPDATE IGNORE %s SET name='DevicesDetection_browserVersions' WHERE name = 'UserSettings_browser'", $table)); /* * check dates of remaining (non-day) archives with calculated safe date * archives before or within that week/month/year of that date will be replaced */ $oldBrowserBlobs = Db::get()->fetchAll(sprintf("SELECT * FROM %s WHERE name = 'UserSettings_browser' AND `period` > 1", $table)); foreach ($oldBrowserBlobs as $blob) { // if start date of blob is before calculated date us old usersettings archive instead of already existing DevicesDetection archive if (strtotime($blob['date1']) < self::getFirstDayOfArchivedDeviceDetectorData()) { Db::get()->query(sprintf("DELETE FROM %s WHERE idarchive = ? AND name = ?", $table), array($blob['idarchive'], 'DevicesDetection_browserVersions')); Db::get()->query(sprintf("UPDATE %s SET name = ? WHERE idarchive = ? AND name = ?", $table), array('DevicesDetection_browserVersions', $blob['idarchive'], 'UserSettings_browser')); } } }
php
public static function updateBrowserArchives($table) { // rename old UserSettings archives where no DeviceDetection archives exists Db::exec(sprintf("UPDATE IGNORE %s SET name='DevicesDetection_browserVersions' WHERE name = 'UserSettings_browser'", $table)); /* * check dates of remaining (non-day) archives with calculated safe date * archives before or within that week/month/year of that date will be replaced */ $oldBrowserBlobs = Db::get()->fetchAll(sprintf("SELECT * FROM %s WHERE name = 'UserSettings_browser' AND `period` > 1", $table)); foreach ($oldBrowserBlobs as $blob) { // if start date of blob is before calculated date us old usersettings archive instead of already existing DevicesDetection archive if (strtotime($blob['date1']) < self::getFirstDayOfArchivedDeviceDetectorData()) { Db::get()->query(sprintf("DELETE FROM %s WHERE idarchive = ? AND name = ?", $table), array($blob['idarchive'], 'DevicesDetection_browserVersions')); Db::get()->query(sprintf("UPDATE %s SET name = ? WHERE idarchive = ? AND name = ?", $table), array('DevicesDetection_browserVersions', $blob['idarchive'], 'UserSettings_browser')); } } }
[ "public", "static", "function", "updateBrowserArchives", "(", "$", "table", ")", "{", "// rename old UserSettings archives where no DeviceDetection archives exists", "Db", "::", "exec", "(", "sprintf", "(", "\"UPDATE IGNORE %s SET name='DevicesDetection_browserVersions' WHERE name = ...
Updates all browser archives to new structure @param string $table @throws \Exception
[ "Updates", "all", "browser", "archives", "to", "new", "structure" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updates/2.10.0-b5.php#L185-L203
train
Update browser archives
[ 30522, 2270, 10763, 3853, 10651, 12618, 9333, 6906, 11140, 24653, 1006, 1002, 2795, 1007, 1063, 1013, 1013, 14916, 14074, 2214, 5198, 18319, 3070, 2015, 8264, 2073, 2053, 5080, 3207, 26557, 3508, 8264, 6526, 16962, 1024, 1024, 4654, 8586, 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...
z-song/laravel-admin
src/Auth/Database/Role.php
Role.administrators
public function administrators() : BelongsToMany { $pivotTable = config('admin.database.role_users_table'); $relatedModel = config('admin.database.users_model'); return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'user_id'); }
php
public function administrators() : BelongsToMany { $pivotTable = config('admin.database.role_users_table'); $relatedModel = config('admin.database.users_model'); return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'user_id'); }
[ "public", "function", "administrators", "(", ")", ":", "BelongsToMany", "{", "$", "pivotTable", "=", "config", "(", "'admin.database.role_users_table'", ")", ";", "$", "relatedModel", "=", "config", "(", "'admin.database.users_model'", ")", ";", "return", "$", "th...
A role belongs to many users. @return BelongsToMany
[ "A", "role", "belongs", "to", "many", "users", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Database/Role.php#L33-L40
train
Returns the administrators
[ 30522, 2270, 3853, 15631, 1006, 1007, 1024, 7460, 20389, 19092, 1063, 1002, 14255, 22994, 10880, 1027, 9530, 8873, 2290, 1006, 1005, 4748, 10020, 1012, 7809, 1012, 2535, 1035, 5198, 1035, 2795, 1005, 1007, 1025, 1002, 3141, 5302, 9247, 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...
z-song/laravel-admin
src/Show/Field.php
Field.getFileIcon
public function getFileIcon($file = '') { $extension = File::extension($file); foreach ($this->fileTypes as $type => $regex) { if (preg_match("/^($regex)$/i", $extension) !== 0) { return "fa-file-{$type}-o"; } } return 'fa-file-o'; }
php
public function getFileIcon($file = '') { $extension = File::extension($file); foreach ($this->fileTypes as $type => $regex) { if (preg_match("/^($regex)$/i", $extension) !== 0) { return "fa-file-{$type}-o"; } } return 'fa-file-o'; }
[ "public", "function", "getFileIcon", "(", "$", "file", "=", "''", ")", "{", "$", "extension", "=", "File", "::", "extension", "(", "$", "file", ")", ";", "foreach", "(", "$", "this", "->", "fileTypes", "as", "$", "type", "=>", "$", "regex", ")", "{...
Get file icon. @param string $file @return string
[ "Get", "file", "icon", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Field.php#L378-L389
train
Get File Icon
[ 30522, 2270, 3853, 2131, 8873, 23057, 8663, 1006, 1002, 5371, 1027, 1005, 1005, 1007, 1063, 1002, 5331, 1027, 5371, 1024, 1024, 5331, 1006, 1002, 5371, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 5371, 13874, 2015, 2004, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Console/MinifyCommand.php
MinifyCommand.handle
public function handle() { if (!class_exists(Minify\Js::class)) { $this->error('To use `admin:minify` command, please install [matthiasmullie/minify] first.'); } if ($this->option('clear')) { return $this->clearMinifiedFiles(); } AdminFacade::bootstrap(); $this->minifyCSS(); $this->minifyJS(); $this->generateManifest(); $this->comment('JS and CSS are successfully minified:'); $this->line(' '.Admin::$min['js']); $this->line(' '.Admin::$min['css']); $this->line(''); $this->comment('Manifest successfully generated:'); $this->line(' '.Admin::$manifest); }
php
public function handle() { if (!class_exists(Minify\Js::class)) { $this->error('To use `admin:minify` command, please install [matthiasmullie/minify] first.'); } if ($this->option('clear')) { return $this->clearMinifiedFiles(); } AdminFacade::bootstrap(); $this->minifyCSS(); $this->minifyJS(); $this->generateManifest(); $this->comment('JS and CSS are successfully minified:'); $this->line(' '.Admin::$min['js']); $this->line(' '.Admin::$min['css']); $this->line(''); $this->comment('Manifest successfully generated:'); $this->line(' '.Admin::$manifest); }
[ "public", "function", "handle", "(", ")", "{", "if", "(", "!", "class_exists", "(", "Minify", "\\", "Js", "::", "class", ")", ")", "{", "$", "this", "->", "error", "(", "'To use `admin:minify` command, please install [matthiasmullie/minify] first.'", ")", ";", "...
Execute the console command.
[ "Execute", "the", "console", "command", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/MinifyCommand.php#L38-L63
train
Minify JS and CSS files
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 2065, 1006, 999, 2465, 1035, 6526, 1006, 7163, 12031, 1032, 1046, 2015, 1024, 1024, 2465, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 7561, 1006, 1005, 2000, 2224, 1036, 4748, 10020, 1024, 7163, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php
AttributeBag.get
public function get($name, $default = null) { return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; }
php
public function get($name, $default = null) { return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; }
[ "public", "function", "get", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "return", "\\", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "attributes", ")", "?", "$", "this", "->", "attributes", "[", "$", "name", "]", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php#L72-L75
train
Get an attribute from the attributes array
[ 30522, 2270, 3853, 2131, 1006, 1002, 2171, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 2709, 1032, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 2171, 1010, 1002, 2023, 1011, 1028, 12332, 1007, 1029, 1002, 2023, 1011, 1028, 12332, 1031, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Field.php
Field.attribute
public function attribute($attribute, $value = null) { if (is_array($attribute)) { $this->attributes = array_merge($this->attributes, $attribute); } else { $this->attributes[$attribute] = (string) $value; } return $this; }
php
public function attribute($attribute, $value = null) { if (is_array($attribute)) { $this->attributes = array_merge($this->attributes, $attribute); } else { $this->attributes[$attribute] = (string) $value; } return $this; }
[ "public", "function", "attribute", "(", "$", "attribute", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "attribute", ")", ")", "{", "$", "this", "->", "attributes", "=", "array_merge", "(", "$", "this", "->", "attributes", ...
Add html attributes to elements. @param array|string $attribute @param mixed $value @return $this
[ "Add", "html", "attributes", "to", "elements", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field.php#L765-L774
train
Add an attribute to the list of attributes
[ 30522, 2270, 3853, 17961, 1006, 1002, 17961, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 17961, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 12332, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1011, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.removeExistingOrdersFor
protected function removeExistingOrdersFor($column) { return Collection::make($this->orders) ->reject(function ($order) use ($column) { return isset($order['column']) ? $order['column'] === $column : false; })->values()->all(); }
php
protected function removeExistingOrdersFor($column) { return Collection::make($this->orders) ->reject(function ($order) use ($column) { return isset($order['column']) ? $order['column'] === $column : false; })->values()->all(); }
[ "protected", "function", "removeExistingOrdersFor", "(", "$", "column", ")", "{", "return", "Collection", "::", "make", "(", "$", "this", "->", "orders", ")", "->", "reject", "(", "function", "(", "$", "order", ")", "use", "(", "$", "column", ")", "{", ...
Get an array with all orders with a given column removed. @param string $column @return array
[ "Get", "an", "array", "with", "all", "orders", "with", "a", "given", "column", "removed", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1991-L1998
train
Remove existing orders for a column
[ 30522, 5123, 3853, 6366, 10288, 2923, 2075, 8551, 2545, 29278, 1006, 1002, 5930, 1007, 1063, 2709, 3074, 1024, 1024, 2191, 1006, 1002, 2023, 1011, 1028, 4449, 1007, 1011, 1028, 15454, 1006, 3853, 1006, 1002, 2344, 1007, 2224, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php
BaseValidatorExtension.configureOptions
public function configureOptions(OptionsResolver $resolver) { // Make sure that validation groups end up as null, closure or array $validationGroupsNormalizer = function (Options $options, $groups) { if (false === $groups) { return []; } if (empty($groups)) { return; } if (\is_callable($groups)) { return $groups; } if ($groups instanceof GroupSequence) { return $groups; } return (array) $groups; }; $resolver->setDefaults([ 'validation_groups' => null, ]); $resolver->setNormalizer('validation_groups', $validationGroupsNormalizer); }
php
public function configureOptions(OptionsResolver $resolver) { // Make sure that validation groups end up as null, closure or array $validationGroupsNormalizer = function (Options $options, $groups) { if (false === $groups) { return []; } if (empty($groups)) { return; } if (\is_callable($groups)) { return $groups; } if ($groups instanceof GroupSequence) { return $groups; } return (array) $groups; }; $resolver->setDefaults([ 'validation_groups' => null, ]); $resolver->setNormalizer('validation_groups', $validationGroupsNormalizer); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "// Make sure that validation groups end up as null, closure or array", "$", "validationGroupsNormalizer", "=", "function", "(", "Options", "$", "options", ",", "$", "groups", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php#L30-L58
train
Configures the options for the validation groups
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 1002, 10663, 2099, 1007, 1063, 1013, 1013, 2191, 2469, 2008, 27354, 2967, 2203, 2039, 2004, 19701, 1010, 8503, 2030, 9140, 1002, 27354, 17058, 2015, 1213...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/PageUrl.php
PageUrl.getQueryParametersToExclude
public static function getQueryParametersToExclude($idSite) { $campaignTrackingParameters = Common::getCampaignParameters(); $campaignTrackingParameters = array_merge( $campaignTrackingParameters[0], // campaign name parameters $campaignTrackingParameters[1] // campaign keyword parameters ); $website = Cache::getCacheWebsiteAttributes($idSite); $excludedParameters = self::getExcludedParametersFromWebsite($website); $parametersToExclude = array_merge($excludedParameters, self::getUrlParameterNamesToExcludeFromUrl(), $campaignTrackingParameters); /** * Triggered before setting the action url in Piwik\Tracker\Action so plugins can register * parameters to be excluded from the tracking URL (e.g. campaign parameters). * * @param array &$parametersToExclude An array of parameters to exclude from the tracking url. */ Piwik::postEvent('Tracker.PageUrl.getQueryParametersToExclude', array(&$parametersToExclude)); if (!empty($parametersToExclude)) { Common::printDebug('Excluding parameters "' . implode(',', $parametersToExclude) . '" from URL'); } $parametersToExclude = array_map('strtolower', $parametersToExclude); return $parametersToExclude; }
php
public static function getQueryParametersToExclude($idSite) { $campaignTrackingParameters = Common::getCampaignParameters(); $campaignTrackingParameters = array_merge( $campaignTrackingParameters[0], // campaign name parameters $campaignTrackingParameters[1] // campaign keyword parameters ); $website = Cache::getCacheWebsiteAttributes($idSite); $excludedParameters = self::getExcludedParametersFromWebsite($website); $parametersToExclude = array_merge($excludedParameters, self::getUrlParameterNamesToExcludeFromUrl(), $campaignTrackingParameters); /** * Triggered before setting the action url in Piwik\Tracker\Action so plugins can register * parameters to be excluded from the tracking URL (e.g. campaign parameters). * * @param array &$parametersToExclude An array of parameters to exclude from the tracking url. */ Piwik::postEvent('Tracker.PageUrl.getQueryParametersToExclude', array(&$parametersToExclude)); if (!empty($parametersToExclude)) { Common::printDebug('Excluding parameters "' . implode(',', $parametersToExclude) . '" from URL'); } $parametersToExclude = array_map('strtolower', $parametersToExclude); return $parametersToExclude; }
[ "public", "static", "function", "getQueryParametersToExclude", "(", "$", "idSite", ")", "{", "$", "campaignTrackingParameters", "=", "Common", "::", "getCampaignParameters", "(", ")", ";", "$", "campaignTrackingParameters", "=", "array_merge", "(", "$", "campaignTrack...
Returns the array of parameters names that must be excluded from the Query String in all tracked URLs @static @param $idSite @return array
[ "Returns", "the", "array", "of", "parameters", "names", "that", "must", "be", "excluded", "from", "the", "Query", "String", "in", "all", "tracked", "URLs" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/PageUrl.php#L73-L103
train
Returns an array of parameters that should be excluded from the URL
[ 30522, 2270, 10763, 3853, 2131, 4226, 2854, 28689, 22828, 16033, 10288, 20464, 12672, 1006, 1002, 8909, 28032, 2063, 1007, 1063, 1002, 3049, 6494, 23177, 28689, 22828, 2015, 1027, 2691, 1024, 1024, 2131, 26468, 4886, 16206, 28689, 22828, 2015...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/SessionGuard.php
SessionGuard.clearUserDataFromStorage
protected function clearUserDataFromStorage() { $this->session->remove($this->getName()); if (! is_null($this->recaller())) { $this->getCookieJar()->queue($this->getCookieJar() ->forget($this->getRecallerName())); } }
php
protected function clearUserDataFromStorage() { $this->session->remove($this->getName()); if (! is_null($this->recaller())) { $this->getCookieJar()->queue($this->getCookieJar() ->forget($this->getRecallerName())); } }
[ "protected", "function", "clearUserDataFromStorage", "(", ")", "{", "$", "this", "->", "session", "->", "remove", "(", "$", "this", "->", "getName", "(", ")", ")", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "recaller", "(", ")", ")", ")"...
Remove the user data from the session and cookies. @return void
[ "Remove", "the", "user", "data", "from", "the", "session", "and", "cookies", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L511-L519
train
Clear user data from session and cookie jar
[ 30522, 5123, 3853, 3154, 20330, 2850, 2696, 19699, 22225, 4263, 4270, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 5219, 1011, 1028, 6366, 1006, 1002, 2023, 1011, 1028, 2131, 18442, 1006, 1007, 1007, 1025, 2065, 1006, 999, 2003, 1035, 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...
matomo-org/matomo
core/API/Request.php
Request.process
public function process() { // read the format requested for the output data $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $this->request)); $disablePostProcessing = $this->shouldDisablePostProcessing(); // create the response $response = new ResponseBuilder($outputFormat, $this->request); if ($disablePostProcessing) { $response->disableDataTablePostProcessor(); } $corsHandler = new CORSHandler(); $corsHandler->handle(); $tokenAuth = Common::getRequestVar('token_auth', '', 'string', $this->request); $shouldReloadAuth = false; try { ++self::$nestedApiInvocationCount; // IP check is needed here as we cannot listen to API.Request.authenticate as it would then not return proper API format response. // We can also not do it by listening to API.Request.dispatch as by then the user is already authenticated and we want to make sure // to not expose any information in case the IP is not whitelisted. $whitelist = new LoginWhitelist(); if ($whitelist->shouldCheckWhitelist() && $whitelist->shouldWhitelistApplyToAPI()) { $ip = IP::getIpFromHeader(); $whitelist->checkIsWhitelisted($ip); } // read parameters $moduleMethod = Common::getRequestVar('method', null, 'string', $this->request); list($module, $method) = $this->extractModuleAndMethod($moduleMethod); list($module, $method) = self::getRenamedModuleAndAction($module, $method); PluginManager::getInstance()->checkIsPluginActivated($module); $apiClassName = self::getClassNameAPI($module); if ($shouldReloadAuth = self::shouldReloadAuthUsingTokenAuth($this->request)) { $access = Access::getInstance(); $tokenAuthToRestore = $access->getTokenAuth(); $hadSuperUserAccess = $access->hasSuperUserAccess(); self::forceReloadAuthUsingTokenAuth($tokenAuth); } // call the method $returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request); // get the response with the request query parameters loaded, since DataTablePost processor will use the Report // class instance, which may inspect the query parameters. (eg, it may look for the idCustomReport parameters // which may only exist in $this->request, if the request was called programatically) $toReturn = Context::executeWithQueryParameters($this->request, function () use ($response, $returnedValue, $module, $method) { return $response->getResponse($returnedValue, $module, $method); }); } catch (Exception $e) { StaticContainer::get(LoggerInterface::class)->error('Uncaught exception in API: {exception}', [ 'exception' => $e, 'ignoreInScreenWriter' => true, ]); $toReturn = $response->getResponseException($e); } finally { --self::$nestedApiInvocationCount; } if ($shouldReloadAuth) { $this->restoreAuthUsingTokenAuth($tokenAuthToRestore, $hadSuperUserAccess); } return $toReturn; }
php
public function process() { // read the format requested for the output data $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $this->request)); $disablePostProcessing = $this->shouldDisablePostProcessing(); // create the response $response = new ResponseBuilder($outputFormat, $this->request); if ($disablePostProcessing) { $response->disableDataTablePostProcessor(); } $corsHandler = new CORSHandler(); $corsHandler->handle(); $tokenAuth = Common::getRequestVar('token_auth', '', 'string', $this->request); $shouldReloadAuth = false; try { ++self::$nestedApiInvocationCount; // IP check is needed here as we cannot listen to API.Request.authenticate as it would then not return proper API format response. // We can also not do it by listening to API.Request.dispatch as by then the user is already authenticated and we want to make sure // to not expose any information in case the IP is not whitelisted. $whitelist = new LoginWhitelist(); if ($whitelist->shouldCheckWhitelist() && $whitelist->shouldWhitelistApplyToAPI()) { $ip = IP::getIpFromHeader(); $whitelist->checkIsWhitelisted($ip); } // read parameters $moduleMethod = Common::getRequestVar('method', null, 'string', $this->request); list($module, $method) = $this->extractModuleAndMethod($moduleMethod); list($module, $method) = self::getRenamedModuleAndAction($module, $method); PluginManager::getInstance()->checkIsPluginActivated($module); $apiClassName = self::getClassNameAPI($module); if ($shouldReloadAuth = self::shouldReloadAuthUsingTokenAuth($this->request)) { $access = Access::getInstance(); $tokenAuthToRestore = $access->getTokenAuth(); $hadSuperUserAccess = $access->hasSuperUserAccess(); self::forceReloadAuthUsingTokenAuth($tokenAuth); } // call the method $returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request); // get the response with the request query parameters loaded, since DataTablePost processor will use the Report // class instance, which may inspect the query parameters. (eg, it may look for the idCustomReport parameters // which may only exist in $this->request, if the request was called programatically) $toReturn = Context::executeWithQueryParameters($this->request, function () use ($response, $returnedValue, $module, $method) { return $response->getResponse($returnedValue, $module, $method); }); } catch (Exception $e) { StaticContainer::get(LoggerInterface::class)->error('Uncaught exception in API: {exception}', [ 'exception' => $e, 'ignoreInScreenWriter' => true, ]); $toReturn = $response->getResponseException($e); } finally { --self::$nestedApiInvocationCount; } if ($shouldReloadAuth) { $this->restoreAuthUsingTokenAuth($tokenAuthToRestore, $hadSuperUserAccess); } return $toReturn; }
[ "public", "function", "process", "(", ")", "{", "// read the format requested for the output data", "$", "outputFormat", "=", "strtolower", "(", "Common", "::", "getRequestVar", "(", "'format'", ",", "'xml'", ",", "'string'", ",", "$", "this", "->", "request", ")"...
Dispatches the API request to the appropriate API method and returns the result after post-processing. Post-processing includes: - flattening if **flat** is 0 - running generic filters unless **disable_generic_filters** is set to 1 - URL decoding label column values - running queued filters unless **disable_queued_filters** is set to 1 - removing columns based on the values of the **hideColumns** and **showColumns** query parameters - filtering rows if the **label** query parameter is set - converting the result to the appropriate format (ie, XML, JSON, etc.) If `'original'` is supplied for the output format, the result is returned as a PHP object. @throws PluginDeactivatedException if the module plugin is not activated. @throws Exception if the requested API method cannot be called, if required parameters for the API method are missing or if the API method throws an exception and the **format** query parameter is **original**. @return DataTable|Map|string The data resulting from the API call.
[ "Dispatches", "the", "API", "request", "to", "the", "appropriate", "API", "method", "and", "returns", "the", "result", "after", "post", "-", "processing", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/Request.php#L216-L289
train
Process the request and return the response
[ 30522, 2270, 3853, 2832, 1006, 1007, 1063, 1013, 1013, 3191, 1996, 4289, 7303, 2005, 1996, 6434, 2951, 1002, 6434, 14192, 4017, 1027, 2358, 5339, 12898, 13777, 1006, 2691, 1024, 1024, 2131, 2890, 15500, 10755, 1006, 1005, 4289, 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/HTML/QuickForm2/Container.php
HTML_QuickForm2_Container.insertBefore
public function insertBefore(HTML_QuickForm2_Node $element, HTML_QuickForm2_Node $reference = null) { if (null === $reference) { return $this->appendChild($element); } $offset = 0; foreach ($this as $child) { if ($child === $reference) { if ($this === $element->getContainer()) { $this->removeChild($element); } $element->setContainer($this); array_splice($this->elements, $offset, 0, array($element)); return $element; } $offset++; } throw new HTML_QuickForm2_NotFoundException( "Reference element with name '".$reference->getName()."' was not found" ); }
php
public function insertBefore(HTML_QuickForm2_Node $element, HTML_QuickForm2_Node $reference = null) { if (null === $reference) { return $this->appendChild($element); } $offset = 0; foreach ($this as $child) { if ($child === $reference) { if ($this === $element->getContainer()) { $this->removeChild($element); } $element->setContainer($this); array_splice($this->elements, $offset, 0, array($element)); return $element; } $offset++; } throw new HTML_QuickForm2_NotFoundException( "Reference element with name '".$reference->getName()."' was not found" ); }
[ "public", "function", "insertBefore", "(", "HTML_QuickForm2_Node", "$", "element", ",", "HTML_QuickForm2_Node", "$", "reference", "=", "null", ")", "{", "if", "(", "null", "===", "$", "reference", ")", "{", "return", "$", "this", "->", "appendChild", "(", "$...
Inserts an element in the container If the reference object is not given, the element will be appended. @param HTML_QuickForm2_Node Element to insert @param HTML_QuickForm2_Node Reference to insert before @return HTML_QuickForm2_Node Inserted element
[ "Inserts", "an", "element", "in", "the", "container" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Container.php#L299-L319
train
Inserts an element before the first element in the set of matched elements
[ 30522, 2270, 3853, 19274, 4783, 29278, 2063, 1006, 16129, 1035, 4248, 14192, 2475, 1035, 13045, 1002, 5783, 1010, 16129, 1035, 4248, 14192, 2475, 1035, 13045, 1002, 4431, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 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...
matomo-org/matomo
plugins/DBStats/API.php
API.getTablesSummary
private function getTablesSummary($statuses) { $dataTable = new DataTable(); foreach ($statuses as $status) { $dataTable->addRowFromSimpleArray(array( 'label' => $status['Name'], 'data_size' => $status['Data_length'], 'index_size' => $status['Index_length'], 'row_count' => $status['Rows'] )); } return $dataTable; }
php
private function getTablesSummary($statuses) { $dataTable = new DataTable(); foreach ($statuses as $status) { $dataTable->addRowFromSimpleArray(array( 'label' => $status['Name'], 'data_size' => $status['Data_length'], 'index_size' => $status['Index_length'], 'row_count' => $status['Rows'] )); } return $dataTable; }
[ "private", "function", "getTablesSummary", "(", "$", "statuses", ")", "{", "$", "dataTable", "=", "new", "DataTable", "(", ")", ";", "foreach", "(", "$", "statuses", "as", "$", "status", ")", "{", "$", "dataTable", "->", "addRowFromSimpleArray", "(", "arra...
Returns a datatable representation of a set of table statuses. @param array $statuses The table statuses to summarize. @return DataTable
[ "Returns", "a", "datatable", "representation", "of", "a", "set", "of", "table", "statuses", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DBStats/API.php#L228-L240
train
Returns a DataTable with summary of all the tables
[ 30522, 2797, 3853, 2131, 10880, 4757, 2819, 7849, 2100, 1006, 1002, 3570, 2229, 1007, 1063, 1002, 2951, 10880, 1027, 2047, 2951, 10880, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 3570, 2229, 2004, 1002, 3570, 1007, 1063, 1002, 2951, 10880, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/PluginManager.php
PluginManager.loadPlugin
public function loadPlugin($namespace, $path) { $className = $namespace.'\Plugin'; $classPath = $path.'/Plugin.php'; try { // Autoloader failed? if (!class_exists($className)) { include_once $classPath; } // Not a valid plugin! if (!class_exists($className)) { return; } $classObj = new $className($this->app); } catch (\Throwable $e) { Log::error('Plugin ' . $className . ' could not be instantiated.', [ 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString() ]); return; } $classId = $this->getIdentifier($classObj); /* * Check for disabled plugins */ if ($this->isDisabled($classId)) { $classObj->disabled = true; } $this->plugins[$classId] = $classObj; $this->pathMap[$classId] = $path; return $classObj; }
php
public function loadPlugin($namespace, $path) { $className = $namespace.'\Plugin'; $classPath = $path.'/Plugin.php'; try { // Autoloader failed? if (!class_exists($className)) { include_once $classPath; } // Not a valid plugin! if (!class_exists($className)) { return; } $classObj = new $className($this->app); } catch (\Throwable $e) { Log::error('Plugin ' . $className . ' could not be instantiated.', [ 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString() ]); return; } $classId = $this->getIdentifier($classObj); /* * Check for disabled plugins */ if ($this->isDisabled($classId)) { $classObj->disabled = true; } $this->plugins[$classId] = $classObj; $this->pathMap[$classId] = $path; return $classObj; }
[ "public", "function", "loadPlugin", "(", "$", "namespace", ",", "$", "path", ")", "{", "$", "className", "=", "$", "namespace", ".", "'\\Plugin'", ";", "$", "classPath", "=", "$", "path", ".", "'/Plugin.php'", ";", "try", "{", "// Autoloader failed?", "if"...
Loads a single plugin in to the manager. @param string $namespace Eg: Acme\Blog @param string $path Eg: plugins_path().'/acme/blog'; @return void
[ "Loads", "a", "single", "plugin", "in", "to", "the", "manager", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L120-L160
train
Load a plugin
[ 30522, 2270, 3853, 7170, 24759, 15916, 2378, 1006, 1002, 3415, 15327, 1010, 1002, 4130, 1007, 1063, 1002, 2465, 18442, 1027, 1002, 3415, 15327, 1012, 1005, 1032, 13354, 2378, 1005, 1025, 1002, 2465, 15069, 1027, 1002, 4130, 1012, 1005, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Traits/AbstractTrait.php
AbstractTrait.deleteItems
public function deleteItems(array $keys) { $ids = []; foreach ($keys as $key) { $ids[$key] = $this->getId($key); unset($this->deferred[$key]); } try { if ($this->doDelete($ids)) { return true; } } catch (\Exception $e) { } $ok = true; // When bulk-delete failed, retry each item individually foreach ($ids as $key => $id) { try { $e = null; if ($this->doDelete([$id])) { continue; } } catch (\Exception $e) { } CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]); $ok = false; } return $ok; }
php
public function deleteItems(array $keys) { $ids = []; foreach ($keys as $key) { $ids[$key] = $this->getId($key); unset($this->deferred[$key]); } try { if ($this->doDelete($ids)) { return true; } } catch (\Exception $e) { } $ok = true; // When bulk-delete failed, retry each item individually foreach ($ids as $key => $id) { try { $e = null; if ($this->doDelete([$id])) { continue; } } catch (\Exception $e) { } CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]); $ok = false; } return $ok; }
[ "public", "function", "deleteItems", "(", "array", "$", "keys", ")", "{", "$", "ids", "=", "[", "]", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "$", "ids", "[", "$", "key", "]", "=", "$", "this", "->", "getId", "(", "$", "k...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/AbstractTrait.php#L142-L174
train
Delete items by keys
[ 30522, 2270, 3853, 3972, 12870, 4221, 5244, 1006, 9140, 1002, 6309, 1007, 1063, 1002, 8909, 2015, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 6309, 2004, 1002, 3145, 1007, 1063, 1002, 8909, 2015, 1031, 1002, 3145, 1033, 1027, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/HandlerStack.php
HandlerStack.create
public static function create(callable $handler = null) { $stack = new self($handler ?: choose_handler()); $stack->push(Middleware::httpErrors(), 'http_errors'); $stack->push(Middleware::redirect(), 'allow_redirects'); $stack->push(Middleware::cookies(), 'cookies'); $stack->push(Middleware::prepareBody(), 'prepare_body'); return $stack; }
php
public static function create(callable $handler = null) { $stack = new self($handler ?: choose_handler()); $stack->push(Middleware::httpErrors(), 'http_errors'); $stack->push(Middleware::redirect(), 'allow_redirects'); $stack->push(Middleware::cookies(), 'cookies'); $stack->push(Middleware::prepareBody(), 'prepare_body'); return $stack; }
[ "public", "static", "function", "create", "(", "callable", "$", "handler", "=", "null", ")", "{", "$", "stack", "=", "new", "self", "(", "$", "handler", "?", ":", "choose_handler", "(", ")", ")", ";", "$", "stack", "->", "push", "(", "Middleware", ":...
Creates a default handler stack that can be used by clients. The returned handler will wrap the provided handler or use the most appropriate default handler for your system. The returned HandlerStack has support for cookies, redirects, HTTP error exceptions, and preparing a body before sending. The returned handler stack can be passed to a client in the "handler" option. @param callable $handler HTTP handler function to use with the stack. If no handler is provided, the best handler for your system will be utilized. @return HandlerStack
[ "Creates", "a", "default", "handler", "stack", "that", "can", "be", "used", "by", "clients", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/HandlerStack.php#L38-L47
train
Create a new stack of middleware
[ 30522, 2270, 10763, 3853, 3443, 1006, 2655, 3085, 1002, 28213, 1027, 19701, 1007, 1063, 1002, 9991, 1027, 2047, 2969, 1006, 1002, 28213, 1029, 1024, 5454, 1035, 28213, 30524, 1005, 8299, 1035, 10697, 1005, 1007, 1025, 1002, 9991, 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...
php-ai/php-ml
src/Association/Apriori.php
Apriori.frequent
private function frequent(array $samples): array { return array_values(array_filter($samples, function ($entry) { return $this->support($entry) >= $this->support; })); }
php
private function frequent(array $samples): array { return array_values(array_filter($samples, function ($entry) { return $this->support($entry) >= $this->support; })); }
[ "private", "function", "frequent", "(", "array", "$", "samples", ")", ":", "array", "{", "return", "array_values", "(", "array_filter", "(", "$", "samples", ",", "function", "(", "$", "entry", ")", "{", "return", "$", "this", "->", "support", "(", "$", ...
Returns frequent item sets only. @param mixed[][] $samples @return mixed[][]
[ "Returns", "frequent", "item", "sets", "only", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L214-L219
train
Frequent filter.
[ 30522, 2797, 3853, 6976, 1006, 9140, 1002, 8168, 1007, 1024, 9140, 1063, 2709, 9140, 1035, 5300, 1006, 9140, 1035, 11307, 1006, 1002, 8168, 1010, 3853, 1006, 1002, 4443, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2490, 1006, 1002, 4443, 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...
dompdf/dompdf
lib/Cpdf.php
Cpdf.curve
function curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3) { // in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points // as the control points for the curve. $this->addContent( sprintf("\n%.3F %.3F m %.3F %.3F %.3F %.3F %.3F %.3F c S", $x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3) ); }
php
function curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3) { // in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points // as the control points for the curve. $this->addContent( sprintf("\n%.3F %.3F m %.3F %.3F %.3F %.3F %.3F %.3F c S", $x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3) ); }
[ "function", "curve", "(", "$", "x0", ",", "$", "y0", ",", "$", "x1", ",", "$", "y1", ",", "$", "x2", ",", "$", "y2", ",", "$", "x3", ",", "$", "y3", ")", "{", "// in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points...
draw a bezier curve based on 4 control points @param $x0 @param $y0 @param $x1 @param $y1 @param $x2 @param $y2 @param $x3 @param $y3
[ "draw", "a", "bezier", "curve", "based", "on", "4", "control", "points" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L3269-L3276
train
Draw a bezier curve
[ 30522, 3853, 7774, 1006, 1002, 1060, 2692, 1010, 1002, 1061, 2692, 1010, 1002, 1060, 2487, 1010, 1002, 1061, 2487, 1010, 1002, 1060, 2475, 1010, 1002, 1061, 2475, 1010, 1002, 1060, 2509, 1010, 1002, 1061, 2509, 1007, 1063, 1013, 1013, 199...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Association/Apriori.php
Apriori.subset
private function subset(array $set, array $subset): bool { return count(array_diff($subset, array_intersect($subset, $set))) === 0; }
php
private function subset(array $set, array $subset): bool { return count(array_diff($subset, array_intersect($subset, $set))) === 0; }
[ "private", "function", "subset", "(", "array", "$", "set", ",", "array", "$", "subset", ")", ":", "bool", "{", "return", "count", "(", "array_diff", "(", "$", "subset", ",", "array_intersect", "(", "$", "subset", ",", "$", "set", ")", ")", ")", "==="...
Returns true if subset is a (proper) subset of set by its items string representation. @param mixed[] $set @param mixed[] $subset
[ "Returns", "true", "if", "subset", "is", "a", "(", "proper", ")", "subset", "of", "set", "by", "its", "items", "string", "representation", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L317-L320
train
Subset array with subset
[ 30522, 2797, 3853, 16745, 1006, 9140, 1002, 2275, 1010, 9140, 1002, 16745, 1007, 1024, 22017, 2140, 1063, 2709, 4175, 1006, 9140, 1035, 4487, 4246, 1006, 1002, 16745, 1010, 9140, 1035, 29261, 1006, 1002, 16745, 1010, 1002, 2275, 1007, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Controller.php
HTML_QuickForm2_Controller.arrayMerge
protected static function arrayMerge($a, $b) { foreach ($b as $k => $v) { if (!is_array($v) || isset($a[$k]) && !is_array($a[$k])) { $a[$k] = $v; } else { $a[$k] = self::arrayMerge(isset($a[$k])? $a[$k]: array(), $v); } } return $a; }
php
protected static function arrayMerge($a, $b) { foreach ($b as $k => $v) { if (!is_array($v) || isset($a[$k]) && !is_array($a[$k])) { $a[$k] = $v; } else { $a[$k] = self::arrayMerge(isset($a[$k])? $a[$k]: array(), $v); } } return $a; }
[ "protected", "static", "function", "arrayMerge", "(", "$", "a", ",", "$", "b", ")", "{", "foreach", "(", "$", "b", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "is_array", "(", "$", "v", ")", "||", "isset", "(", "$", "a", "[", ...
Merges two arrays Merges two arrays like the PHP function array_merge_recursive does, the difference being that existing integer keys will not be renumbered. @param array @param array @return array resulting array
[ "Merges", "two", "arrays" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller.php#L486-L496
train
Array Merge - Merges 2 arrays
[ 30522, 5123, 10763, 3853, 9140, 5017, 3351, 1006, 1002, 1037, 1010, 1002, 1038, 1007, 1063, 18921, 6776, 1006, 1002, 1038, 2004, 1002, 1047, 1027, 1028, 1002, 1058, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 1058, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Route.php
Route.domain
public function domain($domain = null) { if (is_null($domain)) { return $this->getDomain(); } $this->action['domain'] = $domain; return $this; }
php
public function domain($domain = null) { if (is_null($domain)) { return $this->getDomain(); } $this->action['domain'] = $domain; return $this; }
[ "public", "function", "domain", "(", "$", "domain", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "domain", ")", ")", "{", "return", "$", "this", "->", "getDomain", "(", ")", ";", "}", "$", "this", "->", "action", "[", "'domain'", "]", "...
Get or set the domain for the route. @param string|null $domain @return $this|string|null
[ "Get", "or", "set", "the", "domain", "for", "the", "route", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Route.php#L589-L598
train
Set domain action
[ 30522, 2270, 3853, 5884, 1006, 1002, 5884, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 5884, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 9527, 8113, 1006, 1007, 1025, 1065, 1002, 2023, 1011, 1028, 2895, 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/HttpFoundation/Response.php
Response.isNotModified
public function isNotModified(Request $request): bool { if (!$request->isMethodCacheable()) { return false; } $notModified = false; $lastModified = $this->headers->get('Last-Modified'); $modifiedSince = $request->headers->get('If-Modified-Since'); if ($etags = $request->getETags()) { $notModified = \in_array($this->getEtag(), $etags) || \in_array('*', $etags); } if ($modifiedSince && $lastModified) { $notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified); } if ($notModified) { $this->setNotModified(); } return $notModified; }
php
public function isNotModified(Request $request): bool { if (!$request->isMethodCacheable()) { return false; } $notModified = false; $lastModified = $this->headers->get('Last-Modified'); $modifiedSince = $request->headers->get('If-Modified-Since'); if ($etags = $request->getETags()) { $notModified = \in_array($this->getEtag(), $etags) || \in_array('*', $etags); } if ($modifiedSince && $lastModified) { $notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified); } if ($notModified) { $this->setNotModified(); } return $notModified; }
[ "public", "function", "isNotModified", "(", "Request", "$", "request", ")", ":", "bool", "{", "if", "(", "!", "$", "request", "->", "isMethodCacheable", "(", ")", ")", "{", "return", "false", ";", "}", "$", "notModified", "=", "false", ";", "$", "lastM...
Determines if the Response validators (ETag, Last-Modified) match a conditional value specified in the Request. If the Response is not modified, it sets the status code to 304 and removes the actual content by calling the setNotModified() method. @return bool true if the Response validators match the Request, false otherwise @final
[ "Determines", "if", "the", "Response", "validators", "(", "ETag", "Last", "-", "Modified", ")", "match", "a", "conditional", "value", "specified", "in", "the", "Request", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Response.php#L1067-L1090
train
Returns true if the response is not modified
[ 30522, 2270, 3853, 3475, 4140, 5302, 4305, 10451, 1006, 5227, 1002, 5227, 1007, 1024, 22017, 2140, 1063, 2065, 1006, 999, 1002, 5227, 1011, 1028, 2003, 11368, 6806, 16409, 15395, 3085, 1006, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Storage/Mbox.php
Zend_Mail_Storage_Mbox.getUniqueId
public function getUniqueId($id = null) { if ($id) { // check if id exists $this->_getPos($id); return $id; } $range = range(1, $this->countMessages()); return array_combine($range, $range); }
php
public function getUniqueId($id = null) { if ($id) { // check if id exists $this->_getPos($id); return $id; } $range = range(1, $this->countMessages()); return array_combine($range, $range); }
[ "public", "function", "getUniqueId", "(", "$", "id", "=", "null", ")", "{", "if", "(", "$", "id", ")", "{", "// check if id exists", "$", "this", "->", "_getPos", "(", "$", "id", ")", ";", "return", "$", "id", ";", "}", "$", "range", "=", "range", ...
get unique id for one or all messages Mbox does not support unique ids (yet) - it's always the same as the message number. That shouldn't be a problem, because we can't change mbox files. Therefor the message number is save enough. @param int|null $id message number @return array|string message number for given message or all messages as array @throws Zend_Mail_Storage_Exception
[ "get", "unique", "id", "for", "one", "or", "all", "messages" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Mbox.php#L380-L390
train
get unique id
[ 30522, 2270, 3853, 2131, 19496, 4226, 3593, 1006, 1002, 8909, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 8909, 1007, 1063, 1013, 1013, 4638, 2065, 8909, 6526, 1002, 2023, 1011, 1028, 1035, 2131, 6873, 2015, 1006, 1002, 8909, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/PluginManager.php
PluginManager.bootPlugin
public function bootPlugin($plugin) { if (!$plugin || $plugin->disabled) { return; } if (!self::$noInit || $plugin->elevated) { $plugin->boot(); } }
php
public function bootPlugin($plugin) { if (!$plugin || $plugin->disabled) { return; } if (!self::$noInit || $plugin->elevated) { $plugin->boot(); } }
[ "public", "function", "bootPlugin", "(", "$", "plugin", ")", "{", "if", "(", "!", "$", "plugin", "||", "$", "plugin", "->", "disabled", ")", "{", "return", ";", "}", "if", "(", "!", "self", "::", "$", "noInit", "||", "$", "plugin", "->", "elevated"...
Registers a single plugin object. @param PluginBase $plugin @return void
[ "Registers", "a", "single", "plugin", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L286-L295
train
Boots a plugin
[ 30522, 2270, 3853, 9573, 24759, 15916, 2378, 1006, 1002, 13354, 2378, 1007, 1063, 2065, 1006, 999, 1002, 13354, 2378, 1064, 1064, 1002, 13354, 2378, 1011, 1028, 9776, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 999, 2969, 1024, 1024, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/DependencyInjection/AddAutoMappingConfigurationPass.php
AddAutoMappingConfigurationPass.getRegexp
private function getRegexp(array $patterns): string { $regexps = []; foreach ($patterns as $pattern) { // Escape namespace $regex = preg_quote(ltrim($pattern, '\\')); // Wildcards * and ** $regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?']); // If this class does not end by a slash, anchor the end if ('\\' !== substr($regex, -1)) { $regex .= '$'; } $regexps[] = '^'.$regex; } return sprintf('{%s}', implode('|', $regexps)); }
php
private function getRegexp(array $patterns): string { $regexps = []; foreach ($patterns as $pattern) { // Escape namespace $regex = preg_quote(ltrim($pattern, '\\')); // Wildcards * and ** $regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?']); // If this class does not end by a slash, anchor the end if ('\\' !== substr($regex, -1)) { $regex .= '$'; } $regexps[] = '^'.$regex; } return sprintf('{%s}', implode('|', $regexps)); }
[ "private", "function", "getRegexp", "(", "array", "$", "patterns", ")", ":", "string", "{", "$", "regexps", "=", "[", "]", ";", "foreach", "(", "$", "patterns", "as", "$", "pattern", ")", "{", "// Escape namespace", "$", "regex", "=", "preg_quote", "(", ...
Builds a regexp to check if a class is auto-mapped.
[ "Builds", "a", "regexp", "to", "check", "if", "a", "class", "is", "auto", "-", "mapped", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/DependencyInjection/AddAutoMappingConfigurationPass.php#L73-L92
train
Returns the regular expression for the given class names
[ 30522, 2797, 3853, 2131, 2890, 3351, 2595, 2361, 1006, 9140, 1002, 7060, 1007, 1024, 5164, 1063, 1002, 19723, 10288, 4523, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 7060, 2004, 1002, 5418, 1007, 1063, 1013, 1013, 4019, 3415, 15327, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/behaviors/SettingsModel.php
SettingsModel.getSettingsValue
public function getSettingsValue($key, $default = null) { if (array_key_exists($key, $this->fieldValues)) { return $this->fieldValues[$key]; } return array_get($this->fieldValues, $key, $default); }
php
public function getSettingsValue($key, $default = null) { if (array_key_exists($key, $this->fieldValues)) { return $this->fieldValues[$key]; } return array_get($this->fieldValues, $key, $default); }
[ "public", "function", "getSettingsValue", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "fieldValues", ")", ")", "{", "return", "$", "this", "->", "fieldValues", "["...
Get a single setting value, or return a default value
[ "Get", "a", "single", "setting", "value", "or", "return", "a", "default", "value" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L141-L148
train
Get settings value
[ 30522, 2270, 3853, 4152, 18319, 3070, 2015, 10175, 5657, 1006, 1002, 3145, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 2065, 1006, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 3145, 1010, 1002, 2023, 1011, 1028, 2492, 10175, 15808, 1007, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php
NestedPropertyCollectionTrait.group
public function group($property, $separator = null) { $list = []; /** @var NestedObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element; } return $list; }
php
public function group($property, $separator = null) { $list = []; /** @var NestedObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element; } return $list; }
[ "public", "function", "group", "(", "$", "property", ",", "$", "separator", "=", "null", ")", "{", "$", "list", "=", "[", "]", ";", "/** @var NestedObjectInterface $element */", "foreach", "(", "$", "this", "->", "getIterator", "(", ")", "as", "$", "elemen...
Group items in the collection by a field. @param string $property Object property to be used to make groups. @param string $separator Separator, defaults to '.' @return array
[ "Group", "items", "in", "the", "collection", "by", "a", "field", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php#L109-L119
train
Group elements by a property
[ 30522, 2270, 3853, 2177, 1006, 1002, 3200, 1010, 1002, 19802, 25879, 2953, 1027, 19701, 1007, 1063, 1002, 2862, 1027, 1031, 1033, 1025, 1013, 1008, 1008, 1030, 13075, 9089, 26010, 2497, 20614, 18447, 2121, 12172, 1002, 5783, 1008, 1013, 189...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/Grammar.php
Grammar.compileUnions
protected function compileUnions(Builder $query) { $sql = ''; foreach ($query->unions as $union) { $sql .= $this->compileUnion($union); } if (! empty($query->unionOrders)) { $sql .= ' '.$this->compileOrders($query, $query->unionOrders); } if (isset($query->unionLimit)) { $sql .= ' '.$this->compileLimit($query, $query->unionLimit); } if (isset($query->unionOffset)) { $sql .= ' '.$this->compileOffset($query, $query->unionOffset); } return ltrim($sql); }
php
protected function compileUnions(Builder $query) { $sql = ''; foreach ($query->unions as $union) { $sql .= $this->compileUnion($union); } if (! empty($query->unionOrders)) { $sql .= ' '.$this->compileOrders($query, $query->unionOrders); } if (isset($query->unionLimit)) { $sql .= ' '.$this->compileLimit($query, $query->unionLimit); } if (isset($query->unionOffset)) { $sql .= ' '.$this->compileOffset($query, $query->unionOffset); } return ltrim($sql); }
[ "protected", "function", "compileUnions", "(", "Builder", "$", "query", ")", "{", "$", "sql", "=", "''", ";", "foreach", "(", "$", "query", "->", "unions", "as", "$", "union", ")", "{", "$", "sql", ".=", "$", "this", "->", "compileUnion", "(", "$", ...
Compile the "union" queries attached to the main query. @param \Illuminate\Database\Query\Builder $query @return string
[ "Compile", "the", "union", "queries", "attached", "to", "the", "main", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L781-L802
train
Compiles the union clauses into a single SQL statement.
[ 30522, 5123, 3853, 4012, 22090, 19496, 5644, 1006, 12508, 1002, 23032, 1007, 1063, 1002, 29296, 1027, 1005, 1005, 1025, 18921, 6776, 1006, 1002, 23032, 1011, 1028, 9209, 2004, 1002, 2586, 1007, 1063, 1002, 29296, 1012, 1027, 1002, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MediaLibrary.php
MediaLibrary.deleteFolder
public function deleteFolder($path) { $path = self::validatePath($path); $fullPaths = $this->getMediaPath($path); return $this->getStorageDisk()->deleteDirectory($fullPaths); }
php
public function deleteFolder($path) { $path = self::validatePath($path); $fullPaths = $this->getMediaPath($path); return $this->getStorageDisk()->deleteDirectory($fullPaths); }
[ "public", "function", "deleteFolder", "(", "$", "path", ")", "{", "$", "path", "=", "self", "::", "validatePath", "(", "$", "path", ")", ";", "$", "fullPaths", "=", "$", "this", "->", "getMediaPath", "(", "$", "path", ")", ";", "return", "$", "this",...
Deletes a folder from the Library. @param string $path Specifies the folder path relative to the Library root.
[ "Deletes", "a", "folder", "from", "the", "Library", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L224-L230
train
Delete folder in the media directory
[ 30522, 2270, 3853, 3972, 12870, 10371, 2121, 1006, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 2969, 1024, 1024, 9398, 3686, 15069, 1006, 1002, 4130, 1007, 1025, 1002, 2440, 15069, 2015, 1027, 1002, 2023, 1011, 1028, 2131, 16969, 15069, 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.move
public function move(PageInterface $parent) { if (!$this->_original) { $clone = clone $this; $this->_original = $clone; } $this->_action = 'move'; if ($this->route() === $parent->route()) { throw new \RuntimeException('Failed: Cannot set page parent to self'); } if (Utils::startsWith($parent->rawRoute(), $this->rawRoute())) { throw new \RuntimeException('Failed: Cannot set page parent to a child of current page'); } $this->parent($parent); $this->id(time() . md5($this->filePath())); if ($parent->path()) { $this->path($parent->path() . '/' . $this->folder()); } if ($parent->route()) { $this->route($parent->route() . '/' . $this->slug()); } else { $this->route(Grav::instance()['pages']->root()->route() . '/' . $this->slug()); } $this->raw_route = null; return $this; }
php
public function move(PageInterface $parent) { if (!$this->_original) { $clone = clone $this; $this->_original = $clone; } $this->_action = 'move'; if ($this->route() === $parent->route()) { throw new \RuntimeException('Failed: Cannot set page parent to self'); } if (Utils::startsWith($parent->rawRoute(), $this->rawRoute())) { throw new \RuntimeException('Failed: Cannot set page parent to a child of current page'); } $this->parent($parent); $this->id(time() . md5($this->filePath())); if ($parent->path()) { $this->path($parent->path() . '/' . $this->folder()); } if ($parent->route()) { $this->route($parent->route() . '/' . $this->slug()); } else { $this->route(Grav::instance()['pages']->root()->route() . '/' . $this->slug()); } $this->raw_route = null; return $this; }
[ "public", "function", "move", "(", "PageInterface", "$", "parent", ")", "{", "if", "(", "!", "$", "this", "->", "_original", ")", "{", "$", "clone", "=", "clone", "$", "this", ";", "$", "this", "->", "_original", "=", "$", "clone", ";", "}", "$", ...
Prepare move page to new location. Moves also everything that's under the current page. You need to call $this->save() in order to perform the move. @param PageInterface $parent New parent page. @return $this
[ "Prepare", "move", "page", "to", "new", "location", ".", "Moves", "also", "everything", "that", "s", "under", "the", "current", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1031-L1063
train
Move the page to another page
[ 30522, 2270, 3853, 2693, 1006, 3931, 18447, 2121, 12172, 1002, 6687, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2434, 1007, 1063, 1002, 17598, 1027, 17598, 1002, 2023, 1025, 1002, 2023, 1011, 1028, 1035, 2434, 1027, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Inflector.php
Inflector.ordinalize
public static function ordinalize($number) { static::init(); if (\in_array($number % 100, range(11, 13), true)) { return $number . static::$ordinals['default']; } switch ($number % 10) { case 1: return $number . static::$ordinals['first']; case 2: return $number . static::$ordinals['second']; case 3: return $number . static::$ordinals['third']; default: return $number . static::$ordinals['default']; } }
php
public static function ordinalize($number) { static::init(); if (\in_array($number % 100, range(11, 13), true)) { return $number . static::$ordinals['default']; } switch ($number % 10) { case 1: return $number . static::$ordinals['first']; case 2: return $number . static::$ordinals['second']; case 3: return $number . static::$ordinals['third']; default: return $number . static::$ordinals['default']; } }
[ "public", "static", "function", "ordinalize", "(", "$", "number", ")", "{", "static", "::", "init", "(", ")", ";", "if", "(", "\\", "in_array", "(", "$", "number", "%", "100", ",", "range", "(", "11", ",", "13", ")", ",", "true", ")", ")", "{", ...
Converts number to its ordinal English form. This method converts 13 to 13th, 2 to 2nd ... @param int $number Number to get its ordinal value @return string Ordinal representation of given string.
[ "Converts", "number", "to", "its", "ordinal", "English", "form", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Inflector.php#L285-L303
train
Return ordinal code
[ 30522, 2270, 10763, 3853, 2030, 18979, 3669, 4371, 1006, 1002, 2193, 1007, 1063, 10763, 1024, 1024, 1999, 4183, 1006, 1007, 1025, 2065, 1006, 1032, 1999, 1035, 9140, 1006, 1002, 2193, 1003, 2531, 1010, 2846, 1006, 2340, 1010, 2410, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Str.php
Str.languageSpecificCharsArray
protected static function languageSpecificCharsArray($language) { static $languageSpecific; if (! isset($languageSpecific)) { $languageSpecific = [ 'bg' => [ ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'], ], 'da' => [ ['æ', 'ø', 'å', 'Æ', 'Ø', 'Å'], ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'], ], 'de' => [ ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], ], 'ro' => [ ['ă', 'â', 'î', 'ș', 'ț', 'Ă', 'Â', 'Î', 'Ș', 'Ț'], ['a', 'a', 'i', 's', 't', 'A', 'A', 'I', 'S', 'T'], ], ]; } return $languageSpecific[$language] ?? null; }
php
protected static function languageSpecificCharsArray($language) { static $languageSpecific; if (! isset($languageSpecific)) { $languageSpecific = [ 'bg' => [ ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'], ], 'da' => [ ['æ', 'ø', 'å', 'Æ', 'Ø', 'Å'], ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'], ], 'de' => [ ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], ], 'ro' => [ ['ă', 'â', 'î', 'ș', 'ț', 'Ă', 'Â', 'Î', 'Ș', 'Ț'], ['a', 'a', 'i', 's', 't', 'A', 'A', 'I', 'S', 'T'], ], ]; } return $languageSpecific[$language] ?? null; }
[ "protected", "static", "function", "languageSpecificCharsArray", "(", "$", "language", ")", "{", "static", "$", "languageSpecific", ";", "if", "(", "!", "isset", "(", "$", "languageSpecific", ")", ")", "{", "$", "languageSpecific", "=", "[", "'bg'", "=>", "[...
Returns the language specific replacements for the ascii method. Note: Adapted from Stringy\Stringy. @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt @param string $language @return array|null
[ "Returns", "the", "language", "specific", "replacements", "for", "the", "ascii", "method", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L719-L745
train
Returns the language specific characters array
[ 30522, 5123, 10763, 3853, 4155, 5051, 6895, 8873, 9468, 8167, 10286, 9447, 1006, 1002, 2653, 1007, 1063, 10763, 1002, 4155, 5051, 6895, 8873, 2278, 1025, 2065, 1006, 999, 26354, 3388, 1006, 1002, 4155, 5051, 6895, 8873, 2278, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/ShakeAround/StatsClient.php
StatsClient.devicesSummary
public function devicesSummary(int $timestamp, int $pageIndex) { $params = [ 'date' => $timestamp, 'page_index' => $pageIndex, ]; return $this->httpPostJson('shakearound/statistics/devicelist', $params); }
php
public function devicesSummary(int $timestamp, int $pageIndex) { $params = [ 'date' => $timestamp, 'page_index' => $pageIndex, ]; return $this->httpPostJson('shakearound/statistics/devicelist', $params); }
[ "public", "function", "devicesSummary", "(", "int", "$", "timestamp", ",", "int", "$", "pageIndex", ")", "{", "$", "params", "=", "[", "'date'", "=>", "$", "timestamp", ",", "'page_index'", "=>", "$", "pageIndex", ",", "]", ";", "return", "$", "this", ...
Fetch all devices statistics data by date. @param int $timestamp @param int $pageIndex @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Fetch", "all", "devices", "statistics", "data", "by", "date", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/ShakeAround/StatsClient.php#L51-L59
train
Returns summary of all devices
[ 30522, 2270, 3853, 5733, 17421, 7849, 2100, 1006, 20014, 1002, 2335, 15464, 2361, 1010, 20014, 1002, 3931, 22254, 10288, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 3058, 1005, 1027, 1028, 1002, 2335, 15464, 2361, 1010, 1005, 3931, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/PrivacyManager/Controller.php
Controller.getDatabaseSize
public function getDatabaseSize() { Piwik::checkUserHasSuperUserAccess(); $view = new View('@PrivacyManager/getDatabaseSize'); $forceEstimate = Common::getRequestVar('forceEstimate', 0); $view->dbStats = $this->getDeleteDBSizeEstimate($getSettingsFromQuery = true, $forceEstimate); $view->language = LanguagesManager::getLanguageCodeForCurrentUser(); return $view->render(); }
php
public function getDatabaseSize() { Piwik::checkUserHasSuperUserAccess(); $view = new View('@PrivacyManager/getDatabaseSize'); $forceEstimate = Common::getRequestVar('forceEstimate', 0); $view->dbStats = $this->getDeleteDBSizeEstimate($getSettingsFromQuery = true, $forceEstimate); $view->language = LanguagesManager::getLanguageCodeForCurrentUser(); return $view->render(); }
[ "public", "function", "getDatabaseSize", "(", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "$", "view", "=", "new", "View", "(", "'@PrivacyManager/getDatabaseSize'", ")", ";", "$", "forceEstimate", "=", "Common", "::", "getRequestVar", ...
Echo's an HTML chunk describing the current database size, and the estimated space savings after the scheduled data purge is run.
[ "Echo", "s", "an", "HTML", "chunk", "describing", "the", "current", "database", "size", "and", "the", "estimated", "space", "savings", "after", "the", "scheduled", "data", "purge", "is", "run", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/Controller.php#L150-L160
train
Returns the database size in bytes.
[ 30522, 2270, 3853, 2131, 2850, 2696, 30524, 2015, 1006, 1007, 1025, 1002, 3193, 1027, 2047, 3193, 1006, 1005, 1030, 9394, 24805, 4590, 1013, 2131, 2850, 2696, 15058, 5332, 4371, 1005, 1007, 1025, 1002, 2486, 4355, 21499, 1027, 2691, 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/Tracker/PageUrl.php
PageUrl.cleanupString
public static function cleanupString($string) { $string = trim($string); $string = str_replace(array("\n", "\r", "\0"), '', $string); $limit = Config::getInstance()->Tracker['page_maximum_length']; $clean = substr($string, 0, $limit); return $clean; }
php
public static function cleanupString($string) { $string = trim($string); $string = str_replace(array("\n", "\r", "\0"), '', $string); $limit = Config::getInstance()->Tracker['page_maximum_length']; $clean = substr($string, 0, $limit); return $clean; }
[ "public", "static", "function", "cleanupString", "(", "$", "string", ")", "{", "$", "string", "=", "trim", "(", "$", "string", ")", ";", "$", "string", "=", "str_replace", "(", "array", "(", "\"\\n\"", ",", "\"\\r\"", ",", "\"\\0\"", ")", ",", "''", ...
Clean up string contents (filter, truncate, ...) @param string $string Dirty string @return string
[ "Clean", "up", "string", "contents", "(", "filter", "truncate", "...", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/PageUrl.php#L225-L233
train
Clean up a string that is not longer than the maximum page length
[ 30522, 2270, 10763, 3853, 27686, 3367, 4892, 1006, 1002, 5164, 1007, 1063, 1002, 5164, 1027, 12241, 1006, 1002, 5164, 1007, 1025, 1002, 5164, 1027, 2358, 2099, 1035, 5672, 1006, 9140, 1006, 1000, 1032, 1050, 1000, 1010, 1000, 1032, 1054, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Extension.php
Extension.validateMenu
public function validateMenu(array $menu) { /** @var \Illuminate\Validation\Validator $validator */ $validator = Validator::make($menu, $this->menuValidationRules); if ($validator->passes()) { return true; } $message = "Invalid menu:\r\n".implode("\r\n", Arr::flatten($validator->errors()->messages())); throw new \Exception($message); }
php
public function validateMenu(array $menu) { /** @var \Illuminate\Validation\Validator $validator */ $validator = Validator::make($menu, $this->menuValidationRules); if ($validator->passes()) { return true; } $message = "Invalid menu:\r\n".implode("\r\n", Arr::flatten($validator->errors()->messages())); throw new \Exception($message); }
[ "public", "function", "validateMenu", "(", "array", "$", "menu", ")", "{", "/** @var \\Illuminate\\Validation\\Validator $validator */", "$", "validator", "=", "Validator", "::", "make", "(", "$", "menu", ",", "$", "this", "->", "menuValidationRules", ")", ";", "i...
Validate menu fields. @param array $menu @throws \Exception @return bool
[ "Validate", "menu", "fields", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Extension.php#L258-L270
train
Validate menu.
[ 30522, 2270, 3853, 9398, 3686, 3549, 2226, 1006, 9140, 1002, 12183, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 1032, 5665, 12717, 12556, 1032, 27354, 1032, 9398, 8844, 1002, 9398, 8844, 1008, 1013, 1002, 9398, 8844, 1027, 9398, 8844, 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...
octobercms/october
modules/system/classes/PluginManager.php
PluginManager.normalizeIdentifier
public function normalizeIdentifier($identifier) { foreach ($this->plugins as $id => $object) { if (strtolower($id) == strtolower($identifier)) { return $id; } } return $identifier; }
php
public function normalizeIdentifier($identifier) { foreach ($this->plugins as $id => $object) { if (strtolower($id) == strtolower($identifier)) { return $id; } } return $identifier; }
[ "public", "function", "normalizeIdentifier", "(", "$", "identifier", ")", "{", "foreach", "(", "$", "this", "->", "plugins", "as", "$", "id", "=>", "$", "object", ")", "{", "if", "(", "strtolower", "(", "$", "id", ")", "==", "strtolower", "(", "$", "...
Takes a human plugin code (acme.blog) and makes it authentic (Acme.Blog) @param string $id @return string
[ "Takes", "a", "human", "plugin", "code", "(", "acme", ".", "blog", ")", "and", "makes", "it", "authentic", "(", "Acme", ".", "Blog", ")" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L443-L452
train
Normalize identifier.
[ 30522, 2270, 3853, 3671, 4697, 5178, 16778, 8873, 2121, 1006, 1002, 8909, 4765, 18095, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 13354, 7076, 2004, 1002, 8909, 1027, 1028, 1002, 4874, 1007, 1063, 2065, 1006, 2358, 5339, 12898, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
lib/Cpdf.php
Cpdf.o_toUnicode
protected function o_toUnicode($id, $action) { switch ($action) { case 'new': $this->objects[$id] = array( 't' => 'toUnicode' ); break; case 'add': break; case 'out': $ordering = '(UCS)'; $registry = '(Adobe)'; if ($this->encrypted) { $this->encryptInit($id); $ordering = $this->ARC4($ordering); $registry = $this->ARC4($registry); } $stream = <<<EOT /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo <</Registry $registry /Ordering $ordering /Supplement 0 >> def /CMapName /Adobe-Identity-UCS def /CMapType 2 def 1 begincodespacerange <0000> <FFFF> endcodespacerange 1 beginbfrange <0000> <FFFF> <0000> endbfrange endcmap CMapName currentdict /CMap defineresource pop end end EOT; $res = "\n$id 0 obj\n"; $res .= "<</Length " . mb_strlen($stream, '8bit') . " >>\n"; $res .= "stream\n" . $stream . "\nendstream" . "\nendobj";; return $res; } return null; }
php
protected function o_toUnicode($id, $action) { switch ($action) { case 'new': $this->objects[$id] = array( 't' => 'toUnicode' ); break; case 'add': break; case 'out': $ordering = '(UCS)'; $registry = '(Adobe)'; if ($this->encrypted) { $this->encryptInit($id); $ordering = $this->ARC4($ordering); $registry = $this->ARC4($registry); } $stream = <<<EOT /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo <</Registry $registry /Ordering $ordering /Supplement 0 >> def /CMapName /Adobe-Identity-UCS def /CMapType 2 def 1 begincodespacerange <0000> <FFFF> endcodespacerange 1 beginbfrange <0000> <FFFF> <0000> endbfrange endcmap CMapName currentdict /CMap defineresource pop end end EOT; $res = "\n$id 0 obj\n"; $res .= "<</Length " . mb_strlen($stream, '8bit') . " >>\n"; $res .= "stream\n" . $stream . "\nendstream" . "\nendobj";; return $res; } return null; }
[ "protected", "function", "o_toUnicode", "(", "$", "id", ",", "$", "action", ")", "{", "switch", "(", "$", "action", ")", "{", "case", "'new'", ":", "$", "this", "->", "objects", "[", "$", "id", "]", "=", "array", "(", "'t'", "=>", "'toUnicode'", ")...
A toUnicode section, needed for unicode fonts @param $id @param $action @return null|string
[ "A", "toUnicode", "section", "needed", "for", "unicode", "fonts" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L961-L1012
train
To unicode code
[ 30522, 5123, 3853, 1051, 1035, 2000, 19496, 16044, 1006, 1002, 8909, 1010, 1002, 2895, 1007, 1063, 6942, 1006, 1002, 2895, 1007, 1063, 2553, 1005, 2047, 1005, 1024, 1002, 2023, 1011, 1028, 5200, 1031, 1002, 8909, 1033, 1027, 9140, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Request.php
Request.setTrustedProxies
public static function setTrustedProxies(array $proxies, int $trustedHeaderSet) { self::$trustedProxies = $proxies; self::$trustedHeaderSet = $trustedHeaderSet; }
php
public static function setTrustedProxies(array $proxies, int $trustedHeaderSet) { self::$trustedProxies = $proxies; self::$trustedHeaderSet = $trustedHeaderSet; }
[ "public", "static", "function", "setTrustedProxies", "(", "array", "$", "proxies", ",", "int", "$", "trustedHeaderSet", ")", "{", "self", "::", "$", "trustedProxies", "=", "$", "proxies", ";", "self", "::", "$", "trustedHeaderSet", "=", "$", "trustedHeaderSet"...
Sets a list of trusted proxies. You should only list the reverse proxies that you manage directly. @param array $proxies A list of trusted proxies @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies @throws \InvalidArgumentException When $trustedHeaderSet is invalid
[ "Sets", "a", "list", "of", "trusted", "proxies", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L567-L571
train
Sets the trusted proxies and header sets for this page.
[ 30522, 2270, 10763, 3853, 2275, 24669, 2098, 21572, 16898, 2015, 1006, 9140, 1002, 4013, 16898, 2015, 1010, 20014, 1002, 9480, 4974, 2545, 3388, 1007, 1063, 2969, 1024, 1024, 1002, 9480, 21572, 16898, 2015, 1027, 1002, 4013, 16898, 2015, 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...