repo
stringclasses
21 values
path
stringlengths
10
105
func_name
stringlengths
6
64
original_string
stringlengths
105
15.6k
language
stringclasses
1 value
code
stringlengths
105
15.6k
code_tokens
listlengths
29
2.15k
docstring
stringlengths
11
2.85k
docstring_tokens
listlengths
1
290
sha
stringclasses
21 values
url
stringlengths
100
194
partition
stringclasses
1 value
summary
stringlengths
8
319
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
getgrav/grav
system/src/Grav/Framework/Object/ObjectCollection.php
ObjectCollection.matching
public function matching(Criteria $criteria) { $expr = $criteria->getWhereExpression(); $filtered = $this->getElements(); if ($expr) { $visitor = new ObjectExpressionVisitor(); $filter = $visitor->dispatch($expr); $filtered = array_filter($filtered, $filter); } if ($orderings = $criteria->getOrderings()) { $next = null; /** * @var string $field * @var string $ordering */ foreach (array_reverse($orderings) as $field => $ordering) { $next = ObjectExpressionVisitor::sortByField($field, $ordering === Criteria::DESC ? -1 : 1, $next); } if ($next) { uasort($filtered, $next); } } $offset = $criteria->getFirstResult(); $length = $criteria->getMaxResults(); if ($offset || $length) { $filtered = \array_slice($filtered, (int)$offset, $length); } return $this->createFrom($filtered); }
php
public function matching(Criteria $criteria) { $expr = $criteria->getWhereExpression(); $filtered = $this->getElements(); if ($expr) { $visitor = new ObjectExpressionVisitor(); $filter = $visitor->dispatch($expr); $filtered = array_filter($filtered, $filter); } if ($orderings = $criteria->getOrderings()) { $next = null; /** * @var string $field * @var string $ordering */ foreach (array_reverse($orderings) as $field => $ordering) { $next = ObjectExpressionVisitor::sortByField($field, $ordering === Criteria::DESC ? -1 : 1, $next); } if ($next) { uasort($filtered, $next); } } $offset = $criteria->getFirstResult(); $length = $criteria->getMaxResults(); if ($offset || $length) { $filtered = \array_slice($filtered, (int)$offset, $length); } return $this->createFrom($filtered); }
[ "public", "function", "matching", "(", "Criteria", "$", "criteria", ")", "{", "$", "expr", "=", "$", "criteria", "->", "getWhereExpression", "(", ")", ";", "$", "filtered", "=", "$", "this", "->", "getElements", "(", ")", ";", "if", "(", "$", "expr", ...
{@inheritDoc}
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/ObjectCollection.php#L67-L101
train
Get the elements matching the criteria
[ 30522, 2270, 3853, 9844, 1006, 9181, 1002, 9181, 1007, 1063, 1002, 4654, 18098, 1027, 1002, 9181, 1011, 1028, 2131, 2860, 5886, 4402, 2595, 20110, 3258, 1006, 1007, 1025, 1002, 21839, 1027, 1002, 2023, 1011, 1028, 2131, 12260, 8163, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Filesystem/FilesystemManager.php
FilesystemManager.formatS3Config
protected function formatS3Config(array $config) { $config += ['version' => 'latest']; if ($config['key'] && $config['secret']) { $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); } return $config; }
php
protected function formatS3Config(array $config) { $config += ['version' => 'latest']; if ($config['key'] && $config['secret']) { $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); } return $config; }
[ "protected", "function", "formatS3Config", "(", "array", "$", "config", ")", "{", "$", "config", "+=", "[", "'version'", "=>", "'latest'", "]", ";", "if", "(", "$", "config", "[", "'key'", "]", "&&", "$", "config", "[", "'secret'", "]", ")", "{", "$"...
Format the given S3 configuration with the default options. @param array $config @return array
[ "Format", "the", "given", "S3", "configuration", "with", "the", "default", "options", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemManager.php#L218-L227
train
Formats the S3 config array.
[ 30522, 5123, 3853, 11630, 2509, 8663, 8873, 2290, 1006, 9140, 1002, 9530, 8873, 2290, 1007, 1063, 1002, 9530, 8873, 2290, 1009, 1027, 1031, 1005, 2544, 1005, 1027, 1028, 1005, 6745, 1005, 1033, 1025, 2065, 1006, 1002, 9530, 8873, 2290, 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...
opencart/opencart
upload/catalog/controller/event/activity.php
ControllerEventActivity.addReturn
public function addReturn(&$route, &$args, &$output) { if ($this->config->get('config_customer_activity') && $output) { $this->load->model('account/activity'); if ($this->customer->isLogged()) { $activity_data = array( 'customer_id' => $this->customer->getId(), 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(), 'return_id' => $output ); $this->model_account_activity->addActivity('return_account', $activity_data); } else { $activity_data = array( 'name' => $args[0]['firstname'] . ' ' . $args[0]['lastname'], 'return_id' => $output ); $this->model_account_activity->addActivity('return_guest', $activity_data); } } }
php
public function addReturn(&$route, &$args, &$output) { if ($this->config->get('config_customer_activity') && $output) { $this->load->model('account/activity'); if ($this->customer->isLogged()) { $activity_data = array( 'customer_id' => $this->customer->getId(), 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(), 'return_id' => $output ); $this->model_account_activity->addActivity('return_account', $activity_data); } else { $activity_data = array( 'name' => $args[0]['firstname'] . ' ' . $args[0]['lastname'], 'return_id' => $output ); $this->model_account_activity->addActivity('return_guest', $activity_data); } } }
[ "public", "function", "addReturn", "(", "&", "$", "route", ",", "&", "$", "args", ",", "&", "$", "output", ")", "{", "if", "(", "$", "this", "->", "config", "->", "get", "(", "'config_customer_activity'", ")", "&&", "$", "output", ")", "{", "$", "t...
catalog/model/account/return/addReturn/after
[ "catalog", "/", "model", "/", "account", "/", "return", "/", "addReturn", "/", "after" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/catalog/controller/event/activity.php#L189-L210
train
Add Return to Account
[ 30522, 2270, 3853, 5587, 13465, 14287, 1006, 1004, 1002, 2799, 1010, 1004, 1002, 12098, 5620, 1010, 1004, 1002, 6434, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 9530, 8873, 2290, 1011, 1028, 2131, 1006, 1005, 9530, 8873, 2290, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreHome/DataTableRowAction/RowEvolution.php
RowEvolution.getSparkline
protected function getSparkline($metric) { // sparkline is always echoed, so we need to buffer the output $view = $this->getRowEvolutionGraph($graphType = 'sparkline', $metrics = array($metric => $metric)); ob_start(); $view->render(); $spark = ob_get_contents(); ob_end_clean(); // undo header change by sparkline renderer Common::sendHeader('Content-type: text/html'); // base64 encode the image and put it in an img tag $spark = base64_encode($spark); return '<img width="100" height="25" src="data:image/png;base64,' . $spark . '" />'; }
php
protected function getSparkline($metric) { // sparkline is always echoed, so we need to buffer the output $view = $this->getRowEvolutionGraph($graphType = 'sparkline', $metrics = array($metric => $metric)); ob_start(); $view->render(); $spark = ob_get_contents(); ob_end_clean(); // undo header change by sparkline renderer Common::sendHeader('Content-type: text/html'); // base64 encode the image and put it in an img tag $spark = base64_encode($spark); return '<img width="100" height="25" src="data:image/png;base64,' . $spark . '" />'; }
[ "protected", "function", "getSparkline", "(", "$", "metric", ")", "{", "// sparkline is always echoed, so we need to buffer the output", "$", "view", "=", "$", "this", "->", "getRowEvolutionGraph", "(", "$", "graphType", "=", "'sparkline'", ",", "$", "metrics", "=", ...
Get the img tag for a sparkline showing a single metric
[ "Get", "the", "img", "tag", "for", "a", "sparkline", "showing", "a", "single", "metric" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/DataTableRowAction/RowEvolution.php#L302-L318
train
Returns the sparkline of the metric
[ 30522, 5123, 3853, 4152, 14432, 4179, 1006, 1002, 12046, 1007, 1063, 1013, 1013, 12125, 4179, 2003, 2467, 10187, 1010, 2061, 2057, 2342, 2000, 17698, 30524, 1025, 1002, 3193, 1011, 1028, 17552, 1006, 1007, 1025, 1002, 12125, 1027, 27885, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Abstract.php
Zend_Db_Adapter_Abstract.quoteInto
public function quoteInto($text, $value, $type = null, $count = null) { if ($count === null) { return str_replace('?', $this->quote($value, $type), $text); } else { while ($count > 0) { if (strpos($text, '?') !== false) { $text = substr_replace($text, $this->quote($value, $type), strpos($text, '?'), 1); } --$count; } return $text; } }
php
public function quoteInto($text, $value, $type = null, $count = null) { if ($count === null) { return str_replace('?', $this->quote($value, $type), $text); } else { while ($count > 0) { if (strpos($text, '?') !== false) { $text = substr_replace($text, $this->quote($value, $type), strpos($text, '?'), 1); } --$count; } return $text; } }
[ "public", "function", "quoteInto", "(", "$", "text", ",", "$", "value", ",", "$", "type", "=", "null", ",", "$", "count", "=", "null", ")", "{", "if", "(", "$", "count", "===", "null", ")", "{", "return", "str_replace", "(", "'?'", ",", "$", "thi...
Quotes a value and places into a piece of text at a placeholder. The placeholder is a question-mark; all placeholders will be replaced with the quoted value. For example: <code> $text = "WHERE date < ?"; $date = "2005-01-02"; $safe = $sql->quoteInto($text, $date); // $safe = "WHERE date < '2005-01-02'" </code> @param string $text The text with a placeholder. @param mixed $value The value to quote. @param string $type OPTIONAL SQL datatype @param integer $count OPTIONAL count of placeholders to replace @return string An SQL-safe quoted value placed into the original text.
[ "Quotes", "a", "value", "and", "places", "into", "a", "piece", "of", "text", "at", "a", "placeholder", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Abstract.php#L927-L940
train
Quote into a string
[ 30522, 2270, 3853, 14686, 18447, 2080, 1006, 1002, 3793, 1010, 1002, 3643, 1010, 1002, 2828, 1027, 19701, 1010, 1002, 4175, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 4175, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 2358, 2099, 1035, 5672, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Access/Gate.php
Gate.methodAllowsGuests
protected function methodAllowsGuests($class, $method) { try { $reflection = new ReflectionClass($class); $method = $reflection->getMethod($method); } catch (Exception $e) { return false; } if ($method) { $parameters = $method->getParameters(); return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); } return false; }
php
protected function methodAllowsGuests($class, $method) { try { $reflection = new ReflectionClass($class); $method = $reflection->getMethod($method); } catch (Exception $e) { return false; } if ($method) { $parameters = $method->getParameters(); return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); } return false; }
[ "protected", "function", "methodAllowsGuests", "(", "$", "class", ",", "$", "method", ")", "{", "try", "{", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "class", ")", ";", "$", "method", "=", "$", "reflection", "->", "getMethod", "(", "$",...
Determine if the given class method allows guests. @param string $class @param string $method @return bool
[ "Determine", "if", "the", "given", "class", "method", "allows", "guests", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L396-L413
train
Method allows guests
[ 30522, 5123, 3853, 4118, 8095, 15568, 22967, 3215, 1006, 1002, 2465, 1010, 1002, 4118, 1007, 1063, 3046, 1063, 1002, 9185, 1027, 2047, 9185, 26266, 1006, 1002, 2465, 1007, 1025, 1002, 4118, 1027, 1002, 9185, 1011, 1028, 2131, 11368, 6806, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Permission.php
Permission.deny
public static function deny($roles) { if (static::isAdministrator()) { return true; } if (Auth::guard('admin')->user()->inRoles($roles)) { static::error(); } }
php
public static function deny($roles) { if (static::isAdministrator()) { return true; } if (Auth::guard('admin')->user()->inRoles($roles)) { static::error(); } }
[ "public", "static", "function", "deny", "(", "$", "roles", ")", "{", "if", "(", "static", "::", "isAdministrator", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "Auth", "::", "guard", "(", "'admin'", ")", "->", "user", "(", ")", "->", ...
Roles denied to access. @param $roles @return true
[ "Roles", "denied", "to", "access", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Permission.php#L72-L81
train
Check if user is not in roles
[ 30522, 2270, 10763, 3853, 9772, 1006, 1002, 4395, 1007, 1063, 2065, 1006, 10763, 1024, 1024, 18061, 22117, 5498, 20528, 4263, 1006, 1007, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 8740, 2705, 1024, 1024, 3457, 1006, 1005, 4748, 10020,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Config.php
Config.getHostname
public static function getHostname() { // Check trusted requires config file which is not ready yet $host = Url::getHost($checkIfTrusted = false); // Remove any port number to get actual hostname $host = Url::getHostSanitized($host); return $host; }
php
public static function getHostname() { // Check trusted requires config file which is not ready yet $host = Url::getHost($checkIfTrusted = false); // Remove any port number to get actual hostname $host = Url::getHostSanitized($host); return $host; }
[ "public", "static", "function", "getHostname", "(", ")", "{", "// Check trusted requires config file which is not ready yet", "$", "host", "=", "Url", "::", "getHost", "(", "$", "checkIfTrusted", "=", "false", ")", ";", "// Remove any port number to get actual hostname", ...
Returns the hostname of the current request (without port number) @return string
[ "Returns", "the", "hostname", "of", "the", "current", "request", "(", "without", "port", "number", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Config.php#L222-L231
train
Get hostname of current domain
[ 30522, 2270, 10763, 3853, 2131, 15006, 2102, 18442, 1006, 1007, 1063, 1013, 1013, 4638, 9480, 5942, 9530, 8873, 2290, 5371, 2029, 2003, 2025, 3201, 2664, 1002, 3677, 1027, 24471, 2140, 1024, 1024, 2131, 15006, 2102, 1006, 1002, 4638, 10128,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ServiceProvider.php
ServiceProvider.registerConsole
protected function registerConsole() { /* * Allow plugins to use the scheduler */ Event::listen('console.schedule', function ($schedule) { $plugins = PluginManager::instance()->getPlugins(); foreach ($plugins as $plugin) { if (method_exists($plugin, 'registerSchedule')) { $plugin->registerSchedule($schedule); } } }); /* * Add CMS based cache clearing to native command */ Event::listen('cache:cleared', function () { \System\Helpers\Cache::clearInternal(); }); /* * Register console commands */ $this->registerConsoleCommand('october.up', 'System\Console\OctoberUp'); $this->registerConsoleCommand('october.down', 'System\Console\OctoberDown'); $this->registerConsoleCommand('october.update', 'System\Console\OctoberUpdate'); $this->registerConsoleCommand('october.util', 'System\Console\OctoberUtil'); $this->registerConsoleCommand('october.mirror', 'System\Console\OctoberMirror'); $this->registerConsoleCommand('october.fresh', 'System\Console\OctoberFresh'); $this->registerConsoleCommand('october.env', 'System\Console\OctoberEnv'); $this->registerConsoleCommand('october.install', 'System\Console\OctoberInstall'); $this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall'); $this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove'); $this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh'); $this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall'); $this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove'); $this->registerConsoleCommand('theme.list', 'System\Console\ThemeList'); $this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse'); }
php
protected function registerConsole() { /* * Allow plugins to use the scheduler */ Event::listen('console.schedule', function ($schedule) { $plugins = PluginManager::instance()->getPlugins(); foreach ($plugins as $plugin) { if (method_exists($plugin, 'registerSchedule')) { $plugin->registerSchedule($schedule); } } }); /* * Add CMS based cache clearing to native command */ Event::listen('cache:cleared', function () { \System\Helpers\Cache::clearInternal(); }); /* * Register console commands */ $this->registerConsoleCommand('october.up', 'System\Console\OctoberUp'); $this->registerConsoleCommand('october.down', 'System\Console\OctoberDown'); $this->registerConsoleCommand('october.update', 'System\Console\OctoberUpdate'); $this->registerConsoleCommand('october.util', 'System\Console\OctoberUtil'); $this->registerConsoleCommand('october.mirror', 'System\Console\OctoberMirror'); $this->registerConsoleCommand('october.fresh', 'System\Console\OctoberFresh'); $this->registerConsoleCommand('october.env', 'System\Console\OctoberEnv'); $this->registerConsoleCommand('october.install', 'System\Console\OctoberInstall'); $this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall'); $this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove'); $this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh'); $this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall'); $this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove'); $this->registerConsoleCommand('theme.list', 'System\Console\ThemeList'); $this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse'); }
[ "protected", "function", "registerConsole", "(", ")", "{", "/*\n * Allow plugins to use the scheduler\n */", "Event", "::", "listen", "(", "'console.schedule'", ",", "function", "(", "$", "schedule", ")", "{", "$", "plugins", "=", "PluginManager", "::", ...
Register command line specifics
[ "Register", "command", "line", "specifics" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/ServiceProvider.php#L206-L247
train
Register console commands
[ 30522, 5123, 3853, 4236, 8663, 19454, 2063, 1006, 1007, 1063, 1013, 1008, 1008, 3499, 13354, 7076, 2000, 2224, 1996, 6134, 2099, 1008, 1013, 2724, 1024, 1024, 4952, 1006, 1005, 10122, 1012, 6134, 1005, 1010, 3853, 1006, 30524, 1063, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/RoutingServiceProvider.php
RoutingServiceProvider.registerResponseFactory
protected function registerResponseFactory() { $this->app->singleton(ResponseFactoryContract::class, function ($app) { return new ResponseFactory($app[ViewFactoryContract::class], $app['redirect']); }); }
php
protected function registerResponseFactory() { $this->app->singleton(ResponseFactoryContract::class, function ($app) { return new ResponseFactory($app[ViewFactoryContract::class], $app['redirect']); }); }
[ "protected", "function", "registerResponseFactory", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "ResponseFactoryContract", "::", "class", ",", "function", "(", "$", "app", ")", "{", "return", "new", "ResponseFactory", "(", "$", "app", "[...
Register the response factory implementation. @return void
[ "Register", "the", "response", "factory", "implementation", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RoutingServiceProvider.php#L149-L154
train
Register Response Factory
[ 30522, 5123, 3853, 4236, 6072, 26029, 20106, 18908, 10253, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 28159, 1006, 3433, 21450, 8663, 6494, 6593, 1024, 1024, 2465, 1010, 3853, 1006, 1002, 10439, 1007, 1063, 2709, 2047, 343...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Response.php
Response.get
public static function get($uri = '', $options = [], $callback = null) { if (!self::isCurlAvailable() && !self::isFopenAvailable()) { throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available'); } // check if this function is available, if so use it to stop any timeouts try { if (function_exists('set_time_limit') && !Utils::isFunctionDisabled('set_time_limit')) { set_time_limit(0); } } catch (\Exception $e) { } $config = Grav::instance()['config']; $overrides = []; // Override CA Bundle $caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath(); if (is_dir($caPathOrFile) || (is_link($caPathOrFile) && is_dir(readlink($caPathOrFile)))) { $overrides['curl'][CURLOPT_CAPATH] = $caPathOrFile; $overrides['fopen']['ssl']['capath'] = $caPathOrFile; } else { $overrides['curl'][CURLOPT_CAINFO] = $caPathOrFile; $overrides['fopen']['ssl']['cafile'] = $caPathOrFile; } // SSL Verify Peer and Proxy Setting $settings = [ 'method' => $config->get('system.gpm.method', self::$method), 'verify_peer' => $config->get('system.gpm.verify_peer', true), // `system.proxy_url` is for fallback // introduced with 1.1.0-beta.1 probably safe to remove at some point 'proxy_url' => $config->get('system.gpm.proxy_url', $config->get('system.proxy_url', false)), ]; if (!$settings['verify_peer']) { $overrides = array_replace_recursive([], $overrides, [ 'curl' => [ CURLOPT_SSL_VERIFYPEER => $settings['verify_peer'] ], 'fopen' => [ 'ssl' => [ 'verify_peer' => $settings['verify_peer'], 'verify_peer_name' => $settings['verify_peer'], ] ] ]); } // Proxy Setting if ($settings['proxy_url']) { $proxy = parse_url($settings['proxy_url']); $fopen_proxy = ($proxy['scheme'] ?: 'http') . '://' . $proxy['host'] . (isset($proxy['port']) ? ':' . $proxy['port'] : ''); $overrides = array_replace_recursive([], $overrides, [ 'curl' => [ CURLOPT_PROXY => $proxy['host'], CURLOPT_PROXYTYPE => 'HTTP' ], 'fopen' => [ 'proxy' => $fopen_proxy, 'request_fulluri' => true ] ]); if (isset($proxy['port'])) { $overrides['curl'][CURLOPT_PROXYPORT] = $proxy['port']; } if (isset($proxy['user'], $proxy['pass'])) { $fopen_auth = $auth = base64_encode($proxy['user'] . ':' . $proxy['pass']); $overrides['curl'][CURLOPT_PROXYUSERPWD] = $proxy['user'] . ':' . $proxy['pass']; $overrides['fopen']['header'] = "Proxy-Authorization: Basic $fopen_auth"; } } $options = array_replace_recursive(self::$defaults, $options, $overrides); $method = 'get' . ucfirst(strtolower($settings['method'])); self::$callback = $callback; return static::$method($uri, $options, $callback); }
php
public static function get($uri = '', $options = [], $callback = null) { if (!self::isCurlAvailable() && !self::isFopenAvailable()) { throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available'); } // check if this function is available, if so use it to stop any timeouts try { if (function_exists('set_time_limit') && !Utils::isFunctionDisabled('set_time_limit')) { set_time_limit(0); } } catch (\Exception $e) { } $config = Grav::instance()['config']; $overrides = []; // Override CA Bundle $caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath(); if (is_dir($caPathOrFile) || (is_link($caPathOrFile) && is_dir(readlink($caPathOrFile)))) { $overrides['curl'][CURLOPT_CAPATH] = $caPathOrFile; $overrides['fopen']['ssl']['capath'] = $caPathOrFile; } else { $overrides['curl'][CURLOPT_CAINFO] = $caPathOrFile; $overrides['fopen']['ssl']['cafile'] = $caPathOrFile; } // SSL Verify Peer and Proxy Setting $settings = [ 'method' => $config->get('system.gpm.method', self::$method), 'verify_peer' => $config->get('system.gpm.verify_peer', true), // `system.proxy_url` is for fallback // introduced with 1.1.0-beta.1 probably safe to remove at some point 'proxy_url' => $config->get('system.gpm.proxy_url', $config->get('system.proxy_url', false)), ]; if (!$settings['verify_peer']) { $overrides = array_replace_recursive([], $overrides, [ 'curl' => [ CURLOPT_SSL_VERIFYPEER => $settings['verify_peer'] ], 'fopen' => [ 'ssl' => [ 'verify_peer' => $settings['verify_peer'], 'verify_peer_name' => $settings['verify_peer'], ] ] ]); } // Proxy Setting if ($settings['proxy_url']) { $proxy = parse_url($settings['proxy_url']); $fopen_proxy = ($proxy['scheme'] ?: 'http') . '://' . $proxy['host'] . (isset($proxy['port']) ? ':' . $proxy['port'] : ''); $overrides = array_replace_recursive([], $overrides, [ 'curl' => [ CURLOPT_PROXY => $proxy['host'], CURLOPT_PROXYTYPE => 'HTTP' ], 'fopen' => [ 'proxy' => $fopen_proxy, 'request_fulluri' => true ] ]); if (isset($proxy['port'])) { $overrides['curl'][CURLOPT_PROXYPORT] = $proxy['port']; } if (isset($proxy['user'], $proxy['pass'])) { $fopen_auth = $auth = base64_encode($proxy['user'] . ':' . $proxy['pass']); $overrides['curl'][CURLOPT_PROXYUSERPWD] = $proxy['user'] . ':' . $proxy['pass']; $overrides['fopen']['header'] = "Proxy-Authorization: Basic $fopen_auth"; } } $options = array_replace_recursive(self::$defaults, $options, $overrides); $method = 'get' . ucfirst(strtolower($settings['method'])); self::$callback = $callback; return static::$method($uri, $options, $callback); }
[ "public", "static", "function", "get", "(", "$", "uri", "=", "''", ",", "$", "options", "=", "[", "]", ",", "$", "callback", "=", "null", ")", "{", "if", "(", "!", "self", "::", "isCurlAvailable", "(", ")", "&&", "!", "self", "::", "isFopenAvailabl...
Makes a request to the URL by using the preferred method @param string $uri URL to call @param array $options An array of parameters for both `curl` and `fopen` @param callable $callback Either a function or callback in array notation @return string The response of the request
[ "Makes", "a", "request", "to", "the", "URL", "by", "using", "the", "preferred", "method" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Response.php#L99-L181
train
Get an HTTP request
[ 30522, 2270, 10763, 3853, 2131, 1006, 1002, 24471, 2072, 1027, 1005, 1005, 1010, 1002, 7047, 1027, 1031, 1033, 1010, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2969, 1024, 1024, 2003, 10841, 12190, 12462, 11733, 3468, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Simple/ArrayCache.php
ArrayCache.get
public function get($key, $default = null) { if (!\is_string($key) || !isset($this->expiries[$key])) { CacheItem::validateKey($key); } if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] > microtime(true) || !$this->delete($key))) { $this->values[$key] = null; return $default; } if (!$this->storeSerialized) { return $this->values[$key]; } $value = $this->unfreeze($key, $isHit); return $isHit ? $value : $default; }
php
public function get($key, $default = null) { if (!\is_string($key) || !isset($this->expiries[$key])) { CacheItem::validateKey($key); } if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] > microtime(true) || !$this->delete($key))) { $this->values[$key] = null; return $default; } if (!$this->storeSerialized) { return $this->values[$key]; } $value = $this->unfreeze($key, $isHit); return $isHit ? $value : $default; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "\\", "is_string", "(", "$", "key", ")", "||", "!", "isset", "(", "$", "this", "->", "expiries", "[", "$", "key", "]", ")", ")", "{", "C...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ArrayCache.php#L50-L66
train
Get value from 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, 1064, 1064, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 4654, 8197, 5134, 1031, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Sqlite.php
Zend_Cache_Backend_Sqlite._buildStructure
private function _buildStructure() { $this->_query('DROP INDEX tag_id_index'); $this->_query('DROP INDEX tag_name_index'); $this->_query('DROP INDEX cache_id_expire_index'); $this->_query('DROP TABLE version'); $this->_query('DROP TABLE cache'); $this->_query('DROP TABLE tag'); $this->_query('CREATE TABLE version (num INTEGER PRIMARY KEY)'); $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)'); $this->_query('CREATE TABLE tag (name TEXT, id TEXT)'); $this->_query('CREATE INDEX tag_id_index ON tag(id)'); $this->_query('CREATE INDEX tag_name_index ON tag(name)'); $this->_query('CREATE INDEX cache_id_expire_index ON cache(id, expire)'); $this->_query('INSERT INTO version (num) VALUES (1)'); }
php
private function _buildStructure() { $this->_query('DROP INDEX tag_id_index'); $this->_query('DROP INDEX tag_name_index'); $this->_query('DROP INDEX cache_id_expire_index'); $this->_query('DROP TABLE version'); $this->_query('DROP TABLE cache'); $this->_query('DROP TABLE tag'); $this->_query('CREATE TABLE version (num INTEGER PRIMARY KEY)'); $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)'); $this->_query('CREATE TABLE tag (name TEXT, id TEXT)'); $this->_query('CREATE INDEX tag_id_index ON tag(id)'); $this->_query('CREATE INDEX tag_name_index ON tag(name)'); $this->_query('CREATE INDEX cache_id_expire_index ON cache(id, expire)'); $this->_query('INSERT INTO version (num) VALUES (1)'); }
[ "private", "function", "_buildStructure", "(", ")", "{", "$", "this", "->", "_query", "(", "'DROP INDEX tag_id_index'", ")", ";", "$", "this", "->", "_query", "(", "'DROP INDEX tag_name_index'", ")", ";", "$", "this", "->", "_query", "(", "'DROP INDEX cache_id_e...
Build the database structure @return false
[ "Build", "the", "database", "structure" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L559-L574
train
Builds the structure of the structure
[ 30522, 2797, 3853, 1035, 16473, 18300, 5397, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 23032, 1006, 1005, 4530, 5950, 6415, 1035, 8909, 1035, 5950, 1005, 1007, 1025, 1002, 2023, 1011, 1028, 1035, 23032, 1006, 1005, 4530, 5950, 6415, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php
ObjectExpressionVisitor.getObjectFieldValue
public static function getObjectFieldValue($object, $field) { $op = $value = null; $pos = strpos($field, '('); if (false !== $pos) { list ($op, $field) = explode('(', $field, 2); $field = rtrim($field, ')'); } if (isset($object[$field])) { $value = $object[$field]; } else { $accessors = array('', 'get', 'is'); foreach ($accessors as $accessor) { $accessor .= $field; if (!method_exists($object, $accessor)) { continue; } $value = $object->{$accessor}(); break; } } if ($op) { $function = 'filter' . ucfirst(strtolower($op)); if (method_exists(static::class, $function)) { $value = static::$function($value); } } return $value; }
php
public static function getObjectFieldValue($object, $field) { $op = $value = null; $pos = strpos($field, '('); if (false !== $pos) { list ($op, $field) = explode('(', $field, 2); $field = rtrim($field, ')'); } if (isset($object[$field])) { $value = $object[$field]; } else { $accessors = array('', 'get', 'is'); foreach ($accessors as $accessor) { $accessor .= $field; if (!method_exists($object, $accessor)) { continue; } $value = $object->{$accessor}(); break; } } if ($op) { $function = 'filter' . ucfirst(strtolower($op)); if (method_exists(static::class, $function)) { $value = static::$function($value); } } return $value; }
[ "public", "static", "function", "getObjectFieldValue", "(", "$", "object", ",", "$", "field", ")", "{", "$", "op", "=", "$", "value", "=", "null", ";", "$", "pos", "=", "strpos", "(", "$", "field", ",", "'('", ")", ";", "if", "(", "false", "!==", ...
Accesses the field of a given object. @param object $object @param string $field @return mixed
[ "Accesses", "the", "field", "of", "a", "given", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php#L25-L60
train
Get the value of a field in an object
[ 30522, 2270, 10763, 3853, 2131, 16429, 20614, 3790, 10175, 5657, 1006, 1002, 4874, 1010, 1002, 2492, 1007, 1063, 1002, 6728, 1027, 1002, 3643, 1027, 19701, 1025, 1002, 13433, 2015, 1027, 2358, 14536, 2891, 1006, 1002, 2492, 1010, 1005, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Profiler.php
Zend_Db_Profiler.queryStart
public function queryStart($queryText, $queryType = null) { if (!$this->_enabled) { return null; } // make sure we have a query type if (null === $queryType) { switch (strtolower(substr(ltrim($queryText), 0, 6))) { case 'insert': $queryType = self::INSERT; break; case 'update': $queryType = self::UPDATE; break; case 'delete': $queryType = self::DELETE; break; case 'select': $queryType = self::SELECT; break; default: $queryType = self::QUERY; break; } } /** * @see Zend_Db_Profiler_Query */ // require_once 'Zend/Db/Profiler/Query.php'; $this->_queryProfiles[] = new Zend_Db_Profiler_Query($queryText, $queryType); end($this->_queryProfiles); return key($this->_queryProfiles); }
php
public function queryStart($queryText, $queryType = null) { if (!$this->_enabled) { return null; } // make sure we have a query type if (null === $queryType) { switch (strtolower(substr(ltrim($queryText), 0, 6))) { case 'insert': $queryType = self::INSERT; break; case 'update': $queryType = self::UPDATE; break; case 'delete': $queryType = self::DELETE; break; case 'select': $queryType = self::SELECT; break; default: $queryType = self::QUERY; break; } } /** * @see Zend_Db_Profiler_Query */ // require_once 'Zend/Db/Profiler/Query.php'; $this->_queryProfiles[] = new Zend_Db_Profiler_Query($queryText, $queryType); end($this->_queryProfiles); return key($this->_queryProfiles); }
[ "public", "function", "queryStart", "(", "$", "queryText", ",", "$", "queryType", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_enabled", ")", "{", "return", "null", ";", "}", "// make sure we have a query type", "if", "(", "null", "===", "...
Starts a query. Creates a new query profile object (Zend_Db_Profiler_Query) and returns the "query profiler handle". Run the query, then call queryEnd() and pass it this handle to make the query as ended and record the time. If the profiler is not enabled, this takes no action and immediately returns null. @param string $queryText SQL statement @param integer $queryType OPTIONAL Type of query, one of the Zend_Db_Profiler::* constants @return integer|null
[ "Starts", "a", "query", ".", "Creates", "a", "new", "query", "profile", "object", "(", "Zend_Db_Profiler_Query", ")", "and", "returns", "the", "query", "profiler", "handle", ".", "Run", "the", "query", "then", "call", "queryEnd", "()", "and", "pass", "it", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Profiler.php#L251-L287
train
Start a new query
[ 30522, 2270, 3853, 23032, 14117, 2102, 1006, 1002, 23032, 18209, 1010, 1002, 23032, 13874, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 9124, 1007, 1063, 2709, 19701, 1025, 1065, 1013, 1013, 2191, 2469, 2057, 2031...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Http/Request.php
Request.getParsedBodyParam
public function getParsedBodyParam($key, $default = null) { $postParams = $this->getParsedBody(); $result = $default; if (is_array($postParams) && isset($postParams[$key])) { $result = $postParams[$key]; } elseif (is_object($postParams) && property_exists($postParams, $key)) { $result = $postParams->$key; } return $result; }
php
public function getParsedBodyParam($key, $default = null) { $postParams = $this->getParsedBody(); $result = $default; if (is_array($postParams) && isset($postParams[$key])) { $result = $postParams[$key]; } elseif (is_object($postParams) && property_exists($postParams, $key)) { $result = $postParams->$key; } return $result; }
[ "public", "function", "getParsedBodyParam", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "$", "postParams", "=", "$", "this", "->", "getParsedBody", "(", ")", ";", "$", "result", "=", "$", "default", ";", "if", "(", "is_array", "(", "...
Fetch parameter value from request body. Note: This method is not part of the PSR-7 standard. @param string $key @param mixed $default @return mixed
[ "Fetch", "parameter", "value", "from", "request", "body", "." ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Request.php#L1148-L1159
train
Get Parsed Body Param
[ 30522, 2270, 3853, 2131, 19362, 6924, 23684, 28689, 2213, 1006, 1002, 3145, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 1002, 2695, 28689, 5244, 1027, 1002, 2023, 1011, 1028, 2131, 19362, 6924, 23684, 1006, 1007, 1025, 1002, 2765, 1027, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserId/Archiver.php
Archiver.aggregateUsers
protected function aggregateUsers() { $userIdFieldName = self::USER_ID_FIELD; $visitorIdFieldName = self::VISITOR_ID_FIELD; /** @var \Zend_Db_Statement $query */ $query = $this->getLogAggregator()->queryVisitsByDimension( array(self::USER_ID_FIELD), "log_visit.$userIdFieldName IS NOT NULL AND log_visit.$userIdFieldName != ''", array("LOWER(HEX($visitorIdFieldName)) as $visitorIdFieldName") ); if ($query === false) { return; } $rowsCount = 0; while ($row = $query->fetch()) { $rowsCount++; $this->arrays->sumMetricsVisits($row[$userIdFieldName], $row); $this->rememberVisitorId($row); } }
php
protected function aggregateUsers() { $userIdFieldName = self::USER_ID_FIELD; $visitorIdFieldName = self::VISITOR_ID_FIELD; /** @var \Zend_Db_Statement $query */ $query = $this->getLogAggregator()->queryVisitsByDimension( array(self::USER_ID_FIELD), "log_visit.$userIdFieldName IS NOT NULL AND log_visit.$userIdFieldName != ''", array("LOWER(HEX($visitorIdFieldName)) as $visitorIdFieldName") ); if ($query === false) { return; } $rowsCount = 0; while ($row = $query->fetch()) { $rowsCount++; $this->arrays->sumMetricsVisits($row[$userIdFieldName], $row); $this->rememberVisitorId($row); } }
[ "protected", "function", "aggregateUsers", "(", ")", "{", "$", "userIdFieldName", "=", "self", "::", "USER_ID_FIELD", ";", "$", "visitorIdFieldName", "=", "self", "::", "VISITOR_ID_FIELD", ";", "/** @var \\Zend_Db_Statement $query */", "$", "query", "=", "$", "this"...
Used to aggregate daily data per user ID
[ "Used", "to", "aggregate", "daily", "data", "per", "user", "ID" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserId/Archiver.php#L75-L97
train
Aggregate visits by dimension
[ 30522, 5123, 3853, 9572, 20330, 2015, 1006, 1007, 1063, 1002, 5310, 3593, 3790, 18442, 1027, 2969, 1024, 1024, 5310, 1035, 8909, 1035, 2492, 1025, 1002, 10367, 3593, 3790, 18442, 1027, 2969, 1024, 1024, 10367, 1035, 8909, 1035, 2492, 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/Intl/DateFormatter/DateFormat/DayOfWeekTransformer.php
DayOfWeekTransformer.format
public function format(\DateTime $dateTime, int $length): string { $dayOfWeek = $dateTime->format('l'); switch ($length) { case 4: return $dayOfWeek; case 5: return $dayOfWeek[0]; case 6: return substr($dayOfWeek, 0, 2); default: return substr($dayOfWeek, 0, 3); } }
php
public function format(\DateTime $dateTime, int $length): string { $dayOfWeek = $dateTime->format('l'); switch ($length) { case 4: return $dayOfWeek; case 5: return $dayOfWeek[0]; case 6: return substr($dayOfWeek, 0, 2); default: return substr($dayOfWeek, 0, 3); } }
[ "public", "function", "format", "(", "\\", "DateTime", "$", "dateTime", ",", "int", "$", "length", ")", ":", "string", "{", "$", "dayOfWeek", "=", "$", "dateTime", "->", "format", "(", "'l'", ")", ";", "switch", "(", "$", "length", ")", "{", "case", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/DayOfWeekTransformer.php#L26-L39
train
Returns the day of the week
[ 30522, 2270, 3853, 4289, 1006, 1032, 3058, 7292, 1002, 3058, 7292, 1010, 20014, 1002, 3091, 1007, 1024, 5164, 1063, 1002, 2154, 11253, 28075, 1027, 1002, 3058, 7292, 1011, 1028, 4289, 1006, 1005, 1048, 1005, 1007, 1025, 6942, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Row.php
Row.column
public function column($name, $value = null) { if (is_null($value)) { $column = Arr::get($this->data, $name); return $this->output($column); } if ($value instanceof Closure) { $value = $value->call($this, $this->column($name)); } Arr::set($this->data, $name, $value); return $this; }
php
public function column($name, $value = null) { if (is_null($value)) { $column = Arr::get($this->data, $name); return $this->output($column); } if ($value instanceof Closure) { $value = $value->call($this, $this->column($name)); } Arr::set($this->data, $name, $value); return $this; }
[ "public", "function", "column", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "$", "column", "=", "Arr", "::", "get", "(", "$", "this", "->", "data", ",", "$", "name", ")", ...
Get or set value of column in this row. @param string $name @param mixed $value @return $this|mixed
[ "Get", "or", "set", "value", "of", "column", "in", "this", "row", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Row.php#L158-L173
train
Set a column value
[ 30522, 2270, 3853, 5930, 1006, 1002, 2171, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 3643, 1007, 1007, 1063, 1002, 5930, 1027, 12098, 2099, 1024, 1024, 2131, 1006, 1002, 2023, 1011, 1028, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Finder/Iterator/ExcludeDirectoryFilterIterator.php
ExcludeDirectoryFilterIterator.accept
public function accept() { if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) { return false; } if ($this->excludedPattern) { $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); $path = str_replace('\\', '/', $path); return !preg_match($this->excludedPattern, $path); } return true; }
php
public function accept() { if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) { return false; } if ($this->excludedPattern) { $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); $path = str_replace('\\', '/', $path); return !preg_match($this->excludedPattern, $path); } return true; }
[ "public", "function", "accept", "(", ")", "{", "if", "(", "$", "this", "->", "isRecursive", "&&", "isset", "(", "$", "this", "->", "excludedDirs", "[", "$", "this", "->", "getFilename", "(", ")", "]", ")", "&&", "$", "this", "->", "isDir", "(", ")"...
Filters the iterator values. @return bool True if the value should be kept, false otherwise
[ "Filters", "the", "iterator", "values", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php#L55-L69
train
Accept a file
[ 30522, 2270, 3853, 5138, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 2890, 10841, 2869, 3512, 1004, 1004, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 12421, 4305, 2869, 1031, 1002, 2023, 1011, 1028, 2131, 8873, 20844, 4168, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.untranslatedLanguages
public function untranslatedLanguages($includeUnpublished = false) { $filename = substr($this->name, 0, -strlen($this->extension())); $config = Grav::instance()['config']; $languages = $config->get('system.languages.supported', []); $untranslatedLanguages = []; foreach ($languages as $language) { $path = $this->path . DS . $this->folder . DS . $filename . '.' . $language . '.md'; if (file_exists($path)) { $aPage = new Page(); $aPage->init(new \SplFileInfo($path), $language . '.md'); if ($includeUnpublished && !$aPage->published()) { $untranslatedLanguages[] = $language; } } else { $untranslatedLanguages[] = $language; } } return $untranslatedLanguages; }
php
public function untranslatedLanguages($includeUnpublished = false) { $filename = substr($this->name, 0, -strlen($this->extension())); $config = Grav::instance()['config']; $languages = $config->get('system.languages.supported', []); $untranslatedLanguages = []; foreach ($languages as $language) { $path = $this->path . DS . $this->folder . DS . $filename . '.' . $language . '.md'; if (file_exists($path)) { $aPage = new Page(); $aPage->init(new \SplFileInfo($path), $language . '.md'); if ($includeUnpublished && !$aPage->published()) { $untranslatedLanguages[] = $language; } } else { $untranslatedLanguages[] = $language; } } return $untranslatedLanguages; }
[ "public", "function", "untranslatedLanguages", "(", "$", "includeUnpublished", "=", "false", ")", "{", "$", "filename", "=", "substr", "(", "$", "this", "->", "name", ",", "0", ",", "-", "strlen", "(", "$", "this", "->", "extension", "(", ")", ")", ")"...
Return an array listing untranslated languages available @param bool $includeUnpublished also list unpublished translations @return array the page untranslated languages
[ "Return", "an", "array", "listing", "untranslated", "languages", "available" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L225-L246
train
Get the list of languages that are not translated
[ 30522, 2270, 3853, 4895, 6494, 3619, 13776, 25023, 6692, 8449, 1006, 1002, 2421, 4609, 14289, 16558, 13295, 1027, 6270, 1007, 1063, 1002, 5371, 18442, 1027, 4942, 3367, 2099, 1006, 1002, 2023, 1011, 1028, 2171, 1010, 1014, 1010, 1011, 2358,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Referrers/Social.php
Social.getMainUrlFromName
public function getMainUrlFromName($social) { foreach ($this->getDefinitions() as $domain => $name) { if ($name == $social) { return $domain; } } return null; }
php
public function getMainUrlFromName($social) { foreach ($this->getDefinitions() as $domain => $name) { if ($name == $social) { return $domain; } } return null; }
[ "public", "function", "getMainUrlFromName", "(", "$", "social", ")", "{", "foreach", "(", "$", "this", "->", "getDefinitions", "(", ")", "as", "$", "domain", "=>", "$", "name", ")", "{", "if", "(", "$", "name", "==", "$", "social", ")", "{", "return"...
Returns the main url of the given social network @param string $social @return string
[ "Returns", "the", "main", "url", "of", "the", "given", "social", "network" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Social.php#L167-L177
train
Get main url from social name
[ 30522, 2270, 3853, 2131, 24238, 3126, 10270, 21716, 18442, 1006, 1002, 2591, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 3207, 16294, 22753, 2015, 1006, 1007, 2004, 1002, 5884, 1027, 1028, 1002, 2171, 1007, 1063, 2065, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/File.php
Zend_Cache_Backend_File._remove
protected function _remove($file) { if (!is_file($file)) { return false; } if (!@unlink($file)) { # we can't remove the file (because of locks or any problem) $this->_log("Zend_Cache_Backend_File::_remove() : we can't remove $file"); return false; } return true; }
php
protected function _remove($file) { if (!is_file($file)) { return false; } if (!@unlink($file)) { # we can't remove the file (because of locks or any problem) $this->_log("Zend_Cache_Backend_File::_remove() : we can't remove $file"); return false; } return true; }
[ "protected", "function", "_remove", "(", "$", "file", ")", "{", "if", "(", "!", "is_file", "(", "$", "file", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "@", "unlink", "(", "$", "file", ")", ")", "{", "# we can't remove the file (beca...
Remove a file If we can't remove the file (because of locks or any problem), we will touch the file to invalidate it @param string $file Complete file path @return boolean True if ok
[ "Remove", "a", "file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L610-L621
train
Remove a file
[ 30522, 5123, 3853, 1035, 6366, 1006, 1002, 5371, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5371, 1006, 1002, 5371, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 999, 1030, 4895, 13767, 1006, 1002, 5371, 1007, 1007, 1063, 1001, 2057...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Concurrency/DistributedList.php
DistributedList.add
public function add($item) { $allItems = $this->getAll(); if (is_array($item)) { $allItems = array_merge($allItems, $item); } else { $allItems[] = $item; } $this->setAll($allItems); }
php
public function add($item) { $allItems = $this->getAll(); if (is_array($item)) { $allItems = array_merge($allItems, $item); } else { $allItems[] = $item; } $this->setAll($allItems); }
[ "public", "function", "add", "(", "$", "item", ")", "{", "$", "allItems", "=", "$", "this", "->", "getAll", "(", ")", ";", "if", "(", "is_array", "(", "$", "item", ")", ")", "{", "$", "allItems", "=", "array_merge", "(", "$", "allItems", ",", "$"...
Adds one or more items to the list in the option table. @param string|array $item
[ "Adds", "one", "or", "more", "items", "to", "the", "list", "in", "the", "option", "table", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Concurrency/DistributedList.php#L95-L105
train
Add an item to the list of items in the language tree
[ 30522, 2270, 3853, 5587, 1006, 1002, 8875, 1007, 1063, 1002, 2035, 4221, 5244, 1027, 1002, 30524, 1002, 2035, 4221, 5244, 1010, 1002, 8875, 1007, 1025, 1065, 2842, 1063, 1002, 2035, 4221, 5244, 1031, 1033, 1027, 1002, 8875, 1025, 1065, 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/Db/Adapter/Pdo/Mysql.php
Mysql.getClientVersion
public function getClientVersion() { $this->_connect(); try { $version = $this->_connection->getAttribute(PDO::ATTR_CLIENT_VERSION); $matches = null; if (preg_match('/((?:[0-9]{1,2}\.){1,3}[0-9]{1,2})/', $version, $matches)) { return $matches[1]; } } catch (PDOException $e) { // In case of the driver doesn't support getting attributes } return null; }
php
public function getClientVersion() { $this->_connect(); try { $version = $this->_connection->getAttribute(PDO::ATTR_CLIENT_VERSION); $matches = null; if (preg_match('/((?:[0-9]{1,2}\.){1,3}[0-9]{1,2})/', $version, $matches)) { return $matches[1]; } } catch (PDOException $e) { // In case of the driver doesn't support getting attributes } return null; }
[ "public", "function", "getClientVersion", "(", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "try", "{", "$", "version", "=", "$", "this", "->", "_connection", "->", "getAttribute", "(", "PDO", "::", "ATTR_CLIENT_VERSION", ")", ";", "$", "match...
Retrieve client version in PHP style @return string
[ "Retrieve", "client", "version", "in", "PHP", "style" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Pdo/Mysql.php#L252-L265
train
Get the client version
[ 30522, 2270, 3853, 2131, 20464, 11638, 27774, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 3046, 1063, 1002, 2544, 1027, 1002, 2023, 1011, 1028, 1035, 4434, 1011, 1028, 2131, 19321, 3089, 8569, 2618, 1006, 22851, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
FullTransformer.calculateUnixTimestamp
protected function calculateUnixTimestamp(\DateTime $dateTime, array $options) { $options = $this->getDefaultValueForOptions($options); $year = $options['year']; $month = $options['month']; $day = $options['day']; $hour = $options['hour']; $hourInstance = $options['hourInstance']; $minute = $options['minute']; $second = $options['second']; $marker = $options['marker']; $timezone = $options['timezone']; // If month is false, return immediately (intl behavior) if (false === $month) { IntlGlobals::setError(IntlGlobals::U_PARSE_ERROR, 'Date parsing failed'); return false; } // Normalize hour if ($hourInstance instanceof HourTransformer) { $hour = $hourInstance->normalizeHour($hour, $marker); } // Set the timezone if different from the default one if (null !== $timezone && $timezone !== $this->timezone) { $dateTime->setTimezone(new \DateTimeZone($timezone)); } // Normalize yy year preg_match_all($this->regExp, $this->pattern, $matches); if (\in_array('yy', $matches[0])) { $dateTime->setTimestamp(time()); $year = $year > $dateTime->format('y') + 20 ? 1900 + $year : 2000 + $year; } $dateTime->setDate($year, $month, $day); $dateTime->setTime($hour, $minute, $second); return $dateTime->getTimestamp(); }
php
protected function calculateUnixTimestamp(\DateTime $dateTime, array $options) { $options = $this->getDefaultValueForOptions($options); $year = $options['year']; $month = $options['month']; $day = $options['day']; $hour = $options['hour']; $hourInstance = $options['hourInstance']; $minute = $options['minute']; $second = $options['second']; $marker = $options['marker']; $timezone = $options['timezone']; // If month is false, return immediately (intl behavior) if (false === $month) { IntlGlobals::setError(IntlGlobals::U_PARSE_ERROR, 'Date parsing failed'); return false; } // Normalize hour if ($hourInstance instanceof HourTransformer) { $hour = $hourInstance->normalizeHour($hour, $marker); } // Set the timezone if different from the default one if (null !== $timezone && $timezone !== $this->timezone) { $dateTime->setTimezone(new \DateTimeZone($timezone)); } // Normalize yy year preg_match_all($this->regExp, $this->pattern, $matches); if (\in_array('yy', $matches[0])) { $dateTime->setTimestamp(time()); $year = $year > $dateTime->format('y') + 20 ? 1900 + $year : 2000 + $year; } $dateTime->setDate($year, $month, $day); $dateTime->setTime($hour, $minute, $second); return $dateTime->getTimestamp(); }
[ "protected", "function", "calculateUnixTimestamp", "(", "\\", "DateTime", "$", "dateTime", ",", "array", "$", "options", ")", "{", "$", "options", "=", "$", "this", "->", "getDefaultValueForOptions", "(", "$", "options", ")", ";", "$", "year", "=", "$", "o...
Calculates the Unix timestamp based on the matched values by the reverse matching regular expression of parse(). @param \DateTime $dateTime The DateTime object to be used to calculate the timestamp @param array $options An array with the matched values to be used to calculate the timestamp @return bool|int The calculated timestamp or false if matched date is invalid
[ "Calculates", "the", "Unix", "timestamp", "based", "on", "the", "matched", "values", "by", "the", "reverse", "matching", "regular", "expression", "of", "parse", "()", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L283-L325
train
Calculates the unix timestamp
[ 30522, 5123, 3853, 18422, 19496, 18413, 14428, 9153, 8737, 1006, 1032, 3058, 7292, 1002, 3058, 7292, 1010, 9140, 1002, 7047, 1007, 1063, 1002, 7047, 1027, 1002, 2023, 1011, 1028, 2131, 3207, 7011, 11314, 10175, 5657, 29278, 7361, 9285, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Route.php
Route.middleware
public function middleware($middleware = null) { if (is_null($middleware)) { return (array) ($this->action['middleware'] ?? []); } if (is_string($middleware)) { $middleware = func_get_args(); } $this->action['middleware'] = array_merge( (array) ($this->action['middleware'] ?? []), $middleware ); return $this; }
php
public function middleware($middleware = null) { if (is_null($middleware)) { return (array) ($this->action['middleware'] ?? []); } if (is_string($middleware)) { $middleware = func_get_args(); } $this->action['middleware'] = array_merge( (array) ($this->action['middleware'] ?? []), $middleware ); return $this; }
[ "public", "function", "middleware", "(", "$", "middleware", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "middleware", ")", ")", "{", "return", "(", "array", ")", "(", "$", "this", "->", "action", "[", "'middleware'", "]", "??", "[", "]", ...
Get or set the middlewares attached to the route. @param array|string|null $middleware @return $this|array
[ "Get", "or", "set", "the", "middlewares", "attached", "to", "the", "route", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Route.php#L804-L819
train
Add middleware to the action array
[ 30522, 2270, 3853, 2690, 8059, 1006, 1002, 2690, 8059, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2690, 8059, 1007, 1007, 1063, 2709, 1006, 9140, 1007, 1006, 1002, 2023, 1011, 1028, 2895, 1031, 1005, 2690, 8059, 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...
php-ai/php-ml
src/Classification/Ensemble/RandomForest.php
RandomForest.setFeatureSubsetRatio
public function setFeatureSubsetRatio($ratio): self { if (!is_string($ratio) && !is_float($ratio)) { throw new InvalidArgumentException('Feature subset ratio must be a string or a float'); } if (is_float($ratio) && ($ratio < 0.1 || $ratio > 1.0)) { throw new InvalidArgumentException('When a float is given, feature subset ratio should be between 0.1 and 1.0'); } if (is_string($ratio) && $ratio !== 'sqrt' && $ratio !== 'log') { throw new InvalidArgumentException("When a string is given, feature subset ratio can only be 'sqrt' or 'log'"); } $this->featureSubsetRatio = $ratio; return $this; }
php
public function setFeatureSubsetRatio($ratio): self { if (!is_string($ratio) && !is_float($ratio)) { throw new InvalidArgumentException('Feature subset ratio must be a string or a float'); } if (is_float($ratio) && ($ratio < 0.1 || $ratio > 1.0)) { throw new InvalidArgumentException('When a float is given, feature subset ratio should be between 0.1 and 1.0'); } if (is_string($ratio) && $ratio !== 'sqrt' && $ratio !== 'log') { throw new InvalidArgumentException("When a string is given, feature subset ratio can only be 'sqrt' or 'log'"); } $this->featureSubsetRatio = $ratio; return $this; }
[ "public", "function", "setFeatureSubsetRatio", "(", "$", "ratio", ")", ":", "self", "{", "if", "(", "!", "is_string", "(", "$", "ratio", ")", "&&", "!", "is_float", "(", "$", "ratio", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Feat...
This method is used to determine how many of the original columns (features) will be used to construct subsets to train base classifiers.<br> Allowed values: 'sqrt', 'log' or any float number between 0.1 and 1.0 <br> Default value for the ratio is 'log' which results in log(numFeatures, 2) + 1 features to be taken into consideration while selecting subspace of features @param mixed $ratio
[ "This", "method", "is", "used", "to", "determine", "how", "many", "of", "the", "original", "columns", "(", "features", ")", "will", "be", "used", "to", "construct", "subsets", "to", "train", "base", "classifiers", ".", "<br", ">" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Ensemble/RandomForest.php#L46-L63
train
Set Feature Subset Ratio
[ 30522, 2270, 3853, 2275, 7959, 4017, 14900, 12083, 13462, 8609, 3695, 1006, 1002, 6463, 1007, 1024, 2969, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 6463, 1007, 1004, 1004, 999, 2003, 1035, 14257, 1006, 1002, 6463, 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...
dompdf/dompdf
src/FrameReflower/Block.php
Block._calculate_restricted_height
protected function _calculate_restricted_height() { $frame = $this->_frame; $style = $frame->get_style(); $content_height = $this->_calculate_content_height(); $cb = $frame->get_containing_block(); $height = $style->length_in_pt($style->height, $cb["h"]); $top = $style->length_in_pt($style->top, $cb["h"]); $bottom = $style->length_in_pt($style->bottom, $cb["h"]); $margin_top = $style->length_in_pt($style->margin_top, $cb["h"]); $margin_bottom = $style->length_in_pt($style->margin_bottom, $cb["h"]); if ($frame->is_absolute()) { // see http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height $dims = array($top !== "auto" ? $top : 0, $style->margin_top !== "auto" ? $style->margin_top : 0, $style->padding_top, $style->border_top_width, $height !== "auto" ? $height : 0, $style->border_bottom_width, $style->padding_bottom, $style->margin_bottom !== "auto" ? $style->margin_bottom : 0, $bottom !== "auto" ? $bottom : 0); $sum = (float)$style->length_in_pt($dims, $cb["h"]); $diff = $cb["h"] - $sum; if ($diff > 0) { if ($height === "auto" && $top === "auto" && $bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $diff; } else if ($height === "auto" && $top === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $content_height; $top = $diff - $content_height; } else if ($height === "auto" && $bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $content_height; $bottom = $diff - $content_height; } else if ($top === "auto" && $bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $bottom = $diff; } else if ($top === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $top = $diff; } else if ($height === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $diff; } else if ($bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $bottom = $diff; } else { if ($style->overflow === "visible") { // set all autos to zero if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } if ($top === "auto") { $top = 0; } if ($bottom === "auto") { $bottom = 0; } if ($height === "auto") { $height = $content_height; } } // FIXME: overflow hidden } } } else { // Expand the height if overflow is visible if ($height === "auto" && $content_height > $height /* && $style->overflow === "visible" */) { $height = $content_height; } // FIXME: this should probably be moved to a seperate function as per // _calculate_restricted_width // Only handle min/max height if the height is independent of the frame's content if (!($style->overflow === "visible" || ($style->overflow === "hidden" && $height === "auto"))) { $min_height = $style->min_height; $max_height = $style->max_height; if (isset($cb["h"])) { $min_height = $style->length_in_pt($min_height, $cb["h"]); $max_height = $style->length_in_pt($max_height, $cb["h"]); } else if (isset($cb["w"])) { if (mb_strpos($min_height, "%") !== false) { $min_height = 0; } else { $min_height = $style->length_in_pt($min_height, $cb["w"]); } if (mb_strpos($max_height, "%") !== false) { $max_height = "none"; } else { $max_height = $style->length_in_pt($max_height, $cb["w"]); } } if ($max_height !== "none" && $min_height > $max_height) { // Swap 'em list($max_height, $min_height) = array($min_height, $max_height); } if ($max_height !== "none" && $height > $max_height) { $height = $max_height; } if ($height < $min_height) { $height = $min_height; } } } return array($height, $margin_top, $margin_bottom, $top, $bottom); }
php
protected function _calculate_restricted_height() { $frame = $this->_frame; $style = $frame->get_style(); $content_height = $this->_calculate_content_height(); $cb = $frame->get_containing_block(); $height = $style->length_in_pt($style->height, $cb["h"]); $top = $style->length_in_pt($style->top, $cb["h"]); $bottom = $style->length_in_pt($style->bottom, $cb["h"]); $margin_top = $style->length_in_pt($style->margin_top, $cb["h"]); $margin_bottom = $style->length_in_pt($style->margin_bottom, $cb["h"]); if ($frame->is_absolute()) { // see http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height $dims = array($top !== "auto" ? $top : 0, $style->margin_top !== "auto" ? $style->margin_top : 0, $style->padding_top, $style->border_top_width, $height !== "auto" ? $height : 0, $style->border_bottom_width, $style->padding_bottom, $style->margin_bottom !== "auto" ? $style->margin_bottom : 0, $bottom !== "auto" ? $bottom : 0); $sum = (float)$style->length_in_pt($dims, $cb["h"]); $diff = $cb["h"] - $sum; if ($diff > 0) { if ($height === "auto" && $top === "auto" && $bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $diff; } else if ($height === "auto" && $top === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $content_height; $top = $diff - $content_height; } else if ($height === "auto" && $bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $content_height; $bottom = $diff - $content_height; } else if ($top === "auto" && $bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $bottom = $diff; } else if ($top === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $top = $diff; } else if ($height === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $height = $diff; } else if ($bottom === "auto") { if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } $bottom = $diff; } else { if ($style->overflow === "visible") { // set all autos to zero if ($margin_top === "auto") { $margin_top = 0; } if ($margin_bottom === "auto") { $margin_bottom = 0; } if ($top === "auto") { $top = 0; } if ($bottom === "auto") { $bottom = 0; } if ($height === "auto") { $height = $content_height; } } // FIXME: overflow hidden } } } else { // Expand the height if overflow is visible if ($height === "auto" && $content_height > $height /* && $style->overflow === "visible" */) { $height = $content_height; } // FIXME: this should probably be moved to a seperate function as per // _calculate_restricted_width // Only handle min/max height if the height is independent of the frame's content if (!($style->overflow === "visible" || ($style->overflow === "hidden" && $height === "auto"))) { $min_height = $style->min_height; $max_height = $style->max_height; if (isset($cb["h"])) { $min_height = $style->length_in_pt($min_height, $cb["h"]); $max_height = $style->length_in_pt($max_height, $cb["h"]); } else if (isset($cb["w"])) { if (mb_strpos($min_height, "%") !== false) { $min_height = 0; } else { $min_height = $style->length_in_pt($min_height, $cb["w"]); } if (mb_strpos($max_height, "%") !== false) { $max_height = "none"; } else { $max_height = $style->length_in_pt($max_height, $cb["w"]); } } if ($max_height !== "none" && $min_height > $max_height) { // Swap 'em list($max_height, $min_height) = array($min_height, $max_height); } if ($max_height !== "none" && $height > $max_height) { $height = $max_height; } if ($height < $min_height) { $height = $min_height; } } } return array($height, $margin_top, $margin_bottom, $top, $bottom); }
[ "protected", "function", "_calculate_restricted_height", "(", ")", "{", "$", "frame", "=", "$", "this", "->", "_frame", ";", "$", "style", "=", "$", "frame", "->", "get_style", "(", ")", ";", "$", "content_height", "=", "$", "this", "->", "_calculate_conte...
Determine the frame's restricted height @return array
[ "Determine", "the", "frame", "s", "restricted", "height" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameReflower/Block.php#L253-L423
train
Calculates the restricted height of the frame.
[ 30522, 5123, 3853, 1035, 18422, 1035, 7775, 1035, 4578, 1006, 1007, 1063, 1002, 4853, 1027, 1002, 2023, 1011, 1028, 1035, 4853, 1025, 1002, 2806, 1027, 1002, 4853, 1011, 1028, 2131, 1035, 2806, 1006, 1007, 1025, 1002, 4180, 1035, 4578, 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/Plugin/Manager.php
Manager.isPluginActivated
public function isPluginActivated($name) { return in_array($name, $this->pluginsToLoad) || ($this->doLoadAlwaysActivatedPlugins && $this->isPluginAlwaysActivated($name)); }
php
public function isPluginActivated($name) { return in_array($name, $this->pluginsToLoad) || ($this->doLoadAlwaysActivatedPlugins && $this->isPluginAlwaysActivated($name)); }
[ "public", "function", "isPluginActivated", "(", "$", "name", ")", "{", "return", "in_array", "(", "$", "name", ",", "$", "this", "->", "pluginsToLoad", ")", "||", "(", "$", "this", "->", "doLoadAlwaysActivatedPlugins", "&&", "$", "this", "->", "isPluginAlway...
Returns `true` if a plugin has been activated. @param string $name Name of plugin, eg, `'Actions'`. @return bool @api
[ "Returns", "true", "if", "a", "plugin", "has", "been", "activated", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L270-L274
train
Checks if a plugin is activated in the current context
[ 30522, 2270, 3853, 2003, 24759, 15916, 3981, 6593, 21967, 1006, 1002, 2171, 1007, 1063, 2709, 1999, 1035, 9140, 1006, 1002, 2171, 1010, 1002, 2023, 1011, 1028, 13354, 7076, 3406, 11066, 1007, 1064, 1064, 1006, 1002, 2023, 1011, 1028, 2079, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Goals/API.php
API.convertSpecialGoalIds
protected static function convertSpecialGoalIds($idGoal) { if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { return GoalManager::IDGOAL_ORDER; } else if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) { return GoalManager::IDGOAL_CART; } else { return $idGoal; } }
php
protected static function convertSpecialGoalIds($idGoal) { if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { return GoalManager::IDGOAL_ORDER; } else if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) { return GoalManager::IDGOAL_CART; } else { return $idGoal; } }
[ "protected", "static", "function", "convertSpecialGoalIds", "(", "$", "idGoal", ")", "{", "if", "(", "$", "idGoal", "==", "Piwik", "::", "LABEL_ID_GOAL_IS_ECOMMERCE_ORDER", ")", "{", "return", "GoalManager", "::", "IDGOAL_ORDER", ";", "}", "else", "if", "(", "...
Helper function that checks for special string goal IDs and converts them to their integer equivalents. Checks for the following values: Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART @param string|int $idGoal The goal id as an integer or a special string. @return int The numeric goal id.
[ "Helper", "function", "that", "checks", "for", "special", "string", "goal", "IDs", "and", "converts", "them", "to", "their", "integer", "equivalents", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/API.php#L403-L412
train
Convert special goal IDs to their equivalent equivalent
[ 30522, 5123, 10763, 3853, 19884, 5051, 13247, 3995, 11475, 5104, 1006, 1002, 8909, 3995, 2389, 1007, 1063, 2065, 1006, 1002, 8909, 3995, 2389, 1027, 1027, 14255, 9148, 2243, 1024, 1024, 3830, 1035, 8909, 1035, 3125, 1035, 2003, 1035, 17338,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Profiler/Firebug.php
Zend_Db_Profiler_Firebug.updateMessageLabel
protected function updateMessageLabel() { if (!$this->_message) { return; } $this->_message->setLabel(str_replace(array('%label%', '%totalCount%', '%totalDuration%'), array($this->_label, $this->getTotalNumQueries(), (string)round($this->_totalElapsedTime,5)), $this->_label_template)); }
php
protected function updateMessageLabel() { if (!$this->_message) { return; } $this->_message->setLabel(str_replace(array('%label%', '%totalCount%', '%totalDuration%'), array($this->_label, $this->getTotalNumQueries(), (string)round($this->_totalElapsedTime,5)), $this->_label_template)); }
[ "protected", "function", "updateMessageLabel", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_message", ")", "{", "return", ";", "}", "$", "this", "->", "_message", "->", "setLabel", "(", "str_replace", "(", "array", "(", "'%label%'", ",", "'%totalC...
Update the label of the message holding the profile info. @return void
[ "Update", "the", "label", "of", "the", "message", "holding", "the", "profile", "info", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Profiler/Firebug.php#L148-L160
train
Update message label
[ 30522, 5123, 3853, 10651, 7834, 3736, 12439, 16336, 2140, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 4471, 1007, 1063, 2709, 1025, 1065, 1002, 2023, 1011, 1028, 1035, 4471, 1011, 1028, 2275, 20470, 2884, 1006, 2358, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Migrations/Migrator.php
Migrator.reset
public function reset($paths = [], $pretend = false) { $this->notes = []; // Next, we will reverse the migration list so we can run them back in the // correct order for resetting this database. This will allow us to get // the database back into its "empty" state ready for the migrations. $migrations = array_reverse($this->repository->getRan()); if (count($migrations) === 0) { $this->note('<info>Nothing to rollback.</info>'); return []; } return $this->resetMigrations($migrations, $paths, $pretend); }
php
public function reset($paths = [], $pretend = false) { $this->notes = []; // Next, we will reverse the migration list so we can run them back in the // correct order for resetting this database. This will allow us to get // the database back into its "empty" state ready for the migrations. $migrations = array_reverse($this->repository->getRan()); if (count($migrations) === 0) { $this->note('<info>Nothing to rollback.</info>'); return []; } return $this->resetMigrations($migrations, $paths, $pretend); }
[ "public", "function", "reset", "(", "$", "paths", "=", "[", "]", ",", "$", "pretend", "=", "false", ")", "{", "$", "this", "->", "notes", "=", "[", "]", ";", "// Next, we will reverse the migration list so we can run them back in the", "// correct order for resettin...
Rolls all of the currently applied migrations back. @param array|string $paths @param bool $pretend @return array
[ "Rolls", "all", "of", "the", "currently", "applied", "migrations", "back", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Migrations/Migrator.php#L295-L311
train
Reset all migrations in the database
[ 30522, 2270, 3853, 25141, 1006, 1002, 10425, 1027, 1031, 1033, 1010, 1002, 9811, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 3964, 1027, 1031, 1033, 1025, 1013, 1013, 2279, 1010, 2057, 2097, 7901, 1996, 9230, 2862, 2061, 2057, 2064, 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/UpdateManager.php
UpdateManager.downloadPlugin
public function downloadPlugin($name, $hash, $installation = false) { $fileCode = $name . $hash; $this->requestServerFile('plugin/get', $fileCode, $hash, [ 'name' => $name, 'installation' => $installation ? 1 : 0 ]); }
php
public function downloadPlugin($name, $hash, $installation = false) { $fileCode = $name . $hash; $this->requestServerFile('plugin/get', $fileCode, $hash, [ 'name' => $name, 'installation' => $installation ? 1 : 0 ]); }
[ "public", "function", "downloadPlugin", "(", "$", "name", ",", "$", "hash", ",", "$", "installation", "=", "false", ")", "{", "$", "fileCode", "=", "$", "name", ".", "$", "hash", ";", "$", "this", "->", "requestServerFile", "(", "'plugin/get'", ",", "$...
Downloads a plugin from the update server. @param string $name Plugin name. @param string $hash Expected file hash. @param boolean $installation Indicates whether this is a plugin installation request. @return self
[ "Downloads", "a", "plugin", "from", "the", "update", "server", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L569-L576
train
Download a plugin from the server
[ 30522, 2270, 3853, 8816, 24759, 15916, 2378, 1006, 1002, 2171, 1010, 1002, 23325, 1010, 1002, 8272, 1027, 6270, 1007, 1063, 1002, 5371, 16044, 1027, 1002, 2171, 1012, 1002, 23325, 1025, 1002, 2023, 1011, 1028, 11186, 2121, 6299, 8873, 2571,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Session/SaveHandler/DbTable.php
Zend_Session_SaveHandler_DbTable.destroy
public function destroy($id) { $return = false; if ($this->delete($this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { $return = true; } return $return; }
php
public function destroy($id) { $return = false; if ($this->delete($this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { $return = true; } return $return; }
[ "public", "function", "destroy", "(", "$", "id", ")", "{", "$", "return", "=", "false", ";", "if", "(", "$", "this", "->", "delete", "(", "$", "this", "->", "_getPrimary", "(", "$", "id", ",", "self", "::", "PRIMARY_TYPE_WHERECLAUSE", ")", ")", ")", ...
Destroy session @param string $id @return boolean
[ "Destroy", "session" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session/SaveHandler/DbTable.php#L370-L379
train
Destroy a record
[ 30522, 2270, 3853, 6033, 1006, 1002, 8909, 1007, 1063, 1002, 2709, 1027, 6270, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 3972, 12870, 1006, 1002, 2023, 1011, 1028, 1035, 2131, 18098, 9581, 2854, 1006, 1002, 8909, 1010, 2969, 1024, 1024, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php
DateTimeToRfc3339Transformer.reverseTransform
public function reverseTransform($rfc3339) { if (!\is_string($rfc3339)) { throw new TransformationFailedException('Expected a string.'); } if ('' === $rfc3339) { return; } if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339)); } try { $dateTime = new \DateTime($rfc3339); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } if ($this->inputTimezone !== $dateTime->getTimezone()->getName()) { $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); } if (!checkdate($matches[2], $matches[3], $matches[1])) { throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3])); } return $dateTime; }
php
public function reverseTransform($rfc3339) { if (!\is_string($rfc3339)) { throw new TransformationFailedException('Expected a string.'); } if ('' === $rfc3339) { return; } if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339)); } try { $dateTime = new \DateTime($rfc3339); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } if ($this->inputTimezone !== $dateTime->getTimezone()->getName()) { $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); } if (!checkdate($matches[2], $matches[3], $matches[1])) { throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3])); } return $dateTime; }
[ "public", "function", "reverseTransform", "(", "$", "rfc3339", ")", "{", "if", "(", "!", "\\", "is_string", "(", "$", "rfc3339", ")", ")", "{", "throw", "new", "TransformationFailedException", "(", "'Expected a string.'", ")", ";", "}", "if", "(", "''", "=...
Transforms a formatted string following RFC 3339 into a normalized date. @param string $rfc3339 Formatted string @return \DateTime Normalized date @throws TransformationFailedException If the given value is not a string, if the value could not be transformed
[ "Transforms", "a", "formatted", "string", "following", "RFC", "3339", "into", "a", "normalized", "date", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php#L61-L90
train
Transforms a date string into a \ DateTime object
[ 30522, 2270, 3853, 7901, 6494, 3619, 14192, 1006, 1002, 14645, 22394, 23499, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 5164, 1006, 1002, 14645, 22394, 23499, 1007, 1007, 1063, 5466, 2047, 8651, 7011, 18450, 10288, 24422, 1006, 1005, 35...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
FileProfilerStorage.read
public function read($token) { if (!$token || !file_exists($file = $this->getFilename($token))) { return; } return $this->createProfileFromData($token, unserialize(file_get_contents($file))); }
php
public function read($token) { if (!$token || !file_exists($file = $this->getFilename($token))) { return; } return $this->createProfileFromData($token, unserialize(file_get_contents($file))); }
[ "public", "function", "read", "(", "$", "token", ")", "{", "if", "(", "!", "$", "token", "||", "!", "file_exists", "(", "$", "file", "=", "$", "this", "->", "getFilename", "(", "$", "token", ")", ")", ")", "{", "return", ";", "}", "return", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php#L116-L123
train
Read a profile from the file
[ 30522, 2270, 3853, 3191, 1006, 1002, 19204, 1007, 1063, 2065, 1006, 999, 1002, 19204, 1064, 1064, 999, 5371, 1035, 6526, 1006, 1002, 5371, 1027, 1002, 2023, 1011, 1028, 2131, 8873, 20844, 4168, 1006, 1002, 19204, 1007, 1007, 1007, 1063, 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...
getgrav/grav
system/src/Grav/Common/Assets/Pipeline.php
Pipeline.renderJs
public function renderJs($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); } // Store Attributes $this->attributes = $attributes; // Compute uid based on assets and timestamp $json_assets = json_encode($assets); $uid = md5($json_assets . $this->js_minify . $group); $file = $uid . '.js'; $relative_path = "{$this->base_url}{$this->assets_url}/{$file}"; $buffer = null; if (file_exists($this->assets_dir . $file)) { $buffer = file_get_contents($this->assets_dir . $file) . "\n"; } else { //if nothing found get out of here! if (empty($assets)) { return false; } // Concatenate files $buffer = $this->gatherLinks($assets, self::JS_ASSET); // Minify if required if ($this->shouldMinify('js')) { $minifier = new \MatthiasMullie\Minify\JS(); $minifier->add($buffer); $buffer = $minifier->minify(); } // Write file if (trim($buffer) !== '') { file_put_contents($this->assets_dir . $file, $buffer); } } if ($inline_group) { $output = '<script' . $this->renderAttributes(). ">\n" . $buffer . "\n</script>\n"; } else { $this->asset = $relative_path; $output = '<script src="' . $relative_path . $this->renderQueryString() . '"' . $this->renderAttributes() . "></script>\n"; } return $output; }
php
public function renderJs($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); } // Store Attributes $this->attributes = $attributes; // Compute uid based on assets and timestamp $json_assets = json_encode($assets); $uid = md5($json_assets . $this->js_minify . $group); $file = $uid . '.js'; $relative_path = "{$this->base_url}{$this->assets_url}/{$file}"; $buffer = null; if (file_exists($this->assets_dir . $file)) { $buffer = file_get_contents($this->assets_dir . $file) . "\n"; } else { //if nothing found get out of here! if (empty($assets)) { return false; } // Concatenate files $buffer = $this->gatherLinks($assets, self::JS_ASSET); // Minify if required if ($this->shouldMinify('js')) { $minifier = new \MatthiasMullie\Minify\JS(); $minifier->add($buffer); $buffer = $minifier->minify(); } // Write file if (trim($buffer) !== '') { file_put_contents($this->assets_dir . $file, $buffer); } } if ($inline_group) { $output = '<script' . $this->renderAttributes(). ">\n" . $buffer . "\n</script>\n"; } else { $this->asset = $relative_path; $output = '<script src="' . $relative_path . $this->renderQueryString() . '"' . $this->renderAttributes() . "></script>\n"; } return $output; }
[ "public", "function", "renderJs", "(", "$", "assets", ",", "$", "group", ",", "$", "attributes", "=", "[", "]", ")", "{", "// temporary list of assets to pipeline", "$", "inline_group", "=", "false", ";", "if", "(", "array_key_exists", "(", "'loading'", ",", ...
Minify and concatenate JS files. @param array $assets @param string $group @param array $attributes @return bool|string URL or generated content if available, else false
[ "Minify", "and", "concatenate", "JS", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Pipeline.php#L158-L211
train
Render JS assets
[ 30522, 2270, 3853, 17552, 22578, 1006, 1002, 7045, 1010, 1002, 2177, 1010, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 1013, 1013, 5741, 2862, 1997, 7045, 2000, 13117, 1002, 23881, 1035, 2177, 1027, 6270, 1025, 2065, 1006, 30524, 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...
octobercms/october
modules/cms/controllers/Index.php
Index.loadTemplate
protected function loadTemplate($type, $path) { $class = $this->resolveTypeClassName($type); if (!($template = call_user_func([$class, 'load'], $this->theme, $path))) { throw new ApplicationException(trans('cms::lang.template.not_found')); } /** * @event cms.template.processSettingsAfterLoad * Fires immediately after a CMS template (page|partial|layout|content|asset) has been loaded and provides an opportunity to interact with it. * * Example usage: * * Event::listen('cms.template.processSettingsAfterLoad', function ((\Cms\Controllers\Index) $controller, (mixed) $templateObject) { * // Make some modifications to the $template object * }); * * Or * * $CmsIndexController->bindEvent('template.processSettingsAfterLoad', function ((mixed) $templateObject) { * // Make some modifications to the $template object * }); * */ $this->fireSystemEvent('cms.template.processSettingsAfterLoad', [$template]); return $template; }
php
protected function loadTemplate($type, $path) { $class = $this->resolveTypeClassName($type); if (!($template = call_user_func([$class, 'load'], $this->theme, $path))) { throw new ApplicationException(trans('cms::lang.template.not_found')); } /** * @event cms.template.processSettingsAfterLoad * Fires immediately after a CMS template (page|partial|layout|content|asset) has been loaded and provides an opportunity to interact with it. * * Example usage: * * Event::listen('cms.template.processSettingsAfterLoad', function ((\Cms\Controllers\Index) $controller, (mixed) $templateObject) { * // Make some modifications to the $template object * }); * * Or * * $CmsIndexController->bindEvent('template.processSettingsAfterLoad', function ((mixed) $templateObject) { * // Make some modifications to the $template object * }); * */ $this->fireSystemEvent('cms.template.processSettingsAfterLoad', [$template]); return $template; }
[ "protected", "function", "loadTemplate", "(", "$", "type", ",", "$", "path", ")", "{", "$", "class", "=", "$", "this", "->", "resolveTypeClassName", "(", "$", "type", ")", ";", "if", "(", "!", "(", "$", "template", "=", "call_user_func", "(", "[", "$...
Returns an existing template of a given type @param string $type @param string $path @return mixed
[ "Returns", "an", "existing", "template", "of", "a", "given", "type" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L443-L471
train
Loads a template from the given type and path
[ 30522, 5123, 3853, 7170, 18532, 15725, 1006, 1002, 2828, 1010, 1002, 4130, 1007, 1063, 1002, 2465, 1027, 1002, 2023, 1011, 1028, 10663, 13874, 26266, 18442, 1006, 1002, 2828, 1007, 1025, 2065, 1006, 999, 1006, 1002, 23561, 1027, 2655, 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...
slimphp/Slim
Slim/Handlers/Error.php
Error.renderXmlErrorMessage
protected function renderXmlErrorMessage(Exception $exception) { $xml = "<error>\n <message>Slim Application Error</message>\n"; if ($this->displayErrorDetails) { do { $xml .= " <exception>\n"; $xml .= " <type>" . get_class($exception) . "</type>\n"; $xml .= " <code>" . $exception->getCode() . "</code>\n"; $xml .= " <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n"; $xml .= " <file>" . $exception->getFile() . "</file>\n"; $xml .= " <line>" . $exception->getLine() . "</line>\n"; $xml .= " <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n"; $xml .= " </exception>\n"; } while ($exception = $exception->getPrevious()); } $xml .= "</error>"; return $xml; }
php
protected function renderXmlErrorMessage(Exception $exception) { $xml = "<error>\n <message>Slim Application Error</message>\n"; if ($this->displayErrorDetails) { do { $xml .= " <exception>\n"; $xml .= " <type>" . get_class($exception) . "</type>\n"; $xml .= " <code>" . $exception->getCode() . "</code>\n"; $xml .= " <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n"; $xml .= " <file>" . $exception->getFile() . "</file>\n"; $xml .= " <line>" . $exception->getLine() . "</line>\n"; $xml .= " <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n"; $xml .= " </exception>\n"; } while ($exception = $exception->getPrevious()); } $xml .= "</error>"; return $xml; }
[ "protected", "function", "renderXmlErrorMessage", "(", "Exception", "$", "exception", ")", "{", "$", "xml", "=", "\"<error>\\n <message>Slim Application Error</message>\\n\"", ";", "if", "(", "$", "this", "->", "displayErrorDetails", ")", "{", "do", "{", "$", "xml"...
Render XML error @param Exception $exception @return string
[ "Render", "XML", "error" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Handlers/Error.php#L190-L208
train
Render XML error message
[ 30522, 5123, 3853, 17552, 2595, 18602, 29165, 7834, 3736, 3351, 1006, 6453, 1002, 6453, 1007, 1063, 1002, 20950, 1027, 1000, 1026, 7561, 1028, 1032, 1050, 1026, 4471, 1028, 11754, 4646, 7561, 1026, 1013, 4471, 1028, 1032, 1050, 1000, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
RouterDebugCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $name = $input->getArgument('name'); $helper = new DescriptorHelper($this->fileLinkFormatter); $routes = $this->router->getRouteCollection(); if ($name) { if (!($route = $routes->get($name)) && $matchingRoutes = $this->findRouteNameContaining($name, $routes)) { $default = 1 === \count($matchingRoutes) ? $matchingRoutes[0] : null; $name = $io->choice('Select one of the matching routes', $matchingRoutes, $default); $route = $routes->get($name); } if (!$route) { throw new InvalidArgumentException(sprintf('The route "%s" does not exist.', $name)); } $helper->describe($io, $route, [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'name' => $name, 'output' => $io, ]); } else { $helper->describe($io, $routes, [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers'), 'output' => $io, ]); } }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $name = $input->getArgument('name'); $helper = new DescriptorHelper($this->fileLinkFormatter); $routes = $this->router->getRouteCollection(); if ($name) { if (!($route = $routes->get($name)) && $matchingRoutes = $this->findRouteNameContaining($name, $routes)) { $default = 1 === \count($matchingRoutes) ? $matchingRoutes[0] : null; $name = $io->choice('Select one of the matching routes', $matchingRoutes, $default); $route = $routes->get($name); } if (!$route) { throw new InvalidArgumentException(sprintf('The route "%s" does not exist.', $name)); } $helper->describe($io, $route, [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'name' => $name, 'output' => $io, ]); } else { $helper->describe($io, $routes, [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers'), 'output' => $io, ]); } }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "name", "=", "$", "input", "->", "get...
{@inheritdoc} @throws InvalidArgumentException When route does not exist
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php#L76-L108
train
Describes the page
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 22834, 1027, 2047, 25353, 2213, 14876, 4890, 21756, 2571, 1006, 1002, 7953, 1010, 1002, 6434, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.jsonDecodeFilter
public function jsonDecodeFilter($str, $assoc = false, $depth = 512, $options = 0) { return json_decode(html_entity_decode($str), $assoc, $depth, $options); }
php
public function jsonDecodeFilter($str, $assoc = false, $depth = 512, $options = 0) { return json_decode(html_entity_decode($str), $assoc, $depth, $options); }
[ "public", "function", "jsonDecodeFilter", "(", "$", "str", ",", "$", "assoc", "=", "false", ",", "$", "depth", "=", "512", ",", "$", "options", "=", "0", ")", "{", "return", "json_decode", "(", "html_entity_decode", "(", "$", "str", ")", ",", "$", "a...
Decodes string from JSON. @param string $str @param bool $assoc @param int $depth @param int $options @return array
[ "Decodes", "string", "from", "JSON", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1054-L1057
train
JSON decode Filter
[ 30522, 2270, 3853, 1046, 3385, 3207, 16044, 8873, 21928, 1006, 1002, 2358, 2099, 1010, 1002, 4632, 10085, 1027, 6270, 1010, 1002, 5995, 1027, 24406, 1010, 1002, 7047, 1027, 1014, 1007, 1063, 2709, 1046, 3385, 1035, 21933, 3207, 1006, 16129,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.configureMetrics
public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory) { if ($this->getMetricId() && $this->dbTableName && $this->columnName && $this->getNamePlural()) { if (in_array($this->getType(), array(self::TYPE_DATETIME, self::TYPE_DATE, self::TYPE_TIME, self::TYPE_TIMESTAMP))) { // we do not generate any metrics from these types return; } elseif (in_array($this->getType(), array(self::TYPE_URL, self::TYPE_TEXT, self::TYPE_BINARY, self::TYPE_ENUM))) { $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_UNIQUE); $metricsList->addMetric($metric); } elseif (in_array($this->getType(), array(self::TYPE_BOOL))) { $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM); $metricsList->addMetric($metric); } else { $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM); $metricsList->addMetric($metric); $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MAX); $metricsList->addMetric($metric); } } }
php
public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory) { if ($this->getMetricId() && $this->dbTableName && $this->columnName && $this->getNamePlural()) { if (in_array($this->getType(), array(self::TYPE_DATETIME, self::TYPE_DATE, self::TYPE_TIME, self::TYPE_TIMESTAMP))) { // we do not generate any metrics from these types return; } elseif (in_array($this->getType(), array(self::TYPE_URL, self::TYPE_TEXT, self::TYPE_BINARY, self::TYPE_ENUM))) { $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_UNIQUE); $metricsList->addMetric($metric); } elseif (in_array($this->getType(), array(self::TYPE_BOOL))) { $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM); $metricsList->addMetric($metric); } else { $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM); $metricsList->addMetric($metric); $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MAX); $metricsList->addMetric($metric); } } }
[ "public", "function", "configureMetrics", "(", "MetricsList", "$", "metricsList", ",", "DimensionMetricFactory", "$", "dimensionMetricFactory", ")", "{", "if", "(", "$", "this", "->", "getMetricId", "(", ")", "&&", "$", "this", "->", "dbTableName", "&&", "$", ...
Configures metrics for this dimension. For certain dimension types, some metrics will be added automatically. @param MetricsList $metricsList @param DimensionMetricFactory $dimensionMetricFactory
[ "Configures", "metrics", "for", "this", "dimension", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/Dimension.php#L492-L512
train
This method will add the metrics to the list of metrics that are stored in the database
[ 30522, 2270, 3853, 9530, 8873, 27390, 21382, 29392, 1006, 12046, 14540, 2923, 1002, 12046, 14540, 2923, 1010, 9812, 12589, 21450, 1002, 9812, 12589, 21450, 1007, 1063, 2065, 30524, 10880, 18442, 1004, 1004, 1002, 2023, 1011, 1028, 5930, 18442...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Context/ExecutionContext.php
ExecutionContext.addViolation
public function addViolation($message, array $parameters = []) { $this->violations->add(new ConstraintViolation( $this->translator->trans($message, $parameters, $this->translationDomain), $message, $parameters, $this->root, $this->propertyPath, $this->value, null, null, $this->constraint )); }
php
public function addViolation($message, array $parameters = []) { $this->violations->add(new ConstraintViolation( $this->translator->trans($message, $parameters, $this->translationDomain), $message, $parameters, $this->root, $this->propertyPath, $this->value, null, null, $this->constraint )); }
[ "public", "function", "addViolation", "(", "$", "message", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "this", "->", "violations", "->", "add", "(", "new", "ConstraintViolation", "(", "$", "this", "->", "translator", "->", "trans", "("...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Context/ExecutionContext.php#L186-L199
train
Adds a constraint violation to the list of violations
[ 30522, 2270, 3853, 5587, 25500, 13490, 1006, 1002, 4471, 1010, 9140, 1002, 11709, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 13302, 1011, 1028, 5587, 1006, 2047, 27142, 25500, 13490, 1006, 1002, 2023, 1011, 1028, 11403, 1011, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/Broadcasting/Client.php
Client.sendCard
public function sendCard(string $cardId, $reception = null, array $attributes = []) { return $this->sendMessage(new Card($cardId), $reception, $attributes); }
php
public function sendCard(string $cardId, $reception = null, array $attributes = []) { return $this->sendMessage(new Card($cardId), $reception, $attributes); }
[ "public", "function", "sendCard", "(", "string", "$", "cardId", ",", "$", "reception", "=", "null", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "return", "$", "this", "->", "sendMessage", "(", "new", "Card", "(", "$", "cardId", ")", ","...
Send a card message. @param string $cardId @param mixed $reception @param array $attributes @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
[ "Send", "a", "card", "message", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L214-L217
train
Send a card message
[ 30522, 2270, 3853, 4604, 11522, 1006, 5164, 1002, 4003, 3593, 1010, 1002, 7684, 1027, 19701, 1010, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 4604, 7834, 3736, 3351, 1006, 2047, 4003, 1006, 1002, 4003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/User/FlexUser/User.php
User.toYaml
public function toYaml($inline = 5, $indent = 2) { $yaml = new YamlFormatter(['inline' => $inline, 'indent' => $indent]); return $yaml->encode($this->toArray()); }
php
public function toYaml($inline = 5, $indent = 2) { $yaml = new YamlFormatter(['inline' => $inline, 'indent' => $indent]); return $yaml->encode($this->toArray()); }
[ "public", "function", "toYaml", "(", "$", "inline", "=", "5", ",", "$", "indent", "=", "2", ")", "{", "$", "yaml", "=", "new", "YamlFormatter", "(", "[", "'inline'", "=>", "$", "inline", ",", "'indent'", "=>", "$", "indent", "]", ")", ";", "return"...
Convert object into YAML string. @param int $inline The level where you switch to inline YAML. @param int $indent The amount of spaces to use for indentation of nested nodes. @return string A YAML string representing the object.
[ "Convert", "object", "into", "YAML", "string", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L218-L223
train
Returns the current array as YAML.
[ 30522, 2270, 3853, 9121, 3286, 2140, 1006, 1002, 23881, 1027, 1019, 1010, 1002, 27427, 4765, 1027, 1016, 1007, 1063, 1002, 8038, 19968, 1027, 2047, 8038, 19968, 14192, 20097, 1006, 1031, 1005, 23881, 1005, 1027, 1028, 1002, 23881, 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...
octobercms/october
modules/cms/classes/ComponentPartial.php
ComponentPartial.validateFileName
protected function validateFileName($fileName) { if (!FileHelper::validatePath($fileName, $this->maxNesting)) { throw new ApplicationException(Lang::get('cms::lang.cms_object.invalid_file', [ 'name' => $fileName ])); } if (!strlen(File::extension($fileName))) { $fileName .= '.'.$this->defaultExtension; } return $fileName; }
php
protected function validateFileName($fileName) { if (!FileHelper::validatePath($fileName, $this->maxNesting)) { throw new ApplicationException(Lang::get('cms::lang.cms_object.invalid_file', [ 'name' => $fileName ])); } if (!strlen(File::extension($fileName))) { $fileName .= '.'.$this->defaultExtension; } return $fileName; }
[ "protected", "function", "validateFileName", "(", "$", "fileName", ")", "{", "if", "(", "!", "FileHelper", "::", "validatePath", "(", "$", "fileName", ",", "$", "this", "->", "maxNesting", ")", ")", "{", "throw", "new", "ApplicationException", "(", "Lang", ...
Checks the supplied file name for validity. @param string $fileName @return string
[ "Checks", "the", "supplied", "file", "name", "for", "validity", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentPartial.php#L161-L174
train
Validate a file name
[ 30522, 5123, 3853, 9398, 3686, 8873, 20844, 4168, 1006, 1002, 5371, 18442, 1007, 1063, 2065, 1006, 999, 5371, 16001, 4842, 1024, 1024, 9398, 3686, 15069, 1006, 1002, 5371, 18442, 1010, 1002, 2023, 1011, 1028, 4098, 5267, 3436, 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/Common/User/Traits/UserTrait.php
UserTrait.getAvatarUrl
public function getAvatarUrl(): string { // Try to locate avatar image. $avatar = $this->getAvatarImage(); if ($avatar) { return $avatar->url(); } // Try if avatar is a sting (URL). $avatar = $this->get('avatar'); if (\is_string($avatar)) { return $avatar; } // Try looking for provider. $provider = $this->get('provider'); $provider_options = $this->get($provider); if (\is_array($provider_options)) { if (isset($provider_options['avatar_url']) && \is_string($provider_options['avatar_url'])) { return $provider_options['avatar_url']; } if (isset($provider_options['avatar']) && \is_string($provider_options['avatar'])) { return $provider_options['avatar']; } } $email = $this->get('email'); // By default fall back to gravatar image. return $email ? 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) : ''; }
php
public function getAvatarUrl(): string { // Try to locate avatar image. $avatar = $this->getAvatarImage(); if ($avatar) { return $avatar->url(); } // Try if avatar is a sting (URL). $avatar = $this->get('avatar'); if (\is_string($avatar)) { return $avatar; } // Try looking for provider. $provider = $this->get('provider'); $provider_options = $this->get($provider); if (\is_array($provider_options)) { if (isset($provider_options['avatar_url']) && \is_string($provider_options['avatar_url'])) { return $provider_options['avatar_url']; } if (isset($provider_options['avatar']) && \is_string($provider_options['avatar'])) { return $provider_options['avatar']; } } $email = $this->get('email'); // By default fall back to gravatar image. return $email ? 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) : ''; }
[ "public", "function", "getAvatarUrl", "(", ")", ":", "string", "{", "// Try to locate avatar image.", "$", "avatar", "=", "$", "this", "->", "getAvatarImage", "(", ")", ";", "if", "(", "$", "avatar", ")", "{", "return", "$", "avatar", "->", "url", "(", "...
Return the User's avatar URL @return string
[ "Return", "the", "User", "s", "avatar", "URL" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Traits/UserTrait.php#L135-L165
train
Return the avatar URL of the user
[ 30522, 2270, 3853, 2131, 12462, 7559, 3126, 2140, 1006, 1007, 1024, 5164, 1063, 1013, 1013, 3046, 2000, 12453, 22128, 3746, 1012, 1002, 22128, 1027, 1002, 2023, 1011, 1028, 2131, 12462, 7559, 9581, 3351, 1006, 1007, 1025, 2065, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
FilesystemCommonTrait.doClear
protected function doClear($namespace) { $ok = true; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS)) as $file) { $ok = ($file->isDir() || $this->doUnlink($file) || !file_exists($file)) && $ok; } return $ok; }
php
protected function doClear($namespace) { $ok = true; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS)) as $file) { $ok = ($file->isDir() || $this->doUnlink($file) || !file_exists($file)) && $ok; } return $ok; }
[ "protected", "function", "doClear", "(", "$", "namespace", ")", "{", "$", "ok", "=", "true", ";", "foreach", "(", "new", "\\", "RecursiveIteratorIterator", "(", "new", "\\", "RecursiveDirectoryIterator", "(", "$", "this", "->", "directory", ",", "\\", "Files...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php#L54-L63
train
Clear all cache files in the directory
[ 30522, 5123, 3853, 9986, 19738, 2099, 1006, 1002, 3415, 15327, 1007, 1063, 1002, 7929, 1027, 2995, 1025, 18921, 6776, 1006, 2047, 1032, 28667, 9236, 3512, 21646, 8844, 21646, 8844, 1006, 2047, 1032, 28667, 9236, 3512, 4305, 2890, 16761, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Output/BufferedOutput.php
BufferedOutput.doWrite
protected function doWrite($message, $newline) { $this->buffer .= $message; if ($newline) { $this->buffer .= PHP_EOL; } }
php
protected function doWrite($message, $newline) { $this->buffer .= $message; if ($newline) { $this->buffer .= PHP_EOL; } }
[ "protected", "function", "doWrite", "(", "$", "message", ",", "$", "newline", ")", "{", "$", "this", "->", "buffer", ".=", "$", "message", ";", "if", "(", "$", "newline", ")", "{", "$", "this", "->", "buffer", ".=", "PHP_EOL", ";", "}", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Output/BufferedOutput.php#L37-L44
train
Write a message to the buffer
[ 30522, 5123, 3853, 23268, 17625, 1006, 1002, 4471, 1010, 1002, 2047, 4179, 1007, 1063, 1002, 2023, 1011, 1028, 17698, 1012, 1027, 1002, 4471, 1025, 2065, 1006, 1002, 2047, 4179, 1007, 1063, 1002, 2023, 1011, 1028, 17698, 1012, 1027, 25718, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Sqlsrv.php
Zend_Db_Adapter_Sqlsrv._quote
protected function _quote($value) { if (is_int($value)) { return $value; } elseif (is_float($value)) { return sprintf('%F', $value); } return "'" . str_replace("'", "''", $value) . "'"; }
php
protected function _quote($value) { if (is_int($value)) { return $value; } elseif (is_float($value)) { return sprintf('%F', $value); } return "'" . str_replace("'", "''", $value) . "'"; }
[ "protected", "function", "_quote", "(", "$", "value", ")", "{", "if", "(", "is_int", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "elseif", "(", "is_float", "(", "$", "value", ")", ")", "{", "return", "sprintf", "(", "'%F'", ...
Quote a raw string. @param string $value Raw string @return string Quoted string
[ "Quote", "a", "raw", "string", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Sqlsrv.php#L309-L318
train
Quote value for use in SQL
[ 30522, 5123, 3853, 1035, 14686, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 2003, 1035, 20014, 1006, 1002, 3643, 1007, 1007, 1063, 2709, 1002, 3643, 1025, 1065, 2842, 10128, 1006, 2003, 1035, 14257, 1006, 1002, 3643, 1007, 1007, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/TokenParser/TwigTokenParserSwitch.php
TwigTokenParserSwitch.parse
public function parse(Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $stream->expect(Token::BLOCK_END_TYPE); // There can be some whitespace between the {% switch %} and first {% case %} tag. while ($stream->getCurrent()->getType() === Token::TEXT_TYPE && trim($stream->getCurrent()->getValue()) === '') { $stream->next(); } $stream->expect(Token::BLOCK_START_TYPE); $expressionParser = $this->parser->getExpressionParser(); $default = null; $cases = []; $end = false; while (!$end) { $next = $stream->next(); switch ($next->getValue()) { case 'case': $values = []; while (true) { $values[] = $expressionParser->parsePrimaryExpression(); // Multiple allowed values? if ($stream->test(Token::OPERATOR_TYPE, 'or')) { $stream->next(); } else { break; } } $stream->expect(Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideIfFork')); $cases[] = new Node([ 'values' => new Node($values), 'body' => $body ]); break; case 'default': $stream->expect(Token::BLOCK_END_TYPE); $default = $this->parser->subparse(array($this, 'decideIfEnd')); break; case 'endswitch': $end = true; break; default: throw new SyntaxError(sprintf('Unexpected end of template. Twig was looking for the following tags "case", "default", or "endswitch" to close the "switch" block started at line %d)', $lineno), -1); } } $stream->expect(Token::BLOCK_END_TYPE); return new TwigNodeSwitch($name, new Node($cases), $default, $lineno, $this->getTag()); }
php
public function parse(Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $stream->expect(Token::BLOCK_END_TYPE); // There can be some whitespace between the {% switch %} and first {% case %} tag. while ($stream->getCurrent()->getType() === Token::TEXT_TYPE && trim($stream->getCurrent()->getValue()) === '') { $stream->next(); } $stream->expect(Token::BLOCK_START_TYPE); $expressionParser = $this->parser->getExpressionParser(); $default = null; $cases = []; $end = false; while (!$end) { $next = $stream->next(); switch ($next->getValue()) { case 'case': $values = []; while (true) { $values[] = $expressionParser->parsePrimaryExpression(); // Multiple allowed values? if ($stream->test(Token::OPERATOR_TYPE, 'or')) { $stream->next(); } else { break; } } $stream->expect(Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideIfFork')); $cases[] = new Node([ 'values' => new Node($values), 'body' => $body ]); break; case 'default': $stream->expect(Token::BLOCK_END_TYPE); $default = $this->parser->subparse(array($this, 'decideIfEnd')); break; case 'endswitch': $end = true; break; default: throw new SyntaxError(sprintf('Unexpected end of template. Twig was looking for the following tags "case", "default", or "endswitch" to close the "switch" block started at line %d)', $lineno), -1); } } $stream->expect(Token::BLOCK_END_TYPE); return new TwigNodeSwitch($name, new Node($cases), $default, $lineno, $this->getTag()); }
[ "public", "function", "parse", "(", "Token", "$", "token", ")", "{", "$", "lineno", "=", "$", "token", "->", "getLine", "(", ")", ";", "$", "stream", "=", "$", "this", "->", "parser", "->", "getStream", "(", ")", ";", "$", "name", "=", "$", "this...
{@inheritdoc}
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserSwitch.php#L36-L99
train
Parses the template
[ 30522, 2270, 3853, 11968, 3366, 1006, 19204, 1002, 19204, 1007, 1063, 1002, 17517, 2080, 1027, 1002, 19204, 1011, 1028, 2131, 4179, 1006, 1007, 1025, 1002, 5460, 1027, 1002, 2023, 1011, 1028, 11968, 8043, 1011, 1028, 4152, 25379, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Renderer/Html.php
Html.renderTable
protected function renderTable($table) { if (is_array($table)) { // convert array to DataTable $table = DataTable::makeFromSimpleArray($table); } if ($table instanceof DataTable\Map) { foreach ($table->getDataTables() as $date => $subtable) { if ($subtable->getRowsCount()) { $this->buildTableStructure($subtable, '_' . $table->getKeyName(), $date); } } } else { // Simple if ($table->getRowsCount()) { $this->buildTableStructure($table); } } $out = $this->renderDataTable(); return $out; }
php
protected function renderTable($table) { if (is_array($table)) { // convert array to DataTable $table = DataTable::makeFromSimpleArray($table); } if ($table instanceof DataTable\Map) { foreach ($table->getDataTables() as $date => $subtable) { if ($subtable->getRowsCount()) { $this->buildTableStructure($subtable, '_' . $table->getKeyName(), $date); } } } else { // Simple if ($table->getRowsCount()) { $this->buildTableStructure($table); } } $out = $this->renderDataTable(); return $out; }
[ "protected", "function", "renderTable", "(", "$", "table", ")", "{", "if", "(", "is_array", "(", "$", "table", ")", ")", "{", "// convert array to DataTable", "$", "table", "=", "DataTable", "::", "makeFromSimpleArray", "(", "$", "table", ")", ";", "}", "i...
Computes the output for the given data table @param DataTable $table @return string
[ "Computes", "the", "output", "for", "the", "given", "data", "table" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Html.php#L57-L81
train
Render the table
[ 30522, 5123, 3853, 17552, 10880, 1006, 1002, 2795, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 2795, 1007, 1007, 1063, 1013, 1013, 10463, 9140, 2000, 2951, 10880, 1002, 2795, 1027, 2951, 10880, 1024, 1024, 2191, 19699, 22225, 5714...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Lists.php
Lists.evalTimesinceTypeValue
protected function evalTimesinceTypeValue($record, $column, $value) { if ($value === null) { return null; } $dateTime = $this->validateDateTimeValue($value, $column); $value = DateTimeHelper::timeSince($dateTime); $options = [ 'defaultValue' => $value, 'timeSince' => true ]; if (!empty($column->config['ignoreTimezone'])) { $options['ignoreTimezone'] = true; } return Backend::dateTime($dateTime, $options); }
php
protected function evalTimesinceTypeValue($record, $column, $value) { if ($value === null) { return null; } $dateTime = $this->validateDateTimeValue($value, $column); $value = DateTimeHelper::timeSince($dateTime); $options = [ 'defaultValue' => $value, 'timeSince' => true ]; if (!empty($column->config['ignoreTimezone'])) { $options['ignoreTimezone'] = true; } return Backend::dateTime($dateTime, $options); }
[ "protected", "function", "evalTimesinceTypeValue", "(", "$", "record", ",", "$", "column", ",", "$", "value", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "null", ";", "}", "$", "dateTime", "=", "$", "this", "->", "validateDate...
Process as diff for humans (1 min ago)
[ "Process", "as", "diff", "for", "humans", "(", "1", "min", "ago", ")" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1303-L1323
train
Evaluate the timesince type value
[ 30522, 5123, 3853, 9345, 7096, 14428, 11493, 3401, 13874, 10175, 5657, 1006, 1002, 2501, 1010, 1002, 5930, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 1002, 3643, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 19701, 1025, 1065, 1002, 3058, 7292,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Db/Schema/Mysql.php
Mysql.dropDatabase
public function dropDatabase($dbName = null) { $dbName = $dbName ?: $this->getDbName(); $dbName = str_replace('`', '', $dbName); Db::exec("DROP DATABASE IF EXISTS `" . $dbName . "`"); }
php
public function dropDatabase($dbName = null) { $dbName = $dbName ?: $this->getDbName(); $dbName = str_replace('`', '', $dbName); Db::exec("DROP DATABASE IF EXISTS `" . $dbName . "`"); }
[ "public", "function", "dropDatabase", "(", "$", "dbName", "=", "null", ")", "{", "$", "dbName", "=", "$", "dbName", "?", ":", "$", "this", "->", "getDbName", "(", ")", ";", "$", "dbName", "=", "str_replace", "(", "'`'", ",", "''", ",", "$", "dbName...
Drop database
[ "Drop", "database" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Schema/Mysql.php#L465-L470
train
Drop database if exists
[ 30522, 2270, 3853, 4530, 2850, 2696, 15058, 1006, 1002, 16962, 18442, 1027, 19701, 1007, 1063, 1002, 16962, 18442, 1027, 1002, 16962, 18442, 1029, 1024, 1002, 2023, 1011, 1028, 2131, 18939, 18442, 1006, 1007, 1025, 1002, 16962, 18442, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataAccess/LogQueryBuilder/JoinGenerator.php
JoinGenerator.generateNonVisitJoins
protected function generateNonVisitJoins($tableName, $tableNameToJoin, $index) { $logTable = $this->tables->getLogTable($tableName); $logTableToJoin = $this->tables->getLogTable($tableNameToJoin); $nonVisitJoin = sprintf("%s.%s = %s.%s", $logTableToJoin->getName(), $logTableToJoin->getColumnToJoinOnIdAction(), $tableName, $logTable->getColumnToJoinOnIdAction()); $altNonVisitJoin = sprintf("%s.%s = %s.%s", $tableName, $logTable->getColumnToJoinOnIdAction(), $logTableToJoin->getName(), $logTableToJoin->getColumnToJoinOnIdAction()); if ($index > 0 && $this->tables->hasAddedTableManually($tableName) && !$this->tables->hasJoinedTableManually($tableName, $nonVisitJoin) && !$this->tables->hasJoinedTableManually($tableName, $altNonVisitJoin)) { $tableIndex = $this->tables->findIndexOfManuallyAddedTable($tableName); $nonVisitJoin = '(' . $this->tables[$tableIndex]['joinOn'] . ' AND ' . $nonVisitJoin . ')'; unset($this->tables[$tableIndex]); } if (!isset($this->nonVisitJoins[$tableName])) { $this->nonVisitJoins[$tableName] = array(); } if (!isset($this->nonVisitJoins[$tableNameToJoin])) { $this->nonVisitJoins[$tableNameToJoin] = array(); } $this->nonVisitJoins[$tableName][$tableNameToJoin] = $nonVisitJoin; $this->nonVisitJoins[$tableNameToJoin][$tableName] = $nonVisitJoin; }
php
protected function generateNonVisitJoins($tableName, $tableNameToJoin, $index) { $logTable = $this->tables->getLogTable($tableName); $logTableToJoin = $this->tables->getLogTable($tableNameToJoin); $nonVisitJoin = sprintf("%s.%s = %s.%s", $logTableToJoin->getName(), $logTableToJoin->getColumnToJoinOnIdAction(), $tableName, $logTable->getColumnToJoinOnIdAction()); $altNonVisitJoin = sprintf("%s.%s = %s.%s", $tableName, $logTable->getColumnToJoinOnIdAction(), $logTableToJoin->getName(), $logTableToJoin->getColumnToJoinOnIdAction()); if ($index > 0 && $this->tables->hasAddedTableManually($tableName) && !$this->tables->hasJoinedTableManually($tableName, $nonVisitJoin) && !$this->tables->hasJoinedTableManually($tableName, $altNonVisitJoin)) { $tableIndex = $this->tables->findIndexOfManuallyAddedTable($tableName); $nonVisitJoin = '(' . $this->tables[$tableIndex]['joinOn'] . ' AND ' . $nonVisitJoin . ')'; unset($this->tables[$tableIndex]); } if (!isset($this->nonVisitJoins[$tableName])) { $this->nonVisitJoins[$tableName] = array(); } if (!isset($this->nonVisitJoins[$tableNameToJoin])) { $this->nonVisitJoins[$tableNameToJoin] = array(); } $this->nonVisitJoins[$tableName][$tableNameToJoin] = $nonVisitJoin; $this->nonVisitJoins[$tableNameToJoin][$tableName] = $nonVisitJoin; }
[ "protected", "function", "generateNonVisitJoins", "(", "$", "tableName", ",", "$", "tableNameToJoin", ",", "$", "index", ")", "{", "$", "logTable", "=", "$", "this", "->", "tables", "->", "getLogTable", "(", "$", "tableName", ")", ";", "$", "logTableToJoin",...
This code is a bit tricky. We have to execute this right at the beginning before actually iterating over all the tables and generating the join string as we may have to delete a table from the tables. If we did not delete this table upfront, we would have maybe already added a joinString for that table, even though it will be later removed by another table. This means if we wouldn't delete/unset that table upfront, we would need to alter an already generated join string which would not be really nice code as well. Next problem is, because we are deleting a table, we have to remember the "joinOn" string for that table in a property "nonVisitJoins". Otherwise we would not be able to generate the correct "joinOn" string when actually iterating over all the tables to generate that string. @param $tableName @param $tableNameToJoin @param $index
[ "This", "code", "is", "a", "bit", "tricky", ".", "We", "have", "to", "execute", "this", "right", "at", "the", "beginning", "before", "actually", "iterating", "over", "all", "the", "tables", "and", "generating", "the", "join", "string", "as", "we", "may", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/LogQueryBuilder/JoinGenerator.php#L285-L315
train
Generate non visit joins
[ 30522, 5123, 3853, 9699, 8540, 11365, 4183, 5558, 7076, 1006, 1002, 2795, 18442, 1010, 1002, 2795, 18442, 3406, 5558, 2378, 1010, 1002, 5950, 1007, 1063, 1002, 8833, 10880, 1027, 1002, 2023, 1011, 1028, 7251, 1011, 1028, 2131, 21197, 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...
matomo-org/matomo
core/Plugin/Visualization.php
Visualization.postDataTableLoadedFromAPI
private function postDataTableLoadedFromAPI() { $columns = $this->dataTable->getColumns(); $hasNbVisits = in_array('nb_visits', $columns); $hasNbUniqVisitors = in_array('nb_uniq_visitors', $columns); // default columns_to_display to label, nb_uniq_visitors/nb_visits if those columns exist in the // dataset. otherwise, default to all columns in dataset. if (empty($this->config->columns_to_display)) { $this->config->setDefaultColumnsToDisplay($columns, $hasNbVisits, $hasNbUniqVisitors); } if (!empty($this->dataTable)) { $this->removeEmptyColumnsFromDisplay(); } if (empty($this->requestConfig->filter_sort_column)) { $this->requestConfig->setDefaultSort($this->config->columns_to_display, $hasNbUniqVisitors, $columns); } // deal w/ table metadata if ($this->dataTable instanceof DataTable) { $this->metadata = $this->dataTable->getAllTableMetadata(); if (isset($this->metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])) { $this->reportLastUpdatedMessage = $this->makePrettyArchivedOnText(); } } $pivotBy = Common::getRequestVar('pivotBy', false) ?: $this->requestConfig->pivotBy; if (empty($pivotBy) && $this->dataTable instanceof DataTable ) { $this->config->disablePivotBySubtableIfTableHasNoSubtables($this->dataTable); } }
php
private function postDataTableLoadedFromAPI() { $columns = $this->dataTable->getColumns(); $hasNbVisits = in_array('nb_visits', $columns); $hasNbUniqVisitors = in_array('nb_uniq_visitors', $columns); // default columns_to_display to label, nb_uniq_visitors/nb_visits if those columns exist in the // dataset. otherwise, default to all columns in dataset. if (empty($this->config->columns_to_display)) { $this->config->setDefaultColumnsToDisplay($columns, $hasNbVisits, $hasNbUniqVisitors); } if (!empty($this->dataTable)) { $this->removeEmptyColumnsFromDisplay(); } if (empty($this->requestConfig->filter_sort_column)) { $this->requestConfig->setDefaultSort($this->config->columns_to_display, $hasNbUniqVisitors, $columns); } // deal w/ table metadata if ($this->dataTable instanceof DataTable) { $this->metadata = $this->dataTable->getAllTableMetadata(); if (isset($this->metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])) { $this->reportLastUpdatedMessage = $this->makePrettyArchivedOnText(); } } $pivotBy = Common::getRequestVar('pivotBy', false) ?: $this->requestConfig->pivotBy; if (empty($pivotBy) && $this->dataTable instanceof DataTable ) { $this->config->disablePivotBySubtableIfTableHasNoSubtables($this->dataTable); } }
[ "private", "function", "postDataTableLoadedFromAPI", "(", ")", "{", "$", "columns", "=", "$", "this", "->", "dataTable", "->", "getColumns", "(", ")", ";", "$", "hasNbVisits", "=", "in_array", "(", "'nb_visits'", ",", "$", "columns", ")", ";", "$", "hasNbU...
Hook called after the dataTable has been loaded from the API Can be used to add, delete or modify the data freshly loaded @return bool
[ "Hook", "called", "after", "the", "dataTable", "has", "been", "loaded", "from", "the", "API", "Can", "be", "used", "to", "add", "delete", "or", "modify", "the", "data", "freshly", "loaded" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Visualization.php#L378-L413
train
postDataTableLoadedFromAPI - Enforces that the data table has been loaded from the API
[ 30522, 2797, 3853, 2695, 2850, 29336, 3085, 17468, 19699, 9626, 8197, 1006, 1007, 1063, 1002, 7753, 1027, 1002, 2023, 1011, 1028, 2951, 10880, 1011, 1028, 2131, 25778, 2819, 3619, 1006, 1007, 1025, 1002, 8440, 2497, 11365, 12762, 1027, 1999...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CronArchive/FixedSiteIds.php
FixedSiteIds.getNumProcessedWebsites
public function getNumProcessedWebsites() { $numProcessed = $this->index + 1; if ($numProcessed > $this->getNumSites()) { return $this->getNumSites(); } return $numProcessed; }
php
public function getNumProcessedWebsites() { $numProcessed = $this->index + 1; if ($numProcessed > $this->getNumSites()) { return $this->getNumSites(); } return $numProcessed; }
[ "public", "function", "getNumProcessedWebsites", "(", ")", "{", "$", "numProcessed", "=", "$", "this", "->", "index", "+", "1", ";", "if", "(", "$", "numProcessed", ">", "$", "this", "->", "getNumSites", "(", ")", ")", "{", "return", "$", "this", "->",...
Get the number of already processed websites. All websites were processed by the current archiver. @return int
[ "Get", "the", "number", "of", "already", "processed", "websites", ".", "All", "websites", "were", "processed", "by", "the", "current", "archiver", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive/FixedSiteIds.php#L44-L53
train
Get Number of processed websites
[ 30522, 2270, 3853, 2131, 19172, 21572, 9623, 6924, 8545, 5910, 7616, 1006, 1007, 1063, 1002, 16371, 8737, 3217, 9623, 6924, 1027, 1002, 2023, 1011, 1028, 5950, 1009, 1015, 1025, 2065, 1006, 1002, 16371, 8737, 3217, 9623, 6924, 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...
laravel/framework
src/Illuminate/Routing/Middleware/ThrottleRequests.php
ThrottleRequests.calculateRemainingAttempts
protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) { if (is_null($retryAfter)) { return $this->limiter->retriesLeft($key, $maxAttempts); } return 0; }
php
protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) { if (is_null($retryAfter)) { return $this->limiter->retriesLeft($key, $maxAttempts); } return 0; }
[ "protected", "function", "calculateRemainingAttempts", "(", "$", "key", ",", "$", "maxAttempts", ",", "$", "retryAfter", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "retryAfter", ")", ")", "{", "return", "$", "this", "->", "limiter", "->", "re...
Calculate the number of remaining attempts. @param string $key @param int $maxAttempts @param int|null $retryAfter @return int
[ "Calculate", "the", "number", "of", "remaining", "attempts", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Middleware/ThrottleRequests.php#L189-L196
train
Calculate the number of remaining attempts for a key
[ 30522, 5123, 3853, 18422, 28578, 8113, 28234, 4674, 27718, 2015, 1006, 1002, 3145, 1010, 1002, 4098, 19321, 6633, 22798, 1010, 1002, 2128, 11129, 10354, 3334, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2128, 11129, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Installer.php
Installer.sophisticatedInstall
public static function sophisticatedInstall($source_path, $install_path, $ignores = [], $keep_source = false) { foreach (new \DirectoryIterator($source_path) as $file) { if ($file->isLink() || $file->isDot() || \in_array($file->getFilename(), $ignores, true)) { continue; } $path = $install_path . DS . $file->getFilename(); if ($file->isDir()) { Folder::delete($path); if ($keep_source) { Folder::copy($file->getPathname(), $path); } else { Folder::move($file->getPathname(), $path); } if ($file->getFilename() === 'bin') { foreach (glob($path . DS . '*') as $bin_file) { @chmod($bin_file, 0755); } } } else { @unlink($path); @copy($file->getPathname(), $path); } } return true; }
php
public static function sophisticatedInstall($source_path, $install_path, $ignores = [], $keep_source = false) { foreach (new \DirectoryIterator($source_path) as $file) { if ($file->isLink() || $file->isDot() || \in_array($file->getFilename(), $ignores, true)) { continue; } $path = $install_path . DS . $file->getFilename(); if ($file->isDir()) { Folder::delete($path); if ($keep_source) { Folder::copy($file->getPathname(), $path); } else { Folder::move($file->getPathname(), $path); } if ($file->getFilename() === 'bin') { foreach (glob($path . DS . '*') as $bin_file) { @chmod($bin_file, 0755); } } } else { @unlink($path); @copy($file->getPathname(), $path); } } return true; }
[ "public", "static", "function", "sophisticatedInstall", "(", "$", "source_path", ",", "$", "install_path", ",", "$", "ignores", "=", "[", "]", ",", "$", "keep_source", "=", "false", ")", "{", "foreach", "(", "new", "\\", "DirectoryIterator", "(", "$", "sou...
@param string $source_path @param string $install_path @param array $ignores @param bool $keep_source @return bool
[ "@param", "string", "$source_path", "@param", "string", "$install_path", "@param", "array", "$ignores", "@param", "bool", "$keep_source" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Installer.php#L297-L327
train
Installs a sophisticated version of the application
[ 30522, 2270, 10763, 3853, 12138, 7076, 9080, 2140, 1006, 1002, 3120, 1035, 4130, 1010, 1002, 16500, 1035, 4130, 1010, 1002, 26663, 1027, 1031, 1033, 1010, 1002, 2562, 1035, 3120, 1027, 6270, 1007, 1063, 18921, 6776, 1006, 2047, 1032, 14176,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/behaviors/ReorderController.php
ReorderController.prepareVars
protected function prepareVars() { $this->vars['reorderRecords'] = $this->getRecords(); $this->vars['reorderModel'] = $this->model; $this->vars['reorderSortMode'] = $this->sortMode; $this->vars['reorderShowTree'] = $this->showTree; $this->vars['reorderToolbarWidget'] = $this->toolbarWidget; }
php
protected function prepareVars() { $this->vars['reorderRecords'] = $this->getRecords(); $this->vars['reorderModel'] = $this->model; $this->vars['reorderSortMode'] = $this->sortMode; $this->vars['reorderShowTree'] = $this->showTree; $this->vars['reorderToolbarWidget'] = $this->toolbarWidget; }
[ "protected", "function", "prepareVars", "(", ")", "{", "$", "this", "->", "vars", "[", "'reorderRecords'", "]", "=", "$", "this", "->", "getRecords", "(", ")", ";", "$", "this", "->", "vars", "[", "'reorderModel'", "]", "=", "$", "this", "->", "model",...
Prepares common form data
[ "Prepares", "common", "form", "data" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ReorderController.php#L165-L172
train
Prepare the order variables for the page
[ 30522, 5123, 3853, 7374, 10755, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 13075, 2015, 1031, 1005, 2128, 8551, 28849, 27108, 5104, 1005, 1033, 1027, 1002, 2023, 1011, 1028, 2131, 2890, 27108, 5104, 1006, 1007, 1025, 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/Router.php
Router.apiResources
public function apiResources(array $resources, array $options = []) { foreach ($resources as $name => $controller) { $this->apiResource($name, $controller, $options); } }
php
public function apiResources(array $resources, array $options = []) { foreach ($resources as $name => $controller) { $this->apiResource($name, $controller, $options); } }
[ "public", "function", "apiResources", "(", "array", "$", "resources", ",", "array", "$", "options", "=", "[", "]", ")", "{", "foreach", "(", "$", "resources", "as", "$", "name", "=>", "$", "controller", ")", "{", "$", "this", "->", "apiResource", "(", ...
Register an array of API resource controllers. @param array $resources @param array $options @return void
[ "Register", "an", "array", "of", "API", "resource", "controllers", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L331-L336
train
Add a list of resources to the api
[ 30522, 2270, 3853, 17928, 6072, 8162, 9623, 1006, 9140, 1002, 4219, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 18921, 6776, 1006, 1002, 4219, 2004, 1002, 2171, 1027, 1028, 1002, 11486, 1007, 1063, 1002, 2023, 1011, 1028, 17928, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Command/Command.php
Command.getSynopsis
public function getSynopsis($short = false) { $key = $short ? 'short' : 'long'; if (!isset($this->synopsis[$key])) { $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short))); } return $this->synopsis[$key]; }
php
public function getSynopsis($short = false) { $key = $short ? 'short' : 'long'; if (!isset($this->synopsis[$key])) { $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short))); } return $this->synopsis[$key]; }
[ "public", "function", "getSynopsis", "(", "$", "short", "=", "false", ")", "{", "$", "key", "=", "$", "short", "?", "'short'", ":", "'long'", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "synopsis", "[", "$", "key", "]", ")", ")", "{", ...
Returns the synopsis for the command. @param bool $short Whether to show the short version of the synopsis (with options folded) or not @return string The synopsis
[ "Returns", "the", "synopsis", "for", "the", "command", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Command/Command.php#L583-L592
train
Returns the synopsis of the rule
[ 30522, 2270, 3853, 4152, 6038, 22599, 1006, 1002, 2460, 1027, 6270, 1007, 1063, 1002, 3145, 1027, 1002, 2460, 1029, 1005, 2460, 1005, 1024, 1005, 2146, 1005, 1025, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 19962, 22599, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Workflow/EventListener/GuardListener.php
GuardListener.getVariables
private function getVariables(GuardEvent $event): array { $token = $this->tokenStorage->getToken(); if (null === $token) { throw new InvalidTokenConfigurationException(sprintf('There are no tokens available for workflow %s.', $event->getWorkflowName())); } if (method_exists($token, 'getRoleNames')) { $roleNames = $token->getRoleNames(); $roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames); } else { @trigger_error(sprintf('Not implementing the getRoleNames() method in %s which implements %s is deprecated since Symfony 4.3.', \get_class($token), TokenInterface::class), E_USER_DEPRECATED); $roles = $token->getRoles(false); $roleNames = array_map(function (Role $role) { return $role->getRole(); }, $roles); } if (null !== $this->roleHierarchy && method_exists($this->roleHierarchy, 'getReachableRoleNames')) { $roleNames = $this->roleHierarchy->getReachableRoleNames($roleNames); $roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames); } elseif (null !== $this->roleHierarchy) { $roles = $this->roleHierarchy->getReachableRoles($roles); $roleNames = array_map(function (Role $role) { return $role->getRole(); }, $roles); } $variables = [ 'token' => $token, 'user' => $token->getUser(), 'subject' => $event->getSubject(), 'roles' => $roles, 'role_names' => $roleNames, // needed for the is_granted expression function 'auth_checker' => $this->authorizationChecker, // needed for the is_* expression function 'trust_resolver' => $this->trustResolver, // needed for the is_valid expression function 'validator' => $this->validator, ]; return $variables; }
php
private function getVariables(GuardEvent $event): array { $token = $this->tokenStorage->getToken(); if (null === $token) { throw new InvalidTokenConfigurationException(sprintf('There are no tokens available for workflow %s.', $event->getWorkflowName())); } if (method_exists($token, 'getRoleNames')) { $roleNames = $token->getRoleNames(); $roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames); } else { @trigger_error(sprintf('Not implementing the getRoleNames() method in %s which implements %s is deprecated since Symfony 4.3.', \get_class($token), TokenInterface::class), E_USER_DEPRECATED); $roles = $token->getRoles(false); $roleNames = array_map(function (Role $role) { return $role->getRole(); }, $roles); } if (null !== $this->roleHierarchy && method_exists($this->roleHierarchy, 'getReachableRoleNames')) { $roleNames = $this->roleHierarchy->getReachableRoleNames($roleNames); $roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames); } elseif (null !== $this->roleHierarchy) { $roles = $this->roleHierarchy->getReachableRoles($roles); $roleNames = array_map(function (Role $role) { return $role->getRole(); }, $roles); } $variables = [ 'token' => $token, 'user' => $token->getUser(), 'subject' => $event->getSubject(), 'roles' => $roles, 'role_names' => $roleNames, // needed for the is_granted expression function 'auth_checker' => $this->authorizationChecker, // needed for the is_* expression function 'trust_resolver' => $this->trustResolver, // needed for the is_valid expression function 'validator' => $this->validator, ]; return $variables; }
[ "private", "function", "getVariables", "(", "GuardEvent", "$", "event", ")", ":", "array", "{", "$", "token", "=", "$", "this", "->", "tokenStorage", "->", "getToken", "(", ")", ";", "if", "(", "null", "===", "$", "token", ")", "{", "throw", "new", "...
code should be sync with Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter
[ "code", "should", "be", "sync", "with", "Symfony", "\\", "Component", "\\", "Security", "\\", "Core", "\\", "Authorization", "\\", "Voter", "\\", "ExpressionVoter" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/EventListener/GuardListener.php#L81-L122
train
Returns the variables that should be used to create the workflow.
[ 30522, 2797, 3853, 2131, 10755, 19210, 2015, 1006, 3457, 18697, 3372, 1002, 2724, 1007, 1024, 9140, 1063, 1002, 19204, 1027, 1002, 2023, 1011, 1028, 19204, 23809, 4270, 1011, 1028, 2131, 18715, 2368, 1006, 1007, 1025, 2065, 1006, 19701, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataAccess/LogAggregator.php
LogAggregator.getSelectsFromRangedColumn
public static function getSelectsFromRangedColumn($column, $ranges, $table, $selectColumnPrefix, $restrictToReturningVisitors = false) { $selects = array(); $extraCondition = ''; if ($restrictToReturningVisitors) { // extra condition for the SQL SELECT that makes sure only returning visits are counted // when creating the 'days since last visit' report $extraCondition = 'and log_visit.visitor_returning = 1'; $extraSelect = "sum(case when log_visit.visitor_returning = 0 then 1 else 0 end) " . " as `" . $selectColumnPrefix . 'General_NewVisits' . "`"; $selects[] = $extraSelect; } foreach ($ranges as $gap) { if (count($gap) == 2) { $lowerBound = $gap[0]; $upperBound = $gap[1]; $selectAs = "$selectColumnPrefix$lowerBound-$upperBound"; $selects[] = "sum(case when $table.$column between $lowerBound and $upperBound $extraCondition" . " then 1 else 0 end) as `$selectAs`"; } else { $lowerBound = $gap[0]; $selectAs = $selectColumnPrefix . ($lowerBound + 1) . urlencode('+'); $selects[] = "sum(case when $table.$column > $lowerBound $extraCondition then 1 else 0 end) as `$selectAs`"; } } return $selects; }
php
public static function getSelectsFromRangedColumn($column, $ranges, $table, $selectColumnPrefix, $restrictToReturningVisitors = false) { $selects = array(); $extraCondition = ''; if ($restrictToReturningVisitors) { // extra condition for the SQL SELECT that makes sure only returning visits are counted // when creating the 'days since last visit' report $extraCondition = 'and log_visit.visitor_returning = 1'; $extraSelect = "sum(case when log_visit.visitor_returning = 0 then 1 else 0 end) " . " as `" . $selectColumnPrefix . 'General_NewVisits' . "`"; $selects[] = $extraSelect; } foreach ($ranges as $gap) { if (count($gap) == 2) { $lowerBound = $gap[0]; $upperBound = $gap[1]; $selectAs = "$selectColumnPrefix$lowerBound-$upperBound"; $selects[] = "sum(case when $table.$column between $lowerBound and $upperBound $extraCondition" . " then 1 else 0 end) as `$selectAs`"; } else { $lowerBound = $gap[0]; $selectAs = $selectColumnPrefix . ($lowerBound + 1) . urlencode('+'); $selects[] = "sum(case when $table.$column > $lowerBound $extraCondition then 1 else 0 end) as `$selectAs`"; } } return $selects; }
[ "public", "static", "function", "getSelectsFromRangedColumn", "(", "$", "column", ",", "$", "ranges", ",", "$", "table", ",", "$", "selectColumnPrefix", ",", "$", "restrictToReturningVisitors", "=", "false", ")", "{", "$", "selects", "=", "array", "(", ")", ...
Creates and returns an array of SQL `SELECT` expressions that will each count how many rows have a column whose value is within a certain range. **Note:** The result of this function is meant for use in the `$additionalSelects` parameter in one of the query... methods (for example {@link queryVisitsByDimension()}). **Example** // summarize one column $visitTotalActionsRanges = array( array(1, 1), array(2, 10), array(10) ); $selects = LogAggregator::getSelectsFromRangedColumn('visit_total_actions', $visitTotalActionsRanges, 'log_visit', 'vta'); // summarize another column in the same request $visitCountVisitsRanges = array( array(1, 1), array(2, 20), array(20) ); $selects = array_merge( $selects, LogAggregator::getSelectsFromRangedColumn('visitor_count_visits', $visitCountVisitsRanges, 'log_visit', 'vcv') ); // perform the query $logAggregator = // get the LogAggregator somehow $query = $logAggregator->queryVisitsByDimension($dimensions = array(), $where = false, $selects); $tableSummary = $query->fetch(); $numberOfVisitsWithOneAction = $tableSummary['vta0']; $numberOfVisitsBetweenTwoAnd10 = $tableSummary['vta1']; $numberOfVisitsWithVisitCountOfOne = $tableSummary['vcv0']; @param string $column The name of a column in `$table` that will be summarized. @param array $ranges The array of ranges over which the data in the table will be summarized. For example, ``` array( array(1, 1), array(2, 2), array(3, 8), array(8) // everything over 8 ) ``` @param string $table The unprefixed name of the table whose rows will be summarized. @param string $selectColumnPrefix The prefix to prepend to each SELECT expression. This prefix is used to differentiate different sets of range summarization SELECTs. You can supply different values to this argument to summarize several columns in one query (see above for an example). @param bool $restrictToReturningVisitors Whether to only summarize rows that belong to visits of returning visitors or not. If this argument is true, then the SELECT expressions returned can only be used with the {@link queryVisitsByDimension()} method. @return array An array of SQL SELECT expressions, for example, ``` array( 'sum(case when log_visit.visit_total_actions between 0 and 2 then 1 else 0 end) as vta0', 'sum(case when log_visit.visit_total_actions > 2 then 1 else 0 end) as vta1' ) ``` @api
[ "Creates", "and", "returns", "an", "array", "of", "SQL", "SELECT", "expressions", "that", "will", "each", "count", "how", "many", "rows", "have", "a", "column", "whose", "value", "is", "within", "a", "certain", "range", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/LogAggregator.php#L894-L926
train
Returns the SELECTs for a given column range
[ 30522, 2270, 10763, 3853, 4152, 12260, 16649, 19699, 5358, 24388, 2098, 25778, 2819, 2078, 1006, 1002, 5930, 1010, 1002, 8483, 1010, 1002, 2795, 1010, 1002, 7276, 25778, 2819, 16275, 2890, 8873, 2595, 1010, 1002, 21573, 19277, 22299, 2075, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Adapter/PDFLib.php
PDFLib._place_objects
protected function _place_objects() { foreach ($this->_objs as $obj => $props) { $start = $props["start_page"]; $where = $props["where"]; // Place the object on this page if required if ($this->_page_number >= $start && (($this->_page_number % 2 == 0 && $where === "even") || ($this->_page_number % 2 == 1 && $where === "odd") || ($where === "all")) ) { $this->_pdf->fit_image($obj, 0, 0, ""); } } }
php
protected function _place_objects() { foreach ($this->_objs as $obj => $props) { $start = $props["start_page"]; $where = $props["where"]; // Place the object on this page if required if ($this->_page_number >= $start && (($this->_page_number % 2 == 0 && $where === "even") || ($this->_page_number % 2 == 1 && $where === "odd") || ($where === "all")) ) { $this->_pdf->fit_image($obj, 0, 0, ""); } } }
[ "protected", "function", "_place_objects", "(", ")", "{", "foreach", "(", "$", "this", "->", "_objs", "as", "$", "obj", "=>", "$", "props", ")", "{", "$", "start", "=", "$", "props", "[", "\"start_page\"", "]", ";", "$", "where", "=", "$", "props", ...
Add all active objects to the current page
[ "Add", "all", "active", "objects", "to", "the", "current", "page" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/PDFLib.php#L437-L454
train
place the objects on the page if required
[ 30522, 5123, 3853, 1035, 2173, 1035, 5200, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 1035, 27885, 22578, 2004, 1002, 27885, 3501, 1027, 1028, 1002, 24387, 1007, 30524, 24387, 1031, 1000, 2707, 1035, 3931, 1000, 1033, 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...
getgrav/grav
system/src/Grav/Common/Filesystem/Folder.php
Folder.lastModifiedFolder
public static function lastModifiedFolder($path) { $last_modified = 0; /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $flags = \RecursiveDirectoryIterator::SKIP_DOTS; if ($locator->isStream($path)) { $directory = $locator->getRecursiveIterator($path, $flags); } else { $directory = new \RecursiveDirectoryIterator($path, $flags); } $filter = new RecursiveFolderFilterIterator($directory); $iterator = new \RecursiveIteratorIterator($filter, \RecursiveIteratorIterator::SELF_FIRST); /** @var \RecursiveDirectoryIterator $file */ foreach ($iterator as $dir) { $dir_modified = $dir->getMTime(); if ($dir_modified > $last_modified) { $last_modified = $dir_modified; } } return $last_modified; }
php
public static function lastModifiedFolder($path) { $last_modified = 0; /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $flags = \RecursiveDirectoryIterator::SKIP_DOTS; if ($locator->isStream($path)) { $directory = $locator->getRecursiveIterator($path, $flags); } else { $directory = new \RecursiveDirectoryIterator($path, $flags); } $filter = new RecursiveFolderFilterIterator($directory); $iterator = new \RecursiveIteratorIterator($filter, \RecursiveIteratorIterator::SELF_FIRST); /** @var \RecursiveDirectoryIterator $file */ foreach ($iterator as $dir) { $dir_modified = $dir->getMTime(); if ($dir_modified > $last_modified) { $last_modified = $dir_modified; } } return $last_modified; }
[ "public", "static", "function", "lastModifiedFolder", "(", "$", "path", ")", "{", "$", "last_modified", "=", "0", ";", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "$", "fla...
Recursively find the last modified time under given path. @param string $path @return int
[ "Recursively", "find", "the", "last", "modified", "time", "under", "given", "path", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Filesystem/Folder.php#L23-L47
train
Get the last modified time of a folder
[ 30522, 2270, 10763, 3853, 2197, 5302, 4305, 10451, 10371, 2121, 1006, 1002, 4130, 1007, 1063, 1002, 2197, 1035, 6310, 1027, 1014, 1025, 1013, 1008, 1008, 1030, 13075, 6375, 6072, 8162, 29109, 24755, 4263, 1002, 8840, 11266, 2953, 1008, 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...
laravel/framework
src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php
LogBroadcaster.broadcast
public function broadcast(array $channels, $event, array $payload = []) { $channels = implode(', ', $this->formatChannels($channels)); $payload = json_encode($payload, JSON_PRETTY_PRINT); $this->logger->info('Broadcasting ['.$event.'] on channels ['.$channels.'] with payload:'.PHP_EOL.$payload); }
php
public function broadcast(array $channels, $event, array $payload = []) { $channels = implode(', ', $this->formatChannels($channels)); $payload = json_encode($payload, JSON_PRETTY_PRINT); $this->logger->info('Broadcasting ['.$event.'] on channels ['.$channels.'] with payload:'.PHP_EOL.$payload); }
[ "public", "function", "broadcast", "(", "array", "$", "channels", ",", "$", "event", ",", "array", "$", "payload", "=", "[", "]", ")", "{", "$", "channels", "=", "implode", "(", "', '", ",", "$", "this", "->", "formatChannels", "(", "$", "channels", ...
{@inheritdoc}
[ "{" ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php#L46-L53
train
Broadcast an event to all channels
[ 30522, 2270, 3853, 3743, 1006, 9140, 1002, 6833, 1010, 1002, 2724, 1010, 9140, 1002, 18093, 1027, 1031, 1033, 1007, 1063, 1002, 6833, 1027, 17727, 4135, 3207, 1006, 1005, 1010, 1005, 1010, 1002, 2023, 1011, 1028, 4289, 26058, 2015, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/ClassMetadata.php
ClassMetadata.getReflectionClass
public function getReflectionClass() { if (!$this->reflClass) { $this->reflClass = new \ReflectionClass($this->getClassName()); } return $this->reflClass; }
php
public function getReflectionClass() { if (!$this->reflClass) { $this->reflClass = new \ReflectionClass($this->getClassName()); } return $this->reflClass; }
[ "public", "function", "getReflectionClass", "(", ")", "{", "if", "(", "!", "$", "this", "->", "reflClass", ")", "{", "$", "this", "->", "reflClass", "=", "new", "\\", "ReflectionClass", "(", "$", "this", "->", "getClassName", "(", ")", ")", ";", "}", ...
Returns a ReflectionClass instance for this class. @return \ReflectionClass
[ "Returns", "a", "ReflectionClass", "instance", "for", "this", "class", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/ClassMetadata.php#L445-L452
train
Get reflection class
[ 30522, 2270, 3853, 2131, 2890, 21031, 7542, 26266, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 25416, 15472, 27102, 1007, 1063, 1002, 2023, 1011, 1028, 25416, 15472, 27102, 1027, 2047, 1032, 9185, 26266, 1006, 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...
getgrav/grav
system/src/Grav/Common/Scheduler/Scheduler.php
Scheduler.run
public function run(\DateTime $runTime = null) { $this->loadSavedJobs(); list($background, $foreground) = $this->getQueuedJobs(false); $alljobs = array_merge($background, $foreground); if (null === $runTime) { $runTime = new \DateTime('now'); } // Star processing jobs foreach ($alljobs as $job) { if ($job->isDue($runTime)) { $job->run(); $this->jobs_run[] = $job; } } // Finish handling any background jobs foreach($background as $job) { $job->finalize(); } // Store states $this->saveJobStates(); }
php
public function run(\DateTime $runTime = null) { $this->loadSavedJobs(); list($background, $foreground) = $this->getQueuedJobs(false); $alljobs = array_merge($background, $foreground); if (null === $runTime) { $runTime = new \DateTime('now'); } // Star processing jobs foreach ($alljobs as $job) { if ($job->isDue($runTime)) { $job->run(); $this->jobs_run[] = $job; } } // Finish handling any background jobs foreach($background as $job) { $job->finalize(); } // Store states $this->saveJobStates(); }
[ "public", "function", "run", "(", "\\", "DateTime", "$", "runTime", "=", "null", ")", "{", "$", "this", "->", "loadSavedJobs", "(", ")", ";", "list", "(", "$", "background", ",", "$", "foreground", ")", "=", "$", "this", "->", "getQueuedJobs", "(", "...
Run the scheduler. @param \DateTime|null $runTime Optional, run at specific moment
[ "Run", "the", "scheduler", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Scheduler.php#L155-L181
train
Runs all jobs due to run
[ 30522, 2270, 3853, 2448, 1006, 1032, 3058, 7292, 1002, 2448, 7292, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 15665, 10696, 2094, 5558, 5910, 1006, 1007, 1025, 2862, 1006, 1002, 4281, 1010, 1002, 18921, 16365, 1007, 1027, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Mime/Encoder/Base64Encoder.php
Base64Encoder.encodeString
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string { if (0 >= $maxLineLength || 76 < $maxLineLength) { $maxLineLength = 76; } $encodedString = base64_encode($string); $firstLine = ''; if (0 !== $firstLineOffset) { $firstLine = substr($encodedString, 0, $maxLineLength - $firstLineOffset)."\r\n"; $encodedString = substr($encodedString, $maxLineLength - $firstLineOffset); } return $firstLine.trim(chunk_split($encodedString, $maxLineLength, "\r\n")); }
php
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string { if (0 >= $maxLineLength || 76 < $maxLineLength) { $maxLineLength = 76; } $encodedString = base64_encode($string); $firstLine = ''; if (0 !== $firstLineOffset) { $firstLine = substr($encodedString, 0, $maxLineLength - $firstLineOffset)."\r\n"; $encodedString = substr($encodedString, $maxLineLength - $firstLineOffset); } return $firstLine.trim(chunk_split($encodedString, $maxLineLength, "\r\n")); }
[ "public", "function", "encodeString", "(", "string", "$", "string", ",", "?", "string", "$", "charset", "=", "'utf-8'", ",", "int", "$", "firstLineOffset", "=", "0", ",", "int", "$", "maxLineLength", "=", "0", ")", ":", "string", "{", "if", "(", "0", ...
Takes an unencoded string and produces a Base64 encoded string from it. Base64 encoded strings have a maximum line length of 76 characters. If the first line needs to be shorter, indicate the difference with $firstLineOffset.
[ "Takes", "an", "unencoded", "string", "and", "produces", "a", "Base64", "encoded", "string", "from", "it", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Encoder/Base64Encoder.php#L28-L42
train
Encodes a string to a string of charset UTF - 8
[ 30522, 2270, 3853, 4372, 23237, 18886, 3070, 1006, 5164, 1002, 5164, 1010, 1029, 5164, 1002, 25869, 13462, 1027, 1005, 21183, 2546, 1011, 1022, 1005, 1010, 20014, 1002, 2034, 30524, 4179, 7770, 13512, 2232, 1027, 1014, 1007, 1024, 5164, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php
DelegatingEngine.renderResponse
public function renderResponse($view, array $parameters = [], Response $response = null) { $engine = $this->getEngine($view); if ($engine instanceof EngineInterface) { return $engine->renderResponse($view, $parameters, $response); } if (null === $response) { $response = new Response(); } $response->setContent($engine->render($view, $parameters)); return $response; }
php
public function renderResponse($view, array $parameters = [], Response $response = null) { $engine = $this->getEngine($view); if ($engine instanceof EngineInterface) { return $engine->renderResponse($view, $parameters, $response); } if (null === $response) { $response = new Response(); } $response->setContent($engine->render($view, $parameters)); return $response; }
[ "public", "function", "renderResponse", "(", "$", "view", ",", "array", "$", "parameters", "=", "[", "]", ",", "Response", "$", "response", "=", "null", ")", "{", "$", "engine", "=", "$", "this", "->", "getEngine", "(", "$", "view", ")", ";", "if", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php#L50-L65
train
Render Response.
[ 30522, 2270, 3853, 17552, 6072, 26029, 3366, 1006, 1002, 3193, 1010, 9140, 1002, 11709, 1027, 1031, 1033, 1010, 3433, 1002, 3433, 1027, 19701, 1007, 1063, 1002, 3194, 1027, 1002, 2023, 1011, 1028, 2131, 13159, 3170, 1006, 1002, 3193, 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/Events/Dispatcher.php
Dispatcher.hasListeners
public function hasListeners($eventName) { return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]); }
php
public function hasListeners($eventName) { return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]); }
[ "public", "function", "hasListeners", "(", "$", "eventName", ")", "{", "return", "isset", "(", "$", "this", "->", "listeners", "[", "$", "eventName", "]", ")", "||", "isset", "(", "$", "this", "->", "wildcards", "[", "$", "eventName", "]", ")", ";", ...
Determine if a given event has listeners. @param string $eventName @return bool
[ "Determine", "if", "a", "given", "event", "has", "listeners", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Events/Dispatcher.php#L102-L105
train
Checks if an event has listeners or wildcards
[ 30522, 2270, 3853, 2038, 9863, 24454, 2015, 1006, 1002, 2724, 18442, 1007, 1063, 2709, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 13810, 1031, 1002, 2724, 18442, 1033, 1007, 1064, 1064, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3748, 17965...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Overlay/API.php
API.getFollowingPages
public function getFollowingPages($url, $idSite, $period, $date, $segment = false) { $url = PageUrl::excludeQueryParametersFromUrl($url, $idSite); // we don't unsanitize $url here. it will be done in the Transitions plugin. $resultDataTable = new DataTable; try { $limitBeforeGrouping = Config::getInstance()->General['overlay_following_pages_limit']; $transitionsReport = APITransitions::getInstance()->getTransitionsForAction( $url, $type = 'url', $idSite, $period, $date, $segment, $limitBeforeGrouping, $part = 'followingActions'); } catch (Exception $e) { return $resultDataTable; } $reports = array('followingPages', 'outlinks', 'downloads'); foreach ($reports as $reportName) { if (!isset($transitionsReport[$reportName])) { continue; } foreach ($transitionsReport[$reportName]->getRows() as $row) { // don't touch the row at all for performance reasons $resultDataTable->addRow($row); } } return $resultDataTable; }
php
public function getFollowingPages($url, $idSite, $period, $date, $segment = false) { $url = PageUrl::excludeQueryParametersFromUrl($url, $idSite); // we don't unsanitize $url here. it will be done in the Transitions plugin. $resultDataTable = new DataTable; try { $limitBeforeGrouping = Config::getInstance()->General['overlay_following_pages_limit']; $transitionsReport = APITransitions::getInstance()->getTransitionsForAction( $url, $type = 'url', $idSite, $period, $date, $segment, $limitBeforeGrouping, $part = 'followingActions'); } catch (Exception $e) { return $resultDataTable; } $reports = array('followingPages', 'outlinks', 'downloads'); foreach ($reports as $reportName) { if (!isset($transitionsReport[$reportName])) { continue; } foreach ($transitionsReport[$reportName]->getRows() as $row) { // don't touch the row at all for performance reasons $resultDataTable->addRow($row); } } return $resultDataTable; }
[ "public", "function", "getFollowingPages", "(", "$", "url", ",", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "segment", "=", "false", ")", "{", "$", "url", "=", "PageUrl", "::", "excludeQueryParametersFromUrl", "(", "$", "url", ",", ...
Get following pages of a url. This is done on the logs - not the archives! Note: if you use this method via the regular API, the number of results will be limited. Make sure, you set filter_limit=-1 in the request.
[ "Get", "following", "pages", "of", "a", "url", ".", "This", "is", "done", "on", "the", "logs", "-", "not", "the", "archives!" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Overlay/API.php#L65-L93
train
Get following pages
[ 30522, 2270, 3853, 2131, 14876, 7174, 9328, 13704, 2015, 1006, 1002, 24471, 2140, 1010, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 6903, 1027, 6270, 1007, 1063, 1002, 24471, 2140, 1027, 3931, 3126, 2140, 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...
symfony/symfony
src/Symfony/Component/Intl/ResourceBundle.php
ResourceBundle.readEntry
final protected static function readEntry(array $indices, string $locale = null, bool $fallback = true) { if (null === self::$entryReader) { self::$entryReader = new BundleEntryReader(new BufferedBundleReader( new JsonBundleReader(), Intl::BUFFER_SIZE )); $localeAliases = self::$entryReader->readEntry(Intl::getDataDirectory().'/'.Intl::LOCALE_DIR, 'meta', ['Aliases']); self::$entryReader->setLocaleAliases($localeAliases instanceof \Traversable ? iterator_to_array($localeAliases) : $localeAliases); } return self::$entryReader->readEntry(static::getPath(), $locale ?? \Locale::getDefault(), $indices, $fallback); }
php
final protected static function readEntry(array $indices, string $locale = null, bool $fallback = true) { if (null === self::$entryReader) { self::$entryReader = new BundleEntryReader(new BufferedBundleReader( new JsonBundleReader(), Intl::BUFFER_SIZE )); $localeAliases = self::$entryReader->readEntry(Intl::getDataDirectory().'/'.Intl::LOCALE_DIR, 'meta', ['Aliases']); self::$entryReader->setLocaleAliases($localeAliases instanceof \Traversable ? iterator_to_array($localeAliases) : $localeAliases); } return self::$entryReader->readEntry(static::getPath(), $locale ?? \Locale::getDefault(), $indices, $fallback); }
[ "final", "protected", "static", "function", "readEntry", "(", "array", "$", "indices", ",", "string", "$", "locale", "=", "null", ",", "bool", "$", "fallback", "=", "true", ")", "{", "if", "(", "null", "===", "self", "::", "$", "entryReader", ")", "{",...
Reads an entry from a resource bundle. @see BundleEntryReaderInterface::readEntry() @param string[] $indices The indices to read from the bundle @param string $locale The locale to read @param bool $fallback Whether to merge the value with the value from the fallback locale (e.g. "en" for "en_GB"). Only applicable if the result is multivalued (i.e. array or \ArrayAccess) or cannot be found in the requested locale. @return mixed returns an array or {@link \ArrayAccess} instance for complex data and a scalar value for simple data
[ "Reads", "an", "entry", "from", "a", "resource", "bundle", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/ResourceBundle.php#L46-L59
train
Reads the entry from the bundle
[ 30522, 2345, 5123, 10763, 3853, 3191, 4765, 2854, 1006, 9140, 1002, 29299, 1010, 5164, 1002, 2334, 2063, 1027, 19701, 1010, 22017, 2140, 1002, 2991, 5963, 1027, 2995, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 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...
matomo-org/matomo
core/NumberFormatter.php
NumberFormatter.formatPercent
public function formatPercent($value, $maximumFractionDigits=0, $minimumFractionDigits=0) { $newValue = trim($value, " \0\x0B%"); if (!is_numeric($newValue)) { return $value; } $pattern = $this->getPattern($value, 'Intl_NumberFormatPercent'); return $this->formatNumberWithPattern($pattern, $newValue, $maximumFractionDigits, $minimumFractionDigits); }
php
public function formatPercent($value, $maximumFractionDigits=0, $minimumFractionDigits=0) { $newValue = trim($value, " \0\x0B%"); if (!is_numeric($newValue)) { return $value; } $pattern = $this->getPattern($value, 'Intl_NumberFormatPercent'); return $this->formatNumberWithPattern($pattern, $newValue, $maximumFractionDigits, $minimumFractionDigits); }
[ "public", "function", "formatPercent", "(", "$", "value", ",", "$", "maximumFractionDigits", "=", "0", ",", "$", "minimumFractionDigits", "=", "0", ")", "{", "$", "newValue", "=", "trim", "(", "$", "value", ",", "\" \\0\\x0B%\"", ")", ";", "if", "(", "!"...
Formats given number as percent value @param string|int|float $value @param int $maximumFractionDigits @param int $minimumFractionDigits @return mixed|string
[ "Formats", "given", "number", "as", "percent", "value" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/NumberFormatter.php#L87-L97
train
Format a value with a percentage format
[ 30522, 2270, 3853, 4289, 4842, 13013, 1006, 1002, 3643, 1010, 1002, 4555, 27843, 7542, 4305, 23806, 2015, 1027, 1014, 1010, 1002, 6263, 27843, 7542, 4305, 23806, 2015, 1027, 1014, 1007, 1063, 1002, 2047, 10175, 5657, 1027, 12241, 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...
octobercms/october
modules/system/classes/MediaLibrary.php
MediaLibrary.put
public function put($path, $contents) { $path = self::validatePath($path); $fullPath = $this->getMediaPath($path); return $this->getStorageDisk()->put($fullPath, $contents); }
php
public function put($path, $contents) { $path = self::validatePath($path); $fullPath = $this->getMediaPath($path); return $this->getStorageDisk()->put($fullPath, $contents); }
[ "public", "function", "put", "(", "$", "path", ",", "$", "contents", ")", "{", "$", "path", "=", "self", "::", "validatePath", "(", "$", "path", ")", ";", "$", "fullPath", "=", "$", "this", "->", "getMediaPath", "(", "$", "path", ")", ";", "return"...
Puts a file to the library. @param string $path Specifies the file path relative the the Library root. @param string $contents Specifies the file contents. @return boolean
[ "Puts", "a", "file", "to", "the", "library", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L322-L327
train
Put content to the file
[ 30522, 2270, 3853, 2404, 1006, 1002, 4130, 1010, 1002, 8417, 1007, 1063, 1002, 4130, 1027, 2969, 1024, 1024, 9398, 3686, 15069, 1006, 1002, 4130, 1007, 1025, 1002, 2440, 15069, 1027, 1002, 2023, 1011, 1028, 2131, 16969, 15069, 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/DomCrawler/Crawler.php
Crawler.addXmlContent
public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET) { // remove the default namespace if it's the only namespace to make XPath expressions simpler if (!preg_match('/xmlns:/', $content)) { $content = str_replace('xmlns', 'ns', $content); } $internalErrors = libxml_use_internal_errors(true); $disableEntities = libxml_disable_entity_loader(true); $dom = new \DOMDocument('1.0', $charset); $dom->validateOnParse = true; if ('' !== trim($content)) { @$dom->loadXML($content, $options); } libxml_use_internal_errors($internalErrors); libxml_disable_entity_loader($disableEntities); $this->addDocument($dom); $this->isHtml = false; }
php
public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET) { // remove the default namespace if it's the only namespace to make XPath expressions simpler if (!preg_match('/xmlns:/', $content)) { $content = str_replace('xmlns', 'ns', $content); } $internalErrors = libxml_use_internal_errors(true); $disableEntities = libxml_disable_entity_loader(true); $dom = new \DOMDocument('1.0', $charset); $dom->validateOnParse = true; if ('' !== trim($content)) { @$dom->loadXML($content, $options); } libxml_use_internal_errors($internalErrors); libxml_disable_entity_loader($disableEntities); $this->addDocument($dom); $this->isHtml = false; }
[ "public", "function", "addXmlContent", "(", "$", "content", ",", "$", "charset", "=", "'UTF-8'", ",", "$", "options", "=", "LIBXML_NONET", ")", "{", "// remove the default namespace if it's the only namespace to make XPath expressions simpler", "if", "(", "!", "preg_match...
Adds an XML content to the list of nodes. The libxml errors are disabled when the content is parsed. If you want to get parsing errors, be sure to enable internal errors via libxml_use_internal_errors(true) and then, get the errors via libxml_get_errors(). Be sure to clear errors with libxml_clear_errors() afterward. @param string $content The XML content @param string $charset The charset @param int $options Bitwise OR of the libxml option constants LIBXML_PARSEHUGE is dangerous, see http://symfony.com/blog/security-release-symfony-2-0-17-released
[ "Adds", "an", "XML", "content", "to", "the", "list", "of", "nodes", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L233-L256
train
Adds a XML content to the list of nodes
[ 30522, 2270, 3853, 5587, 2595, 19968, 8663, 6528, 2102, 1006, 1002, 4180, 1010, 1002, 25869, 13462, 1027, 1005, 21183, 2546, 1011, 1022, 1005, 1010, 1002, 7047, 1027, 5622, 2497, 2595, 19968, 1035, 3904, 2102, 1007, 1063, 1013, 1013, 6366, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/VendorPublishCommand.php
VendorPublishCommand.moveManagedFiles
protected function moveManagedFiles($manager) { foreach ($manager->listContents('from://', true) as $file) { if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) { $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); } } }
php
protected function moveManagedFiles($manager) { foreach ($manager->listContents('from://', true) as $file) { if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) { $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); } } }
[ "protected", "function", "moveManagedFiles", "(", "$", "manager", ")", "{", "foreach", "(", "$", "manager", "->", "listContents", "(", "'from://'", ",", "true", ")", "as", "$", "file", ")", "{", "if", "(", "$", "file", "[", "'type'", "]", "===", "'file...
Move all the files in the given MountManager. @param \League\Flysystem\MountManager $manager @return void
[ "Move", "all", "the", "files", "in", "the", "given", "MountManager", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/VendorPublishCommand.php#L237-L244
train
Move all files from the manager to the new location
[ 30522, 5123, 3853, 2693, 24805, 5999, 8873, 4244, 1006, 1002, 3208, 1007, 1063, 18921, 6776, 1006, 1002, 3208, 1011, 1028, 2862, 8663, 6528, 3215, 1006, 1005, 2013, 1024, 1013, 1013, 1005, 1010, 2995, 1007, 2004, 1002, 5371, 1007, 1063, 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...
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.measureTime
public function measureTime(string $timerId, string $timerTitle, callable $callback) { $debugger = $this['debugger']; $debugger->startTimer($timerId, $timerTitle); $result = $callback(); $debugger->stopTimer($timerId); return $result; }
php
public function measureTime(string $timerId, string $timerTitle, callable $callback) { $debugger = $this['debugger']; $debugger->startTimer($timerId, $timerTitle); $result = $callback(); $debugger->stopTimer($timerId); return $result; }
[ "public", "function", "measureTime", "(", "string", "$", "timerId", ",", "string", "$", "timerTitle", ",", "callable", "$", "callback", ")", "{", "$", "debugger", "=", "$", "this", "[", "'debugger'", "]", ";", "$", "debugger", "->", "startTimer", "(", "$...
Measure how long it takes to do an action. @param string $timerId @param string $timerTitle @param callable $callback @return mixed Returns value returned by the callable.
[ "Measure", "how", "long", "it", "takes", "to", "do", "an", "action", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L445-L453
train
Measure time of a timer
[ 30522, 2270, 3853, 5468, 7292, 1006, 5164, 1002, 25309, 3593, 1010, 5164, 1002, 25309, 3775, 9286, 1010, 2655, 3085, 1002, 2655, 5963, 1007, 1063, 1002, 2139, 8569, 13327, 1027, 1002, 2023, 1031, 1005, 2139, 8569, 13327, 1005, 1033, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
ServerStatusCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); $server = new WebServer($this->pidFileDirectory); if ($filter = $input->getOption('filter')) { if ($server->isRunning($input->getOption('pidfile'))) { list($host, $port) = explode(':', $address = $server->getAddress($input->getOption('pidfile'))); if ('address' === $filter) { $output->write($address); } elseif ('host' === $filter) { $output->write($host); } elseif ('port' === $filter) { $output->write($port); } else { throw new InvalidArgumentException(sprintf('"%s" is not a valid filter.', $filter)); } } else { return 1; } } else { if ($server->isRunning($input->getOption('pidfile'))) { $io->success(sprintf('Web server still listening on http://%s', $server->getAddress($input->getOption('pidfile')))); } else { $io->warning('No web server is listening.'); return 1; } } }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); $server = new WebServer($this->pidFileDirectory); if ($filter = $input->getOption('filter')) { if ($server->isRunning($input->getOption('pidfile'))) { list($host, $port) = explode(':', $address = $server->getAddress($input->getOption('pidfile'))); if ('address' === $filter) { $output->write($address); } elseif ('host' === $filter) { $output->write($host); } elseif ('port' === $filter) { $output->write($port); } else { throw new InvalidArgumentException(sprintf('"%s" is not a valid filter.', $filter)); } } else { return 1; } } else { if ($server->isRunning($input->getOption('pidfile'))) { $io->success(sprintf('Web server still listening on http://%s', $server->getAddress($input->getOption('pidfile')))); } else { $io->warning('No web server is listening.'); return 1; } } }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", "instanceof", "ConsoleOutputInterface", "?", "$", "output", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php#L73-L101
train
Execute the command
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 22834, 1027, 2047, 25353, 2213, 14876, 4890, 21756, 2571, 1006, 1002, 7953, 1010, 1002, 6434, 6013, 11253, 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...
dompdf/dompdf
src/Frame/Factory.php
Factory.decorate_root
static function decorate_root(Frame $root, Dompdf $dompdf) { $frame = new PageFrameDecorator($root, $dompdf); $frame->set_reflower(new PageFrameReflower($frame)); $root->set_decorator($frame); return $frame; }
php
static function decorate_root(Frame $root, Dompdf $dompdf) { $frame = new PageFrameDecorator($root, $dompdf); $frame->set_reflower(new PageFrameReflower($frame)); $root->set_decorator($frame); return $frame; }
[ "static", "function", "decorate_root", "(", "Frame", "$", "root", ",", "Dompdf", "$", "dompdf", ")", "{", "$", "frame", "=", "new", "PageFrameDecorator", "(", "$", "root", ",", "$", "dompdf", ")", ";", "$", "frame", "->", "set_reflower", "(", "new", "P...
Decorate the root Frame @param $root Frame The frame to decorate @param $dompdf Dompdf The dompdf instance @return PageFrameDecorator
[ "Decorate", "the", "root", "Frame" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame/Factory.php#L49-L56
train
Decorates the root frame with the reflower frame
[ 30522, 10763, 3853, 29460, 1035, 7117, 1006, 4853, 1002, 7117, 1010, 14383, 17299, 2546, 1002, 14383, 17299, 2546, 1007, 1063, 1002, 4853, 1027, 2047, 3931, 15643, 3207, 27108, 8844, 1006, 1002, 7117, 1010, 1002, 14383, 17299, 2546, 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...
matomo-org/matomo
plugins/SitesManager/API.php
API.getSitesIdWithAtLeastViewAccess
public function getSitesIdWithAtLeastViewAccess($_restrictSitesToLogin = false) { /** @var Scheduler $scheduler */ $scheduler = StaticContainer::getContainer()->get('Piwik\Scheduler\Scheduler'); if (Piwik::hasUserSuperUserAccess() && !$scheduler->isRunningTask()) { return Access::getInstance()->getSitesIdWithAtLeastViewAccess(); } if (!empty($_restrictSitesToLogin) // Only Super User or logged in user can see viewable sites for a specific login, // but during scheduled task execution, we sometimes want to restrict sites to // a different login than the superuser. && (Piwik::hasUserSuperUserAccessOrIsTheUser($_restrictSitesToLogin) || $scheduler->isRunningTask()) ) { if (Piwik::hasTheUserSuperUserAccess($_restrictSitesToLogin)) { return Access::getInstance()->getSitesIdWithAtLeastViewAccess(); } $accessRaw = Access::getInstance()->getRawSitesWithSomeViewAccess($_restrictSitesToLogin); $sitesId = array(); foreach ($accessRaw as $access) { $sitesId[] = $access['idsite']; } return $sitesId; } else { return Access::getInstance()->getSitesIdWithAtLeastViewAccess(); } }
php
public function getSitesIdWithAtLeastViewAccess($_restrictSitesToLogin = false) { /** @var Scheduler $scheduler */ $scheduler = StaticContainer::getContainer()->get('Piwik\Scheduler\Scheduler'); if (Piwik::hasUserSuperUserAccess() && !$scheduler->isRunningTask()) { return Access::getInstance()->getSitesIdWithAtLeastViewAccess(); } if (!empty($_restrictSitesToLogin) // Only Super User or logged in user can see viewable sites for a specific login, // but during scheduled task execution, we sometimes want to restrict sites to // a different login than the superuser. && (Piwik::hasUserSuperUserAccessOrIsTheUser($_restrictSitesToLogin) || $scheduler->isRunningTask()) ) { if (Piwik::hasTheUserSuperUserAccess($_restrictSitesToLogin)) { return Access::getInstance()->getSitesIdWithAtLeastViewAccess(); } $accessRaw = Access::getInstance()->getRawSitesWithSomeViewAccess($_restrictSitesToLogin); $sitesId = array(); foreach ($accessRaw as $access) { $sitesId[] = $access['idsite']; } return $sitesId; } else { return Access::getInstance()->getSitesIdWithAtLeastViewAccess(); } }
[ "public", "function", "getSitesIdWithAtLeastViewAccess", "(", "$", "_restrictSitesToLogin", "=", "false", ")", "{", "/** @var Scheduler $scheduler */", "$", "scheduler", "=", "StaticContainer", "::", "getContainer", "(", ")", "->", "get", "(", "'Piwik\\Scheduler\\Schedule...
Returns the list of websites ID with the 'view' or 'admin' access for the current user. For the superUser it returns all the websites in the database. @param bool $_restrictSitesToLogin @return array list of websites ID
[ "Returns", "the", "list", "of", "websites", "ID", "with", "the", "view", "or", "admin", "access", "for", "the", "current", "user", ".", "For", "the", "superUser", "it", "returns", "all", "the", "websites", "in", "the", "database", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L437-L469
train
Return list of sites with viewable access for all the sites in the system.
[ 30522, 2270, 3853, 4152, 7616, 3593, 24415, 4017, 19738, 3367, 8584, 6305, 9623, 2015, 1006, 1002, 1035, 21573, 28032, 4355, 12898, 11528, 1027, 6270, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 6134, 2099, 1002, 6134, 2099, 1008, 1013, 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/Scheduler/Job.php
Job.isDue
public function isDue(\DateTime $date = null) { // The execution time is being defaulted if not defined if (!$this->executionTime) { $this->at('* * * * *'); } $date = $date ?? $this->creationTime; return $this->executionTime->isDue($date); }
php
public function isDue(\DateTime $date = null) { // The execution time is being defaulted if not defined if (!$this->executionTime) { $this->at('* * * * *'); } $date = $date ?? $this->creationTime; return $this->executionTime->isDue($date); }
[ "public", "function", "isDue", "(", "\\", "DateTime", "$", "date", "=", "null", ")", "{", "// The execution time is being defaulted if not defined", "if", "(", "!", "$", "this", "->", "executionTime", ")", "{", "$", "this", "->", "at", "(", "'* * * * *'", ")",...
Check if the Job is due to run. It accepts as input a DateTime used to check if the job is due. Defaults to job creation time. It also default the execution time if not previously defined. @param \DateTime $date @return bool
[ "Check", "if", "the", "Job", "is", "due", "to", "run", ".", "It", "accepts", "as", "input", "a", "DateTime", "used", "to", "check", "if", "the", "job", "is", "due", ".", "Defaults", "to", "job", "creation", "time", ".", "It", "also", "default", "the"...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L151-L161
train
Is the execution time due?
[ 30522, 2270, 3853, 2003, 20041, 1006, 1032, 3058, 7292, 1002, 3058, 1027, 19701, 1007, 1063, 1013, 1013, 1996, 7781, 2051, 2003, 2108, 17265, 2065, 2025, 4225, 2065, 1006, 999, 1002, 2023, 1011, 1028, 7781, 7292, 1007, 1063, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Node.php
HTML_QuickForm2_Node.generateId
protected static function generateId($elementName) { $stop = !self::getOption('id_force_append_index'); $tokens = strlen($elementName) ? explode('[', str_replace(']', '', $elementName)) : ($stop? array('qfauto', ''): array('qfauto')); $container =& self::$ids; $id = ''; do { $token = array_shift($tokens); // Handle the 'array[]' names if ('' === $token) { if (empty($container)) { $token = 0; } else { $keys = array_keys($container); $token = end($keys); while (isset($container[$token])) { $token++; } } } $id .= '-' . $token; if (!isset($container[$token])) { $container[$token] = array(); // Handle duplicate names when not having mandatory indexes } elseif (empty($tokens) && $stop) { $tokens[] = ''; } // Handle mandatory indexes if (empty($tokens) && !$stop) { $tokens[] = ''; $stop = true; } $container =& $container[$token]; } while (!empty($tokens)); return substr($id, 1); }
php
protected static function generateId($elementName) { $stop = !self::getOption('id_force_append_index'); $tokens = strlen($elementName) ? explode('[', str_replace(']', '', $elementName)) : ($stop? array('qfauto', ''): array('qfauto')); $container =& self::$ids; $id = ''; do { $token = array_shift($tokens); // Handle the 'array[]' names if ('' === $token) { if (empty($container)) { $token = 0; } else { $keys = array_keys($container); $token = end($keys); while (isset($container[$token])) { $token++; } } } $id .= '-' . $token; if (!isset($container[$token])) { $container[$token] = array(); // Handle duplicate names when not having mandatory indexes } elseif (empty($tokens) && $stop) { $tokens[] = ''; } // Handle mandatory indexes if (empty($tokens) && !$stop) { $tokens[] = ''; $stop = true; } $container =& $container[$token]; } while (!empty($tokens)); return substr($id, 1); }
[ "protected", "static", "function", "generateId", "(", "$", "elementName", ")", "{", "$", "stop", "=", "!", "self", "::", "getOption", "(", "'id_force_append_index'", ")", ";", "$", "tokens", "=", "strlen", "(", "$", "elementName", ")", "?", "explode", "(",...
Generates an id for the element Called when an element is created without explicitly given id @param string Element name @return string The generated element id
[ "Generates", "an", "id", "for", "the", "element" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Node.php#L206-L245
train
Generate ID from element name
[ 30522, 5123, 10763, 3853, 9699, 3593, 1006, 1002, 5783, 18442, 1007, 1063, 1002, 2644, 1027, 999, 2969, 1024, 1024, 2131, 7361, 3508, 1006, 1005, 8909, 1035, 2486, 1035, 10439, 10497, 1035, 5950, 1005, 1007, 1025, 1002, 19204, 2015, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/DBStats/API.php
API.getDatabaseUsageSummary
public function getDatabaseUsageSummary() { Piwik::checkUserHasSuperUserAccess(); $emptyRow = array('data_size' => 0, 'index_size' => 0, 'row_count' => 0); $rows = array( 'tracker_data' => $emptyRow, 'metric_data' => $emptyRow, 'report_data' => $emptyRow, 'other_data' => $emptyRow ); foreach ($this->metadataProvider->getAllTablesStatus() as $status) { if ($this->isNumericArchiveTable($status['Name'])) { $rowToAddTo = & $rows['metric_data']; } else if ($this->isBlobArchiveTable($status['Name'])) { $rowToAddTo = & $rows['report_data']; } else if ($this->isTrackerTable($status['Name'])) { $rowToAddTo = & $rows['tracker_data']; } else { $rowToAddTo = & $rows['other_data']; } $rowToAddTo['data_size'] += $status['Data_length']; $rowToAddTo['index_size'] += $status['Index_length']; $rowToAddTo['row_count'] += $status['Rows']; } return DataTable::makeFromIndexedArray($rows); }
php
public function getDatabaseUsageSummary() { Piwik::checkUserHasSuperUserAccess(); $emptyRow = array('data_size' => 0, 'index_size' => 0, 'row_count' => 0); $rows = array( 'tracker_data' => $emptyRow, 'metric_data' => $emptyRow, 'report_data' => $emptyRow, 'other_data' => $emptyRow ); foreach ($this->metadataProvider->getAllTablesStatus() as $status) { if ($this->isNumericArchiveTable($status['Name'])) { $rowToAddTo = & $rows['metric_data']; } else if ($this->isBlobArchiveTable($status['Name'])) { $rowToAddTo = & $rows['report_data']; } else if ($this->isTrackerTable($status['Name'])) { $rowToAddTo = & $rows['tracker_data']; } else { $rowToAddTo = & $rows['other_data']; } $rowToAddTo['data_size'] += $status['Data_length']; $rowToAddTo['index_size'] += $status['Index_length']; $rowToAddTo['row_count'] += $status['Rows']; } return DataTable::makeFromIndexedArray($rows); }
[ "public", "function", "getDatabaseUsageSummary", "(", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "$", "emptyRow", "=", "array", "(", "'data_size'", "=>", "0", ",", "'index_size'", "=>", "0", ",", "'row_count'", "=>", "0", ")", ";"...
Returns a datatable summarizing how data is distributed among Matomo tables. This function will group tracker tables, numeric archive tables, blob archive tables and other tables together so only four rows are shown. @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
[ "Returns", "a", "datatable", "summarizing", "how", "data", "is", "distributed", "among", "Matomo", "tables", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DBStats/API.php#L76-L105
train
Returns a summary of the database usage of all tables
[ 30522, 2270, 3853, 2131, 2850, 30524, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1025, 1002, 4064, 10524, 1027, 9140, 1006, 1005, 2951, 1035, 2946, 1005, 1027, 1028, 1014, 1010, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/User/TagClient.php
TagClient.usersOfTag
public function usersOfTag(int $tagId, string $nextOpenId = '') { $params = [ 'tagid' => $tagId, 'next_openid' => $nextOpenId, ]; return $this->httpPostJson('cgi-bin/user/tag/get', $params); }
php
public function usersOfTag(int $tagId, string $nextOpenId = '') { $params = [ 'tagid' => $tagId, 'next_openid' => $nextOpenId, ]; return $this->httpPostJson('cgi-bin/user/tag/get', $params); }
[ "public", "function", "usersOfTag", "(", "int", "$", "tagId", ",", "string", "$", "nextOpenId", "=", "''", ")", "{", "$", "params", "=", "[", "'tagid'", "=>", "$", "tagId", ",", "'next_openid'", "=>", "$", "nextOpenId", ",", "]", ";", "return", "$", ...
Get users from a tag. @param int $tagId @param string $nextOpenId @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Get", "users", "from", "a", "tag", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/User/TagClient.php#L119-L127
train
Get users of a tag
[ 30522, 2270, 3853, 5198, 15794, 8490, 1006, 20014, 1002, 6415, 3593, 1010, 5164, 1002, 2279, 26915, 3593, 1027, 1005, 1005, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 6415, 3593, 1005, 1027, 1028, 1002, 6415, 3593, 1010, 1005, 2279, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.setUserPreference
public function setUserPreference($userLogin, $preferenceName, $preferenceValue) { Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin); Option::set($this->getPreferenceId($userLogin, $preferenceName), $preferenceValue); }
php
public function setUserPreference($userLogin, $preferenceName, $preferenceValue) { Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin); Option::set($this->getPreferenceId($userLogin, $preferenceName), $preferenceValue); }
[ "public", "function", "setUserPreference", "(", "$", "userLogin", ",", "$", "preferenceName", ",", "$", "preferenceValue", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccessOrIsTheUser", "(", "$", "userLogin", ")", ";", "Option", "::", "set", "(", "$", "this"...
Sets a user preference @param string $userLogin @param string $preferenceName @param string $preferenceValue @return void
[ "Sets", "a", "user", "preference" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L187-L191
train
Set user preference
[ 30522, 2270, 3853, 2275, 20330, 28139, 25523, 1006, 1002, 5310, 21197, 2378, 1010, 1002, 12157, 18442, 1010, 1002, 12157, 10175, 5657, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 21748, 2923, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
Events/Select.php
Select.add
public function add($fd, $flag, $func, $args = array()) { switch ($flag) { case self::EV_READ: case self::EV_WRITE: $count = $flag === self::EV_READ ? count($this->_readFds) : count($this->_writeFds); if ($count >= 1024) { echo "Warning: system call select exceeded the maximum number of connections 1024, please install event/libevent extension for more connections.\n"; } else if (DIRECTORY_SEPARATOR !== '/' && $count >= 256) { echo "Warning: system call select exceeded the maximum number of connections 256.\n"; } $fd_key = (int)$fd; $this->_allEvents[$fd_key][$flag] = array($func, $fd); if ($flag === self::EV_READ) { $this->_readFds[$fd_key] = $fd; } else { $this->_writeFds[$fd_key] = $fd; } break; case self::EV_EXCEPT: $fd_key = (int)$fd; $this->_allEvents[$fd_key][$flag] = array($func, $fd); $this->_exceptFds[$fd_key] = $fd; break; case self::EV_SIGNAL: // Windows not support signal. if(DIRECTORY_SEPARATOR !== '/') { return false; } $fd_key = (int)$fd; $this->_signalEvents[$fd_key][$flag] = array($func, $fd); pcntl_signal($fd, array($this, 'signalHandler')); break; case self::EV_TIMER: case self::EV_TIMER_ONCE: $timer_id = $this->_timerId++; $run_time = microtime(true) + $fd; $this->_scheduler->insert($timer_id, -$run_time); $this->_eventTimer[$timer_id] = array($func, (array)$args, $flag, $fd); $select_timeout = ($run_time - microtime(true)) * 1000000; if( $this->_selectTimeout > $select_timeout ){ $this->_selectTimeout = $select_timeout; } return $timer_id; } return true; }
php
public function add($fd, $flag, $func, $args = array()) { switch ($flag) { case self::EV_READ: case self::EV_WRITE: $count = $flag === self::EV_READ ? count($this->_readFds) : count($this->_writeFds); if ($count >= 1024) { echo "Warning: system call select exceeded the maximum number of connections 1024, please install event/libevent extension for more connections.\n"; } else if (DIRECTORY_SEPARATOR !== '/' && $count >= 256) { echo "Warning: system call select exceeded the maximum number of connections 256.\n"; } $fd_key = (int)$fd; $this->_allEvents[$fd_key][$flag] = array($func, $fd); if ($flag === self::EV_READ) { $this->_readFds[$fd_key] = $fd; } else { $this->_writeFds[$fd_key] = $fd; } break; case self::EV_EXCEPT: $fd_key = (int)$fd; $this->_allEvents[$fd_key][$flag] = array($func, $fd); $this->_exceptFds[$fd_key] = $fd; break; case self::EV_SIGNAL: // Windows not support signal. if(DIRECTORY_SEPARATOR !== '/') { return false; } $fd_key = (int)$fd; $this->_signalEvents[$fd_key][$flag] = array($func, $fd); pcntl_signal($fd, array($this, 'signalHandler')); break; case self::EV_TIMER: case self::EV_TIMER_ONCE: $timer_id = $this->_timerId++; $run_time = microtime(true) + $fd; $this->_scheduler->insert($timer_id, -$run_time); $this->_eventTimer[$timer_id] = array($func, (array)$args, $flag, $fd); $select_timeout = ($run_time - microtime(true)) * 1000000; if( $this->_selectTimeout > $select_timeout ){ $this->_selectTimeout = $select_timeout; } return $timer_id; } return true; }
[ "public", "function", "add", "(", "$", "fd", ",", "$", "flag", ",", "$", "func", ",", "$", "args", "=", "array", "(", ")", ")", "{", "switch", "(", "$", "flag", ")", "{", "case", "self", "::", "EV_READ", ":", "case", "self", "::", "EV_WRITE", "...
{@inheritdoc}
[ "{" ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Select.php#L113-L160
train
Adds an event to the event queue
[ 30522, 2270, 3853, 5587, 1006, 1002, 1042, 2094, 1010, 1002, 5210, 1010, 1002, 4569, 2278, 1010, 1002, 12098, 5620, 1027, 9140, 1006, 1007, 1007, 1063, 6942, 1006, 1002, 5210, 1007, 1063, 2553, 2969, 1024, 1024, 23408, 1035, 3191, 1024, 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/HttpKernel/HttpCache/Esi.php
Esi.renderIncludeTag
public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '') { $html = sprintf('<esi:include src="%s"%s%s />', $uri, $ignoreErrors ? ' onerror="continue"' : '', $alt ? sprintf(' alt="%s"', $alt) : '' ); if (!empty($comment)) { return sprintf("<esi:comment text=\"%s\" />\n%s", $comment, $html); } return $html; }
php
public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '') { $html = sprintf('<esi:include src="%s"%s%s />', $uri, $ignoreErrors ? ' onerror="continue"' : '', $alt ? sprintf(' alt="%s"', $alt) : '' ); if (!empty($comment)) { return sprintf("<esi:comment text=\"%s\" />\n%s", $comment, $html); } return $html; }
[ "public", "function", "renderIncludeTag", "(", "$", "uri", ",", "$", "alt", "=", "null", ",", "$", "ignoreErrors", "=", "true", ",", "$", "comment", "=", "''", ")", "{", "$", "html", "=", "sprintf", "(", "'<esi:include src=\"%s\"%s%s />'", ",", "$", "uri...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Esi.php#L48-L61
train
Render include tag
[ 30522, 2270, 3853, 17552, 2378, 20464, 12672, 15900, 1006, 1002, 24471, 2072, 1010, 1002, 12456, 1027, 19701, 1010, 1002, 8568, 2121, 29165, 2015, 1027, 2995, 1010, 1002, 7615, 1027, 1005, 1005, 1007, 1063, 1002, 16129, 1027, 9043, 2546, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/GeoIp2/LocationProvider/GeoIp2/ServerModule.php
ServerModule.isSameOrAnonymizedIp
public static function isSameOrAnonymizedIp($ip, $currentIp) { $ip = array_reverse(explode('.', $ip)); $currentIp = array_reverse(explode('.', $currentIp)); if (count($ip) != count($currentIp)) { return false; } foreach ($ip as $i => $byte) { if ($byte == 0) { $currentIp[$i] = 0; } else { break; } } foreach ($ip as $i => $byte) { if ($byte != $currentIp[$i]) { return false; } } return true; }
php
public static function isSameOrAnonymizedIp($ip, $currentIp) { $ip = array_reverse(explode('.', $ip)); $currentIp = array_reverse(explode('.', $currentIp)); if (count($ip) != count($currentIp)) { return false; } foreach ($ip as $i => $byte) { if ($byte == 0) { $currentIp[$i] = 0; } else { break; } } foreach ($ip as $i => $byte) { if ($byte != $currentIp[$i]) { return false; } } return true; }
[ "public", "static", "function", "isSameOrAnonymizedIp", "(", "$", "ip", ",", "$", "currentIp", ")", "{", "$", "ip", "=", "array_reverse", "(", "explode", "(", "'.'", ",", "$", "ip", ")", ")", ";", "$", "currentIp", "=", "array_reverse", "(", "explode", ...
Checks if two IP addresses are the same or if the first is the anonymized version of the other. @param string $ip @param string $currentIp This IP should not be anonymized. @return bool
[ "Checks", "if", "two", "IP", "addresses", "are", "the", "same", "or", "if", "the", "first", "is", "the", "anonymized", "version", "of", "the", "other", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/LocationProvider/GeoIp2/ServerModule.php#L271-L294
train
Check if the current ip is the same or anonymized ip
[ 30522, 2270, 10763, 3853, 26354, 14074, 18842, 16585, 4328, 5422, 11514, 1006, 1002, 12997, 1010, 1002, 2783, 11514, 1007, 1063, 1002, 12997, 1027, 9140, 1035, 7901, 1006, 15044, 1006, 1005, 1012, 1005, 1010, 1002, 12997, 1007, 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...
matomo-org/matomo
libs/Zend/Db/Table/Row/Abstract.php
Zend_Db_Table_Row_Abstract._getTableFromString
protected function _getTableFromString($tableName) { if ($this->_table instanceof Zend_Db_Table_Abstract) { $tableDefinition = $this->_table->getDefinition(); if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { return new Zend_Db_Table($tableName, $tableDefinition); } } // assume the tableName is the class name if (!class_exists($tableName)) { try { // require_once 'Zend/Loader.php'; Zend_Loader::loadClass($tableName); } catch (Zend_Exception $e) { // require_once 'Zend/Db/Table/Row/Exception.php'; throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); } } $options = array(); if (($table = $this->_getTable())) { $options['db'] = $table->getAdapter(); } if (isset($tableDefinition) && $tableDefinition !== null) { $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition; } return new $tableName($options); }
php
protected function _getTableFromString($tableName) { if ($this->_table instanceof Zend_Db_Table_Abstract) { $tableDefinition = $this->_table->getDefinition(); if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { return new Zend_Db_Table($tableName, $tableDefinition); } } // assume the tableName is the class name if (!class_exists($tableName)) { try { // require_once 'Zend/Loader.php'; Zend_Loader::loadClass($tableName); } catch (Zend_Exception $e) { // require_once 'Zend/Db/Table/Row/Exception.php'; throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); } } $options = array(); if (($table = $this->_getTable())) { $options['db'] = $table->getAdapter(); } if (isset($tableDefinition) && $tableDefinition !== null) { $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition; } return new $tableName($options); }
[ "protected", "function", "_getTableFromString", "(", "$", "tableName", ")", "{", "if", "(", "$", "this", "->", "_table", "instanceof", "Zend_Db_Table_Abstract", ")", "{", "$", "tableDefinition", "=", "$", "this", "->", "_table", "->", "getDefinition", "(", ")"...
_getTableFromString @param string $tableName @return Zend_Db_Table_Abstract
[ "_getTableFromString" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Row/Abstract.php#L1168-L1201
train
Create a Zend_Db_Table object from a string
[ 30522, 5123, 3853, 1035, 2131, 10880, 19699, 22225, 18886, 3070, 1006, 1002, 2795, 18442, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 2795, 6013, 11253, 16729, 2094, 1035, 16962, 1035, 2795, 1035, 10061, 1007, 1063, 1002, 2795, 32...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/MoneyToLocalizedStringTransformer.php
MoneyToLocalizedStringTransformer.transform
public function transform($value) { if (null !== $value && 1 !== $this->divisor) { if (!is_numeric($value)) { throw new TransformationFailedException('Expected a numeric.'); } $value /= $this->divisor; } return parent::transform($value); }
php
public function transform($value) { if (null !== $value && 1 !== $this->divisor) { if (!is_numeric($value)) { throw new TransformationFailedException('Expected a numeric.'); } $value /= $this->divisor; } return parent::transform($value); }
[ "public", "function", "transform", "(", "$", "value", ")", "{", "if", "(", "null", "!==", "$", "value", "&&", "1", "!==", "$", "this", "->", "divisor", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "value", ")", ")", "{", "throw", "new", "Tra...
Transforms a normalized format into a localized money string. @param int|float $value Normalized number @return string Localized money string @throws TransformationFailedException if the given value is not numeric or if the value can not be transformed
[ "Transforms", "a", "normalized", "format", "into", "a", "localized", "money", "string", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php#L55-L65
train
Transform a number to a string
[ 30522, 2270, 3853, 10938, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 3643, 1004, 1004, 1015, 999, 1027, 1027, 1002, 2023, 1011, 1028, 4487, 11365, 2953, 1007, 1063, 2065, 1006, 999, 2003, 1035, 16371, 25531, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/View/RenderTokenParser.php
RenderTokenParser.parse
public function parse(Twig_Token $token) { $parser = $this->parser; $stream = $parser->getStream(); $view = $parser->getExpressionParser()->parseExpression(); $variablesOverride = new Twig_Node_Expression_Array(array(), $token->getLine()); if ($stream->test(Twig_Token::NAME_TYPE, 'with')) { $stream->next(); $variablesOverride->addElement($this->parser->getExpressionParser()->parseExpression()); } $stream->expect(Twig_Token::BLOCK_END_TYPE); $viewTemplateExpr = new Twig_Node_Expression_MethodCall( $view, 'getTemplateFile', new Twig_Node_Expression_Array(array(), $token->getLine()), $token->getLine() ); $variablesExpr = new Twig_Node_Expression_MethodCall( $view, 'getTemplateVars', $variablesOverride, $token->getLine() ); return new Twig_Node_Include( $viewTemplateExpr, $variablesExpr, $only = false, $ignoreMissing = false, $token->getLine() ); }
php
public function parse(Twig_Token $token) { $parser = $this->parser; $stream = $parser->getStream(); $view = $parser->getExpressionParser()->parseExpression(); $variablesOverride = new Twig_Node_Expression_Array(array(), $token->getLine()); if ($stream->test(Twig_Token::NAME_TYPE, 'with')) { $stream->next(); $variablesOverride->addElement($this->parser->getExpressionParser()->parseExpression()); } $stream->expect(Twig_Token::BLOCK_END_TYPE); $viewTemplateExpr = new Twig_Node_Expression_MethodCall( $view, 'getTemplateFile', new Twig_Node_Expression_Array(array(), $token->getLine()), $token->getLine() ); $variablesExpr = new Twig_Node_Expression_MethodCall( $view, 'getTemplateVars', $variablesOverride, $token->getLine() ); return new Twig_Node_Include( $viewTemplateExpr, $variablesExpr, $only = false, $ignoreMissing = false, $token->getLine() ); }
[ "public", "function", "parse", "(", "Twig_Token", "$", "token", ")", "{", "$", "parser", "=", "$", "this", "->", "parser", ";", "$", "stream", "=", "$", "parser", "->", "getStream", "(", ")", ";", "$", "view", "=", "$", "parser", "->", "getExpression...
Parses the Twig stream and creates a Twig_Node_Include instance that includes the View's template. @return Twig_Node_Include
[ "Parses", "the", "Twig", "stream", "and", "creates", "a", "Twig_Node_Include", "instance", "that", "includes", "the", "View", "s", "template", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/View/RenderTokenParser.php#L34-L71
train
Parse the view template
[ 30522, 2270, 3853, 11968, 3366, 1006, 1056, 16279, 1035, 19204, 1002, 19204, 1007, 1063, 1002, 11968, 8043, 1027, 1002, 2023, 1011, 1028, 11968, 8043, 1025, 1002, 5460, 1027, 1002, 11968, 8043, 1011, 1028, 4152, 25379, 1006, 1007, 1025, 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...
laravel/framework
src/Illuminate/Validation/ValidationRuleParser.php
ValidationRuleParser.explodeRules
protected function explodeRules($rules) { foreach ($rules as $key => $rule) { if (Str::contains($key, '*')) { $rules = $this->explodeWildcardRules($rules, $key, [$rule]); unset($rules[$key]); } else { $rules[$key] = $this->explodeExplicitRule($rule); } } return $rules; }
php
protected function explodeRules($rules) { foreach ($rules as $key => $rule) { if (Str::contains($key, '*')) { $rules = $this->explodeWildcardRules($rules, $key, [$rule]); unset($rules[$key]); } else { $rules[$key] = $this->explodeExplicitRule($rule); } } return $rules; }
[ "protected", "function", "explodeRules", "(", "$", "rules", ")", "{", "foreach", "(", "$", "rules", "as", "$", "key", "=>", "$", "rule", ")", "{", "if", "(", "Str", "::", "contains", "(", "$", "key", ",", "'*'", ")", ")", "{", "$", "rules", "=", ...
Explode the rules into an array of explicit rules. @param array $rules @return array
[ "Explode", "the", "rules", "into", "an", "array", "of", "explicit", "rules", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/ValidationRuleParser.php#L63-L76
train
Explodes the rules array into an array of implicit and wildcard rules
[ 30522, 5123, 3853, 15044, 6820, 4244, 1006, 1002, 3513, 1007, 1063, 18921, 6776, 1006, 1002, 3513, 2004, 1002, 3145, 1027, 1028, 1002, 3627, 1007, 1063, 2065, 1006, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 3145, 1010, 1005, 1008, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Filesystem/FilesystemAdapter.php
FilesystemAdapter.put
public function put($path, $contents, $options = []) { $options = is_string($options) ? ['visibility' => $options] : (array) $options; // If the given contents is actually a file or uploaded file instance than we will // automatically store the file using a stream. This provides a convenient path // for the developer to store streams without managing them manually in code. if ($contents instanceof File || $contents instanceof UploadedFile) { return $this->putFile($path, $contents, $options); } return is_resource($contents) ? $this->driver->putStream($path, $contents, $options) : $this->driver->put($path, $contents, $options); }
php
public function put($path, $contents, $options = []) { $options = is_string($options) ? ['visibility' => $options] : (array) $options; // If the given contents is actually a file or uploaded file instance than we will // automatically store the file using a stream. This provides a convenient path // for the developer to store streams without managing them manually in code. if ($contents instanceof File || $contents instanceof UploadedFile) { return $this->putFile($path, $contents, $options); } return is_resource($contents) ? $this->driver->putStream($path, $contents, $options) : $this->driver->put($path, $contents, $options); }
[ "public", "function", "put", "(", "$", "path", ",", "$", "contents", ",", "$", "options", "=", "[", "]", ")", "{", "$", "options", "=", "is_string", "(", "$", "options", ")", "?", "[", "'visibility'", "=>", "$", "options", "]", ":", "(", "array", ...
Write the contents of a file. @param string $path @param string|resource $contents @param mixed $options @return bool
[ "Write", "the", "contents", "of", "a", "file", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L179-L196
train
Put the given file or stream to the given path
[ 30522, 2270, 3853, 2404, 1006, 1002, 4130, 1010, 1002, 8417, 1010, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 7047, 1027, 2003, 1035, 5164, 1006, 1002, 7047, 1007, 1029, 1031, 1005, 16476, 1005, 1027, 1028, 1002, 7047, 1033, 1024, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/Ip.php
Zend_Validate_Ip._validateIPv6
protected function _validateIPv6($value) { if (strlen($value) < 3) { return $value == '::'; } if (strpos($value, '.')) { $lastcolon = strrpos($value, ':'); if (!($lastcolon && $this->_validateIPv4(substr($value, $lastcolon + 1)))) { return false; } $value = substr($value, 0, $lastcolon) . ':0:0'; } if (strpos($value, '::') === false) { return preg_match('/\A(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}\z/i', $value); } $colonCount = substr_count($value, ':'); if ($colonCount < 8) { return preg_match('/\A(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?\z/i', $value); } // special case with ending or starting double colon if ($colonCount == 8) { return preg_match('/\A(?:::)?(?:[a-f0-9]{1,4}:){6}[a-f0-9]{1,4}(?:::)?\z/i', $value); } return false; }
php
protected function _validateIPv6($value) { if (strlen($value) < 3) { return $value == '::'; } if (strpos($value, '.')) { $lastcolon = strrpos($value, ':'); if (!($lastcolon && $this->_validateIPv4(substr($value, $lastcolon + 1)))) { return false; } $value = substr($value, 0, $lastcolon) . ':0:0'; } if (strpos($value, '::') === false) { return preg_match('/\A(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}\z/i', $value); } $colonCount = substr_count($value, ':'); if ($colonCount < 8) { return preg_match('/\A(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?\z/i', $value); } // special case with ending or starting double colon if ($colonCount == 8) { return preg_match('/\A(?:::)?(?:[a-f0-9]{1,4}:){6}[a-f0-9]{1,4}(?:::)?\z/i', $value); } return false; }
[ "protected", "function", "_validateIPv6", "(", "$", "value", ")", "{", "if", "(", "strlen", "(", "$", "value", ")", "<", "3", ")", "{", "return", "$", "value", "==", "'::'", ";", "}", "if", "(", "strpos", "(", "$", "value", ",", "'.'", ")", ")", ...
Validates an IPv6 address @param string $value Value to check against @return boolean True when $value is a valid ipv6 address False otherwise
[ "Validates", "an", "IPv6", "address" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Ip.php#L161-L190
train
Validate IPv6 address
[ 30522, 5123, 3853, 1035, 9398, 3686, 11514, 2615, 2575, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 2358, 20927, 2078, 1006, 1002, 3643, 1007, 1026, 1017, 1007, 1063, 2709, 1002, 3643, 1027, 1027, 1005, 1024, 1024, 1005, 1025, 1065, 2065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/Helper/SlotsHelper.php
SlotsHelper.output
public function output($name, $default = false) { if (!isset($this->slots[$name])) { if (false !== $default) { echo $default; return true; } return false; } echo $this->slots[$name]; return true; }
php
public function output($name, $default = false) { if (!isset($this->slots[$name])) { if (false !== $default) { echo $default; return true; } return false; } echo $this->slots[$name]; return true; }
[ "public", "function", "output", "(", "$", "name", ",", "$", "default", "=", "false", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "slots", "[", "$", "name", "]", ")", ")", "{", "if", "(", "false", "!==", "$", "default", ")", "{", ...
Outputs a slot. @param string $name The slot name @param bool|string $default The default slot content @return bool true if the slot is defined or if a default content has been provided, false otherwise
[ "Outputs", "a", "slot", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Helper/SlotsHelper.php#L107-L122
train
Outputs the content of a slot
[ 30522, 2270, 3853, 6434, 1006, 1002, 2171, 1010, 1002, 12398, 1027, 6270, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 19832, 1031, 1002, 2171, 1033, 1007, 1007, 1063, 2065, 1006, 6270, 999, 1027, 1027, 1002, 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/PropertyAccess/PropertyAccessorBuilder.php
PropertyAccessorBuilder.getPropertyAccessor
public function getPropertyAccessor() { return new PropertyAccessor($this->magicCall, $this->throwExceptionOnInvalidIndex, $this->cacheItemPool, $this->throwExceptionOnInvalidPropertyPath); }
php
public function getPropertyAccessor() { return new PropertyAccessor($this->magicCall, $this->throwExceptionOnInvalidIndex, $this->cacheItemPool, $this->throwExceptionOnInvalidPropertyPath); }
[ "public", "function", "getPropertyAccessor", "(", ")", "{", "return", "new", "PropertyAccessor", "(", "$", "this", "->", "magicCall", ",", "$", "this", "->", "throwExceptionOnInvalidIndex", ",", "$", "this", "->", "cacheItemPool", ",", "$", "this", "->", "thro...
Builds and returns a new PropertyAccessor object. @return PropertyAccessorInterface The built PropertyAccessor
[ "Builds", "and", "returns", "a", "new", "PropertyAccessor", "object", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php#L167-L170
train
Get the property accessor for the current page
[ 30522, 2270, 3853, 2131, 21572, 4842, 21426, 9468, 7971, 2953, 1006, 1007, 1063, 2709, 2047, 3200, 6305, 9623, 21748, 1006, 1002, 2023, 1011, 1028, 3894, 9289, 2140, 1010, 1002, 2023, 1011, 1028, 5466, 10288, 24422, 10698, 2078, 10175, 2817...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/QueriesRelationships.php
QueriesRelationships.doesntHave
public function doesntHave($relation, $boolean = 'and', Closure $callback = null) { return $this->has($relation, '<', 1, $boolean, $callback); }
php
public function doesntHave($relation, $boolean = 'and', Closure $callback = null) { return $this->has($relation, '<', 1, $boolean, $callback); }
[ "public", "function", "doesntHave", "(", "$", "relation", ",", "$", "boolean", "=", "'and'", ",", "Closure", "$", "callback", "=", "null", ")", "{", "return", "$", "this", "->", "has", "(", "$", "relation", ",", "'<'", ",", "1", ",", "$", "boolean", ...
Add a relationship count / exists condition to the query. @param string $relation @param string $boolean @param \Closure|null $callback @return \Illuminate\Database\Eloquent\Builder|static
[ "Add", "a", "relationship", "count", "/", "exists", "condition", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php#L117-L120
train
Has not exists
[ 30522, 2270, 3853, 2987, 8322, 3726, 1006, 1002, 7189, 1010, 1002, 22017, 20898, 1027, 1005, 1998, 1005, 1010, 8503, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2038, 1006, 1002, 7189, 1010, 1005, 1026, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...