repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
laravel/framework
src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php
LoadEnvironmentVariables.createDotenv
protected function createDotenv($app) { return Dotenv::create( $app->environmentPath(), $app->environmentFile(), new DotenvFactory([new EnvConstAdapter, new ServerConstAdapter, new PutenvAdapter]) ); }
php
protected function createDotenv($app) { return Dotenv::create( $app->environmentPath(), $app->environmentFile(), new DotenvFactory([new EnvConstAdapter, new ServerConstAdapter, new PutenvAdapter]) ); }
[ "protected", "function", "createDotenv", "(", "$", "app", ")", "{", "return", "Dotenv", "::", "create", "(", "$", "app", "->", "environmentPath", "(", ")", ",", "$", "app", "->", "environmentFile", "(", ")", ",", "new", "DotenvFactory", "(", "[", "new", ...
Create a Dotenv instance. @param \Illuminate\Contracts\Foundation\Application $app @return \Dotenv\Dotenv
[ "Create", "a", "Dotenv", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php#L87-L94
train
Create a Dotenv instance
[ 30522, 5123, 3853, 2580, 12184, 2078, 2615, 1006, 1002, 10439, 1007, 1063, 2709, 11089, 2368, 2615, 1024, 1024, 3443, 1006, 1002, 10439, 1011, 1028, 4044, 15069, 1006, 1007, 1010, 1002, 10439, 1011, 1028, 4044, 8873, 2571, 1006, 1007, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/Payment/Refund/Client.php
Client.byOutTradeNumber
public function byOutTradeNumber(string $number, string $refundNumber, int $totalFee, int $refundFee, array $optional = []) { return $this->refund($refundNumber, $totalFee, $refundFee, array_merge($optional, ['out_trade_no' => $number])); }
php
public function byOutTradeNumber(string $number, string $refundNumber, int $totalFee, int $refundFee, array $optional = []) { return $this->refund($refundNumber, $totalFee, $refundFee, array_merge($optional, ['out_trade_no' => $number])); }
[ "public", "function", "byOutTradeNumber", "(", "string", "$", "number", ",", "string", "$", "refundNumber", ",", "int", "$", "totalFee", ",", "int", "$", "refundFee", ",", "array", "$", "optional", "=", "[", "]", ")", "{", "return", "$", "this", "->", ...
Refund by out trade number. @param string $number @param string $refundNumber @param int $totalFee @param int $refundFee @param array $optional @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Refund", "by", "out", "trade", "number", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Refund/Client.php#L31-L34
train
By Out Trade Number
[ 30522, 2270, 3853, 2011, 5833, 6494, 4181, 29440, 1006, 5164, 1002, 2193, 1010, 5164, 1002, 25416, 8630, 19172, 5677, 1010, 20014, 1002, 2561, 7959, 2063, 1010, 20014, 1002, 25416, 8630, 7959, 2063, 1010, 9140, 1002, 11887, 1027, 1031, 1033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Libmemcached.php
Zend_Cache_Backend_Libmemcached.getFillingPercentage
public function getFillingPercentage() { $mems = $this->_memcache->getStats(); if ($mems === false) { return 0; } $memSize = null; $memUsed = null; foreach ($mems as $key => $mem) { if ($mem === false) { $this->_log('can\'t get stat from ' . $key); continue; } $eachSize = $mem['limit_maxbytes']; $eachUsed = $mem['bytes']; if ($eachUsed > $eachSize) { $eachUsed = $eachSize; } $memSize += $eachSize; $memUsed += $eachUsed; } if ($memSize === null || $memUsed === null) { Zend_Cache::throwException('Can\'t get filling percentage'); } return ((int) (100. * ($memUsed / $memSize))); }
php
public function getFillingPercentage() { $mems = $this->_memcache->getStats(); if ($mems === false) { return 0; } $memSize = null; $memUsed = null; foreach ($mems as $key => $mem) { if ($mem === false) { $this->_log('can\'t get stat from ' . $key); continue; } $eachSize = $mem['limit_maxbytes']; $eachUsed = $mem['bytes']; if ($eachUsed > $eachSize) { $eachUsed = $eachSize; } $memSize += $eachSize; $memUsed += $eachUsed; } if ($memSize === null || $memUsed === null) { Zend_Cache::throwException('Can\'t get filling percentage'); } return ((int) (100. * ($memUsed / $memSize))); }
[ "public", "function", "getFillingPercentage", "(", ")", "{", "$", "mems", "=", "$", "this", "->", "_memcache", "->", "getStats", "(", ")", ";", "if", "(", "$", "mems", "===", "false", ")", "{", "return", "0", ";", "}", "$", "memSize", "=", "null", ...
Return the filling percentage of the backend storage @throws Zend_Cache_Exception @return int integer between 0 and 100
[ "Return", "the", "filling", "percentage", "of", "the", "backend", "storage" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Libmemcached.php#L366-L396
train
Get filling percentage
[ 30522, 2270, 3853, 2131, 8873, 13112, 4842, 13013, 4270, 1006, 1007, 1063, 1002, 2033, 5244, 1027, 1002, 2023, 1011, 1028, 1035, 2033, 12458, 15395, 1011, 1028, 4152, 29336, 2015, 1006, 1007, 1025, 2065, 1006, 1002, 2033, 5244, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataCollector/QueryCollector.php
QueryCollector.findMiddlewareFromFile
protected function findMiddlewareFromFile($file) { $filename = pathinfo($file, PATHINFO_FILENAME); foreach ($this->middleware as $alias => $class) { if (strpos($class, $filename) !== false) { return $alias; } } }
php
protected function findMiddlewareFromFile($file) { $filename = pathinfo($file, PATHINFO_FILENAME); foreach ($this->middleware as $alias => $class) { if (strpos($class, $filename) !== false) { return $alias; } } }
[ "protected", "function", "findMiddlewareFromFile", "(", "$", "file", ")", "{", "$", "filename", "=", "pathinfo", "(", "$", "file", ",", "PATHINFO_FILENAME", ")", ";", "foreach", "(", "$", "this", "->", "middleware", "as", "$", "alias", "=>", "$", "class", ...
Find the middleware alias from the file. @param string $file @return string|null
[ "Find", "the", "middleware", "alias", "from", "the", "file", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataCollector/QueryCollector.php#L298-L307
train
Find the middleware from the file
[ 30522, 5123, 3853, 2424, 4328, 20338, 8059, 19699, 5358, 8873, 2571, 1006, 1002, 5371, 1007, 1063, 1002, 5371, 18442, 1027, 4130, 2378, 14876, 1006, 1002, 5371, 1010, 4130, 2378, 14876, 1035, 5371, 18442, 1007, 1025, 18921, 6776, 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/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php
AnnotatedRouteControllerLoader.configureRoute
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot) { if ('__invoke' === $method->getName()) { $route->setDefault('_controller', $class->getName()); } else { $route->setDefault('_controller', $class->getName().'::'.$method->getName()); } }
php
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot) { if ('__invoke' === $method->getName()) { $route->setDefault('_controller', $class->getName()); } else { $route->setDefault('_controller', $class->getName().'::'.$method->getName()); } }
[ "protected", "function", "configureRoute", "(", "Route", "$", "route", ",", "\\", "ReflectionClass", "$", "class", ",", "\\", "ReflectionMethod", "$", "method", ",", "$", "annot", ")", "{", "if", "(", "'__invoke'", "===", "$", "method", "->", "getName", "(...
Configures the _controller default parameter of a given Route instance. @param mixed $annot The annotation class instance
[ "Configures", "the", "_controller", "default", "parameter", "of", "a", "given", "Route", "instance", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php#L30-L37
train
Configure route with default values
[ 30522, 5123, 3853, 9530, 8873, 27390, 10624, 10421, 1006, 2799, 1002, 2799, 1010, 1032, 9185, 26266, 1002, 2465, 1010, 1032, 9185, 11368, 6806, 2094, 1002, 4118, 1010, 1002, 5754, 4140, 1007, 1063, 2065, 1006, 1005, 1035, 1035, 1999, 6767, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Handler/CurlFactory.php
CurlFactory.removeHeader
private function removeHeader($name, array &$options) { foreach (array_keys($options['_headers']) as $key) { if (!strcasecmp($key, $name)) { unset($options['_headers'][$key]); return; } } }
php
private function removeHeader($name, array &$options) { foreach (array_keys($options['_headers']) as $key) { if (!strcasecmp($key, $name)) { unset($options['_headers'][$key]); return; } } }
[ "private", "function", "removeHeader", "(", "$", "name", ",", "array", "&", "$", "options", ")", "{", "foreach", "(", "array_keys", "(", "$", "options", "[", "'_headers'", "]", ")", "as", "$", "key", ")", "{", "if", "(", "!", "strcasecmp", "(", "$", ...
Remove a header from the options array. @param string $name Case-insensitive header to remove @param array $options Array of options to modify
[ "Remove", "a", "header", "from", "the", "options", "array", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Handler/CurlFactory.php#L328-L336
train
Remove header from header array
[ 30522, 2797, 3853, 6366, 4974, 2121, 1006, 1002, 2171, 1010, 9140, 1004, 1002, 7047, 1007, 1063, 18921, 6776, 1006, 9140, 1035, 6309, 1006, 1002, 7047, 1031, 1005, 1035, 20346, 2015, 1005, 1033, 1007, 2004, 1002, 3145, 1007, 1063, 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...
matomo-org/matomo
libs/Zend/Cache/Backend.php
Zend_Cache_Backend.setOption
public function setOption($name, $value) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name : $name"); } $name = strtolower($name); if (array_key_exists($name, $this->_options)) { $this->_options[$name] = $value; } }
php
public function setOption($name, $value) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name : $name"); } $name = strtolower($name); if (array_key_exists($name, $this->_options)) { $this->_options[$name] = $value; } }
[ "public", "function", "setOption", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "Zend_Cache", "::", "throwException", "(", "\"Incorrect option name : $name\"", ")", ";", "}", "$", "name", "=...
Set an option @param string $name @param mixed $value @throws Zend_Cache_Exception @return void
[ "Set", "an", "option" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend.php#L103-L112
train
Set an option value
[ 30522, 2270, 3853, 2275, 7361, 3508, 1006, 1002, 2171, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 2171, 1007, 1007, 1063, 16729, 2094, 1035, 17053, 1024, 1024, 5466, 10288, 24422, 1006, 1000, 16542, 5724, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Helpers/LogViewer.php
LogViewer.parseTrace
public static function parseTrace($trace, $rows = 10) { $lines = array_filter(preg_split('/#\d*/m', $trace)); return array_slice($lines, 0, $rows); }
php
public static function parseTrace($trace, $rows = 10) { $lines = array_filter(preg_split('/#\d*/m', $trace)); return array_slice($lines, 0, $rows); }
[ "public", "static", "function", "parseTrace", "(", "$", "trace", ",", "$", "rows", "=", "10", ")", "{", "$", "lines", "=", "array_filter", "(", "preg_split", "(", "'/#\\d*/m'", ",", "$", "trace", ")", ")", ";", "return", "array_slice", "(", "$", "lines...
Parse text of trace into an array of lines @param string $trace @param int $rows @return array
[ "Parse", "text", "of", "trace", "into", "an", "array", "of", "lines" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L143-L147
train
Parse the trace into an array of terms
[ 30522, 2270, 10763, 3853, 11968, 13462, 22903, 1006, 1002, 7637, 1010, 1002, 10281, 1027, 2184, 1007, 1063, 1002, 3210, 1027, 9140, 1035, 11307, 1006, 3653, 2290, 1035, 3975, 1006, 1005, 1013, 1001, 1032, 1040, 1008, 1013, 1049, 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...
laravel/framework
src/Illuminate/Routing/RoutingServiceProvider.php
RoutingServiceProvider.registerPsrRequest
protected function registerPsrRequest() { $this->app->bind(ServerRequestInterface::class, function ($app) { return (new DiactorosFactory)->createRequest($app->make('request')); }); }
php
protected function registerPsrRequest() { $this->app->bind(ServerRequestInterface::class, function ($app) { return (new DiactorosFactory)->createRequest($app->make('request')); }); }
[ "protected", "function", "registerPsrRequest", "(", ")", "{", "$", "this", "->", "app", "->", "bind", "(", "ServerRequestInterface", "::", "class", ",", "function", "(", "$", "app", ")", "{", "return", "(", "new", "DiactorosFactory", ")", "->", "createReques...
Register a binding for the PSR-7 request implementation. @return void
[ "Register", "a", "binding", "for", "the", "PSR", "-", "7", "request", "implementation", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RoutingServiceProvider.php#L125-L130
train
Register the PSR - 7 request.
[ 30522, 5123, 3853, 4236, 4523, 14343, 15500, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 14187, 1006, 8241, 2890, 15500, 18447, 2121, 12172, 1024, 1024, 2465, 1010, 3853, 1006, 1002, 10439, 30524, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.aggregateRowWithLabel
protected function aggregateRowWithLabel(Row $row, $columnAggregationOps) { $labelToLookFor = $row->getColumn('label'); if ($labelToLookFor === false) { throw new Exception("Label column not found in the table to add in addDataTable()"); } $rowFound = $this->getRowFromLabel($labelToLookFor); if ($rowFound === false) { if ($labelToLookFor === self::LABEL_SUMMARY_ROW) { $this->addSummaryRow($row); } else { $this->addRow($row); } } else { $rowFound->sumRow($row, $copyMeta = true, $columnAggregationOps); // if the row to add has a subtable whereas the current row doesn't // we simply add it (cloning the subtable) // if the row has the subtable already // then we have to recursively sum the subtables $subTable = $row->getSubtable(); if ($subTable) { $subTable->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] = $columnAggregationOps; $rowFound->sumSubtable($subTable); } } }
php
protected function aggregateRowWithLabel(Row $row, $columnAggregationOps) { $labelToLookFor = $row->getColumn('label'); if ($labelToLookFor === false) { throw new Exception("Label column not found in the table to add in addDataTable()"); } $rowFound = $this->getRowFromLabel($labelToLookFor); if ($rowFound === false) { if ($labelToLookFor === self::LABEL_SUMMARY_ROW) { $this->addSummaryRow($row); } else { $this->addRow($row); } } else { $rowFound->sumRow($row, $copyMeta = true, $columnAggregationOps); // if the row to add has a subtable whereas the current row doesn't // we simply add it (cloning the subtable) // if the row has the subtable already // then we have to recursively sum the subtables $subTable = $row->getSubtable(); if ($subTable) { $subTable->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] = $columnAggregationOps; $rowFound->sumSubtable($subTable); } } }
[ "protected", "function", "aggregateRowWithLabel", "(", "Row", "$", "row", ",", "$", "columnAggregationOps", ")", "{", "$", "labelToLookFor", "=", "$", "row", "->", "getColumn", "(", "'label'", ")", ";", "if", "(", "$", "labelToLookFor", "===", "false", ")", ...
Aggregates the $row columns to this table. $row must have a column "label". The $row will be summed to this table's row with the same label. @param $row @params null|array $columnAggregationOps @throws \Exception
[ "Aggregates", "the", "$row", "columns", "to", "this", "table", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1848-L1874
train
Aggregate the row with the label
[ 30522, 5123, 3853, 9572, 10524, 24415, 20470, 2884, 1006, 5216, 1002, 5216, 1010, 1002, 5930, 8490, 17603, 12540, 11923, 1007, 1063, 1002, 3830, 3406, 4135, 6559, 29278, 1027, 1002, 5216, 1011, 1028, 2131, 25778, 2819, 2078, 1006, 1005, 383...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
SQLiteGrammar.compileRenameIndex
public function compileRenameIndex(Blueprint $blueprint, Fluent $command, Connection $connection) { $schemaManager = $connection->getDoctrineSchemaManager(); $indexes = $schemaManager->listTableIndexes($this->getTablePrefix().$blueprint->getTable()); $index = Arr::get($indexes, $command->from); if (! $index) { throw new RuntimeException("Index [{$command->from}] does not exist."); } $newIndex = new Index( $command->to, $index->getColumns(), $index->isUnique(), $index->isPrimary(), $index->getFlags(), $index->getOptions() ); $platform = $schemaManager->getDatabasePlatform(); return [ $platform->getDropIndexSQL($command->from, $this->getTablePrefix().$blueprint->getTable()), $platform->getCreateIndexSQL($newIndex, $this->getTablePrefix().$blueprint->getTable()), ]; }
php
public function compileRenameIndex(Blueprint $blueprint, Fluent $command, Connection $connection) { $schemaManager = $connection->getDoctrineSchemaManager(); $indexes = $schemaManager->listTableIndexes($this->getTablePrefix().$blueprint->getTable()); $index = Arr::get($indexes, $command->from); if (! $index) { throw new RuntimeException("Index [{$command->from}] does not exist."); } $newIndex = new Index( $command->to, $index->getColumns(), $index->isUnique(), $index->isPrimary(), $index->getFlags(), $index->getOptions() ); $platform = $schemaManager->getDatabasePlatform(); return [ $platform->getDropIndexSQL($command->from, $this->getTablePrefix().$blueprint->getTable()), $platform->getCreateIndexSQL($newIndex, $this->getTablePrefix().$blueprint->getTable()), ]; }
[ "public", "function", "compileRenameIndex", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "command", ",", "Connection", "$", "connection", ")", "{", "$", "schemaManager", "=", "$", "connection", "->", "getDoctrineSchemaManager", "(", ")", ";", "$", "...
Compile a rename index command. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $command @param \Illuminate\Database\Connection $connection @return array
[ "Compile", "a", "rename", "index", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php#L342-L365
train
Compile rename index command.
[ 30522, 2270, 3853, 21624, 8189, 26432, 13629, 2595, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 3094, 1010, 4434, 1002, 4434, 1007, 1063, 1002, 8040, 28433, 24805, 4590, 1027, 1002, 4434, 1011, 1028, 2131, 3527, 6593, 11467, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Core.php
Zend_Cache_Core.clean
public function clean($mode = 'all', $tags = array()) { if (!$this->_options['caching']) { return true; } if (!in_array($mode, array(Zend_Cache::CLEANING_MODE_ALL, Zend_Cache::CLEANING_MODE_OLD, Zend_Cache::CLEANING_MODE_MATCHING_TAG, Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG, Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG))) { Zend_Cache::throwException('Invalid cleaning mode'); } self::_validateTagsArray($tags); return $this->_backend->clean($mode, $tags); }
php
public function clean($mode = 'all', $tags = array()) { if (!$this->_options['caching']) { return true; } if (!in_array($mode, array(Zend_Cache::CLEANING_MODE_ALL, Zend_Cache::CLEANING_MODE_OLD, Zend_Cache::CLEANING_MODE_MATCHING_TAG, Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG, Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG))) { Zend_Cache::throwException('Invalid cleaning mode'); } self::_validateTagsArray($tags); return $this->_backend->clean($mode, $tags); }
[ "public", "function", "clean", "(", "$", "mode", "=", "'all'", ",", "$", "tags", "=", "array", "(", ")", ")", "{", "if", "(", "!", "$", "this", "->", "_options", "[", "'caching'", "]", ")", "{", "return", "true", ";", "}", "if", "(", "!", "in_a...
Clean cache entries Available modes are : 'all' (default) => remove all cache entries ($tags is not used) 'old' => remove too old cache entries ($tags is not used) 'matchingTag' => remove cache entries matching all given tags ($tags can be an array of strings or a single string) 'notMatchingTag' => remove cache entries not matching one of the given tags ($tags can be an array of strings or a single string) 'matchingAnyTag' => remove cache entries matching any given tags ($tags can be an array of strings or a single string) @param string $mode @param array|string $tags @throws Zend_Cache_Exception @return boolean True if ok
[ "Clean", "cache", "entries" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L450-L465
train
Clean cache entries
[ 30522, 2270, 3853, 4550, 1006, 1002, 5549, 1027, 1005, 2035, 1005, 1010, 1002, 22073, 1027, 9140, 1006, 1007, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 7047, 1031, 1005, 6187, 8450, 1005, 1033, 1007, 1063, 2709, 2995, 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/Common.php
Common.convertVisitorIdToBin
public static function convertVisitorIdToBin($id) { if (strlen($id) !== Tracker::LENGTH_HEX_ID_STRING || @bin2hex(self::hex2bin($id)) != $id ) { throw new Exception("visitorId is expected to be a " . Tracker::LENGTH_HEX_ID_STRING . " hex char string"); } return self::hex2bin($id); }
php
public static function convertVisitorIdToBin($id) { if (strlen($id) !== Tracker::LENGTH_HEX_ID_STRING || @bin2hex(self::hex2bin($id)) != $id ) { throw new Exception("visitorId is expected to be a " . Tracker::LENGTH_HEX_ID_STRING . " hex char string"); } return self::hex2bin($id); }
[ "public", "static", "function", "convertVisitorIdToBin", "(", "$", "id", ")", "{", "if", "(", "strlen", "(", "$", "id", ")", "!==", "Tracker", "::", "LENGTH_HEX_ID_STRING", "||", "@", "bin2hex", "(", "self", "::", "hex2bin", "(", "$", "id", ")", ")", "...
This function will convert the input string to the binary representation of the ID but it will throw an Exception if the specified input ID is not correct This is used when building segments containing visitorId which could be an invalid string therefore throwing Unexpected PHP error [pack(): Type H: illegal hex digit i] severity [E_WARNING] It would be simply to silent fail the pack() call above but in all other cases, we don't expect an error, so better be safe and get the php error when something unexpected is happening @param string $id @throws Exception @return string binary string
[ "This", "function", "will", "convert", "the", "input", "string", "to", "the", "binary", "representation", "of", "the", "ID", "but", "it", "will", "throw", "an", "Exception", "if", "the", "specified", "input", "ID", "is", "not", "correct" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L687-L696
train
Convert the visitor id to a binary string
[ 30522, 2270, 10763, 3853, 10463, 11365, 15660, 3593, 3406, 8428, 1006, 1002, 8909, 1007, 1063, 2065, 1006, 2358, 20927, 2078, 1006, 1002, 8909, 1007, 999, 1027, 1027, 27080, 1024, 1024, 3091, 1035, 2002, 2595, 1035, 8909, 1035, 5164, 1064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Blueprint.php
Blueprint.indexCommand
protected function indexCommand($type, $columns, $index, $algorithm = null) { $columns = (array) $columns; // If no name was specified for this index, we will create one using a basic // convention of the table name, followed by the columns, followed by an // index type, such as primary or index, which makes the index unique. $index = $index ?: $this->createIndexName($type, $columns); return $this->addCommand( $type, compact('index', 'columns', 'algorithm') ); }
php
protected function indexCommand($type, $columns, $index, $algorithm = null) { $columns = (array) $columns; // If no name was specified for this index, we will create one using a basic // convention of the table name, followed by the columns, followed by an // index type, such as primary or index, which makes the index unique. $index = $index ?: $this->createIndexName($type, $columns); return $this->addCommand( $type, compact('index', 'columns', 'algorithm') ); }
[ "protected", "function", "indexCommand", "(", "$", "type", ",", "$", "columns", ",", "$", "index", ",", "$", "algorithm", "=", "null", ")", "{", "$", "columns", "=", "(", "array", ")", "$", "columns", ";", "// If no name was specified for this index, we will c...
Add a new index command to the blueprint. @param string $type @param string|array $columns @param string $index @param string|null $algorithm @return \Illuminate\Support\Fluent
[ "Add", "a", "new", "index", "command", "to", "the", "blueprint", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L1246-L1258
train
Adds an index command to the sequence
[ 30522, 5123, 3853, 5950, 9006, 2386, 2094, 1006, 1002, 2828, 1010, 1002, 7753, 1010, 1002, 5950, 1010, 1002, 9896, 1027, 19701, 1007, 1063, 1002, 7753, 1027, 1006, 9140, 1007, 1002, 7753, 1025, 1013, 1013, 2065, 2053, 2171, 2001, 9675, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Filesystem/Filesystem.php
Filesystem.pathinfo
public function pathinfo(string $path, int $options = null) { [$scheme, $path] = $this->getSchemeAndHierarchy($path); if ($this->normalize || ($scheme && null === $this->normalize)) { $path = $this->normalizePathPart($path); } return $this->pathinfoInternal($scheme, $path, $options); }
php
public function pathinfo(string $path, int $options = null) { [$scheme, $path] = $this->getSchemeAndHierarchy($path); if ($this->normalize || ($scheme && null === $this->normalize)) { $path = $this->normalizePathPart($path); } return $this->pathinfoInternal($scheme, $path, $options); }
[ "public", "function", "pathinfo", "(", "string", "$", "path", ",", "int", "$", "options", "=", "null", ")", "{", "[", "$", "scheme", ",", "$", "path", "]", "=", "$", "this", "->", "getSchemeAndHierarchy", "(", "$", "path", ")", ";", "if", "(", "$",...
{@inheritdoc} @see FilesystemInterface::pathinfo()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Filesystem/Filesystem.php#L153-L162
train
Returns information about the path
[ 30522, 2270, 3853, 4130, 2378, 14876, 1006, 5164, 1002, 4130, 1010, 20014, 1002, 7047, 1027, 19701, 1007, 1063, 1031, 1002, 5679, 1010, 1002, 4130, 1033, 1027, 1002, 2023, 1011, 1028, 4152, 5403, 4168, 5685, 4048, 6906, 29389, 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/backend/widgets/MediaManager.php
MediaManager.getCropEditImageUrlAndSize
protected function getCropEditImageUrlAndSize($path, $cropSessionKey, $params = null) { $sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey); $fullSessionDirectoryPath = temp_path($sessionDirectoryPath); $sessionDirectoryCreated = false; if (!File::isDirectory($fullSessionDirectoryPath)) { File::makeDirectory($fullSessionDirectoryPath, 0777, true, true); $sessionDirectoryCreated = true; } $tempFilePath = null; try { $extension = pathinfo($path, PATHINFO_EXTENSION); $library = MediaLibrary::instance(); $originalThumbFileName = 'original.'.$extension; /* * If the target dimensions are not provided, save the original image to the * crop session directory and return its URL. */ if (!$params) { $tempFilePath = $fullSessionDirectoryPath.'/'.$originalThumbFileName; if (!@File::put($tempFilePath, $library->get($path))) { throw new SystemException('Error saving remote file to a temporary location.'); } $url = $this->getThumbnailImageUrl($sessionDirectoryPath.'/'.$originalThumbFileName); $dimensions = getimagesize($tempFilePath); return [ 'url' => $url, 'dimensions' => $dimensions ]; } /* * If the target dimensions are provided, resize the original image and * return its URL and dimensions. */ $originalFilePath = $fullSessionDirectoryPath.'/'.$originalThumbFileName; if (!File::isFile($originalFilePath)) { throw new SystemException('The original image is not found in the cropping session directory.'); } $resizedThumbFileName = 'resized-'.$params['width'].'-'.$params['height'].'.'.$extension; $tempFilePath = $fullSessionDirectoryPath.'/'.$resizedThumbFileName; Resizer::open($originalFilePath) ->resize($params['width'], $params['height'], [ 'mode' => 'exact' ]) ->save($tempFilePath) ; $url = $this->getThumbnailImageUrl($sessionDirectoryPath.'/'.$resizedThumbFileName); $dimensions = getimagesize($tempFilePath); return [ 'url' => $url, 'dimensions' => $dimensions ]; } catch (Exception $ex) { if ($sessionDirectoryCreated) { @File::deleteDirectory($fullSessionDirectoryPath); } if ($tempFilePath) { File::delete($tempFilePath); } throw $ex; } }
php
protected function getCropEditImageUrlAndSize($path, $cropSessionKey, $params = null) { $sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey); $fullSessionDirectoryPath = temp_path($sessionDirectoryPath); $sessionDirectoryCreated = false; if (!File::isDirectory($fullSessionDirectoryPath)) { File::makeDirectory($fullSessionDirectoryPath, 0777, true, true); $sessionDirectoryCreated = true; } $tempFilePath = null; try { $extension = pathinfo($path, PATHINFO_EXTENSION); $library = MediaLibrary::instance(); $originalThumbFileName = 'original.'.$extension; /* * If the target dimensions are not provided, save the original image to the * crop session directory and return its URL. */ if (!$params) { $tempFilePath = $fullSessionDirectoryPath.'/'.$originalThumbFileName; if (!@File::put($tempFilePath, $library->get($path))) { throw new SystemException('Error saving remote file to a temporary location.'); } $url = $this->getThumbnailImageUrl($sessionDirectoryPath.'/'.$originalThumbFileName); $dimensions = getimagesize($tempFilePath); return [ 'url' => $url, 'dimensions' => $dimensions ]; } /* * If the target dimensions are provided, resize the original image and * return its URL and dimensions. */ $originalFilePath = $fullSessionDirectoryPath.'/'.$originalThumbFileName; if (!File::isFile($originalFilePath)) { throw new SystemException('The original image is not found in the cropping session directory.'); } $resizedThumbFileName = 'resized-'.$params['width'].'-'.$params['height'].'.'.$extension; $tempFilePath = $fullSessionDirectoryPath.'/'.$resizedThumbFileName; Resizer::open($originalFilePath) ->resize($params['width'], $params['height'], [ 'mode' => 'exact' ]) ->save($tempFilePath) ; $url = $this->getThumbnailImageUrl($sessionDirectoryPath.'/'.$resizedThumbFileName); $dimensions = getimagesize($tempFilePath); return [ 'url' => $url, 'dimensions' => $dimensions ]; } catch (Exception $ex) { if ($sessionDirectoryCreated) { @File::deleteDirectory($fullSessionDirectoryPath); } if ($tempFilePath) { File::delete($tempFilePath); } throw $ex; } }
[ "protected", "function", "getCropEditImageUrlAndSize", "(", "$", "path", ",", "$", "cropSessionKey", ",", "$", "params", "=", "null", ")", "{", "$", "sessionDirectoryPath", "=", "$", "this", "->", "getCropSessionDirPath", "(", "$", "cropSessionKey", ")", ";", ...
Prepares an image for cropping and returns payload containing a URL @param string $path @param string $cropSessionKey @param array $params @return array
[ "Prepares", "an", "image", "for", "cropping", "and", "returns", "payload", "containing", "a", "URL" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1658-L1734
train
Returns the URL and dimensions of the crop edit image.
[ 30522, 5123, 3853, 2131, 26775, 24174, 25090, 26860, 3126, 8653, 4697, 1006, 1002, 4130, 1010, 1002, 8765, 7971, 3258, 14839, 1010, 1002, 11498, 5244, 1027, 19701, 1007, 1063, 1002, 5219, 4305, 2890, 16761, 22571, 8988, 1027, 1002, 2023, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Period/Range.php
Range.getDateXPeriodsAgo
public static function getDateXPeriodsAgo($subXPeriods, $date = false, $period = false) { if ($date === false) { $date = Common::getRequestVar('date'); } if ($period === false) { $period = Common::getRequestVar('period'); } if (365 == $subXPeriods && 'day' == $period && Date::today()->isLeapYear()) { $subXPeriods = 366; } // can't get the last date for range periods & dates that use lastN/previousN $strLastDate = false; $lastPeriod = false; if ($period != 'range' && !preg_match('/(last|previous)([0-9]*)/', $date, $regs)) { if (strpos($date, ',')) { // date in the form of 2011-01-01,2011-02-02 $rangePeriod = new Range($period, $date); $lastStartDate = $rangePeriod->getDateStart()->subPeriod($subXPeriods, $period); $lastEndDate = $rangePeriod->getDateEnd()->subPeriod($subXPeriods, $period); $strLastDate = "$lastStartDate,$lastEndDate"; } else { $lastPeriod = Date::factory($date)->subPeriod($subXPeriods, $period); $strLastDate = $lastPeriod->toString(); } } return array($strLastDate, $lastPeriod); }
php
public static function getDateXPeriodsAgo($subXPeriods, $date = false, $period = false) { if ($date === false) { $date = Common::getRequestVar('date'); } if ($period === false) { $period = Common::getRequestVar('period'); } if (365 == $subXPeriods && 'day' == $period && Date::today()->isLeapYear()) { $subXPeriods = 366; } // can't get the last date for range periods & dates that use lastN/previousN $strLastDate = false; $lastPeriod = false; if ($period != 'range' && !preg_match('/(last|previous)([0-9]*)/', $date, $regs)) { if (strpos($date, ',')) { // date in the form of 2011-01-01,2011-02-02 $rangePeriod = new Range($period, $date); $lastStartDate = $rangePeriod->getDateStart()->subPeriod($subXPeriods, $period); $lastEndDate = $rangePeriod->getDateEnd()->subPeriod($subXPeriods, $period); $strLastDate = "$lastStartDate,$lastEndDate"; } else { $lastPeriod = Date::factory($date)->subPeriod($subXPeriods, $period); $strLastDate = $lastPeriod->toString(); } } return array($strLastDate, $lastPeriod); }
[ "public", "static", "function", "getDateXPeriodsAgo", "(", "$", "subXPeriods", ",", "$", "date", "=", "false", ",", "$", "period", "=", "false", ")", "{", "if", "(", "$", "date", "===", "false", ")", "{", "$", "date", "=", "Common", "::", "getRequestVa...
Returns the date that is X periods before the supplied date. @param bool|string $date The date to get the last date of. @param bool|string $period The period to use (either 'day', 'week', 'month', 'year'); @param int $subXPeriods How many periods in the past the date should be, for instance 1 or 7. If sub period is 365 days and the current year is a leap year we assume you want to get the day one year ago and change the value to 366 days therefore. @return array An array with two elements, a string for the date before $date and a Period instance for the period before $date. @api
[ "Returns", "the", "date", "that", "is", "X", "periods", "before", "the", "supplied", "date", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L456-L490
train
Returns the last X periods and period for a given date and time.
[ 30522, 2270, 10763, 3853, 2131, 13701, 2595, 4842, 3695, 5104, 23692, 1006, 1002, 4942, 2595, 4842, 3695, 5104, 1010, 1002, 3058, 1027, 6270, 1010, 1002, 2558, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 3058, 1027, 1027, 1027, 6270, 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/Plugin/Manager.php
Manager.loadPlugins
public function loadPlugins(array $pluginsToLoad) { $this->resetTransientCache(); $this->pluginsToLoad = $this->makePluginsToLoad($pluginsToLoad); $this->reloadActivatedPlugins(); }
php
public function loadPlugins(array $pluginsToLoad) { $this->resetTransientCache(); $this->pluginsToLoad = $this->makePluginsToLoad($pluginsToLoad); $this->reloadActivatedPlugins(); }
[ "public", "function", "loadPlugins", "(", "array", "$", "pluginsToLoad", ")", "{", "$", "this", "->", "resetTransientCache", "(", ")", ";", "$", "this", "->", "pluginsToLoad", "=", "$", "this", "->", "makePluginsToLoad", "(", "$", "pluginsToLoad", ")", ";", ...
Load AND activates the specified plugins. It will also overwrite all previously loaded plugins, so it acts as a setter. @param array $pluginsToLoad Array of plugins to load.
[ "Load", "AND", "activates", "the", "specified", "plugins", ".", "It", "will", "also", "overwrite", "all", "previously", "loaded", "plugins", "so", "it", "acts", "as", "a", "setter", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L859-L864
train
Load the list of plugins to load
[ 30522, 2270, 3853, 7170, 24759, 15916, 7076, 1006, 9140, 1002, 13354, 7076, 3406, 11066, 1007, 1063, 1002, 2023, 1011, 1028, 25141, 6494, 3619, 11638, 3540, 5403, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 13354, 7076, 3406, 11066, 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...
z-song/laravel-admin
src/Form/EmbeddedForm.php
EmbeddedForm.prepare
public function prepare($input) { foreach ($input as $key => $record) { $this->setFieldOriginalValue($key); $input[$key] = $this->prepareValue($key, $record); } return $input; }
php
public function prepare($input) { foreach ($input as $key => $record) { $this->setFieldOriginalValue($key); $input[$key] = $this->prepareValue($key, $record); } return $input; }
[ "public", "function", "prepare", "(", "$", "input", ")", "{", "foreach", "(", "$", "input", "as", "$", "key", "=>", "$", "record", ")", "{", "$", "this", "->", "setFieldOriginalValue", "(", "$", "key", ")", ";", "$", "input", "[", "$", "key", "]", ...
Prepare for insert or update. @param array $input @return mixed
[ "Prepare", "for", "insert", "or", "update", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/EmbeddedForm.php#L145-L153
train
Prepare input array for saving to DB
[ 30522, 2270, 3853, 7374, 1006, 1002, 7953, 1007, 1063, 18921, 6776, 1006, 1002, 7953, 2004, 1002, 3145, 1027, 1028, 1002, 2501, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 3790, 10050, 24965, 10175, 5657, 1006, 1002, 3145, 1007, 1025, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Map.php
Map.getMetadataIntersectArray
public function getMetadataIntersectArray($name) { $data = array(); foreach ($this->getDataTables() as $childTable) { $childData = $childTable->getMetadata($name); if (is_array($childData)) { $data = array_intersect($data, $childData); } } return array_values($data); }
php
public function getMetadataIntersectArray($name) { $data = array(); foreach ($this->getDataTables() as $childTable) { $childData = $childTable->getMetadata($name); if (is_array($childData)) { $data = array_intersect($data, $childData); } } return array_values($data); }
[ "public", "function", "getMetadataIntersectArray", "(", "$", "name", ")", "{", "$", "data", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getDataTables", "(", ")", "as", "$", "childTable", ")", "{", "$", "childData", "=", "$", "child...
Returns the intersection of children's metadata arrays (what they all have in common). @param string $name The metadata name. @return mixed
[ "Returns", "the", "intersection", "of", "children", "s", "metadata", "arrays", "(", "what", "they", "all", "have", "in", "common", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Map.php#L503-L513
train
Get metadata intersect array
[ 30522, 2270, 3853, 2131, 11368, 8447, 18249, 7747, 22471, 2906, 9447, 1006, 1002, 2171, 1007, 1063, 1002, 2951, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 2850, 29336, 3085, 2015, 1006, 1007, 2004, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/FormField.php
FormField.isSelected
public function isSelected($value = true) { if ($this->value === null) { return false; } return (string) $value === (string) $this->value; }
php
public function isSelected($value = true) { if ($this->value === null) { return false; } return (string) $value === (string) $this->value; }
[ "public", "function", "isSelected", "(", "$", "value", "=", "true", ")", "{", "if", "(", "$", "this", "->", "value", "===", "null", ")", "{", "return", "false", ";", "}", "return", "(", "string", ")", "$", "value", "===", "(", "string", ")", "$", ...
Determine if the provided value matches this field's value. @param string $value @return bool
[ "Determine", "if", "the", "provided", "value", "matches", "this", "field", "s", "value", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormField.php#L367-L374
train
Returns true if the value of the field is the same as the currently selected value.
[ 30522, 2270, 3853, 26354, 12260, 10985, 1006, 1002, 3643, 1027, 2995, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3643, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 6270, 1025, 1065, 2709, 1006, 5164, 1007, 1002, 3643, 1027, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/API.php
API.shouldRegionCodesBeConvertedToIso
private function shouldRegionCodesBeConvertedToIso($archiveDate, $date, $period) { $timeOfSwitch = Option::get(GeoIp2::SWITCH_TO_ISO_REGIONS_OPTION_NAME); if (empty($timeOfSwitch)) { return false; // if option was not set, all codes are fips codes, so leave them } try { $dateOfSwitch = Date::factory((int)$timeOfSwitch); $period = Period\Factory::build($period, $date); $periodStart = $period->getDateStart(); } catch (Exception $e) { return false; } // if all region codes in log tables have been converted, check if archiving date was after the date of switch to iso // this check might not be fully correct in cases were only periods > day get recreated, but it should avoid some // double conversion if all archives have been recreated after converting all region codes $codesConverted = Option::get(ConvertRegionCodesToIso::OPTION_NAME); if ($codesConverted && $archiveDate) { try { $dateOfArchive = Date::factory($archiveDate); if ($dateOfArchive->isLater($dateOfSwitch)) { return false; } } catch (Exception $e) { } } if ($dateOfSwitch->isEarlier($periodStart)) { return false; } return true; }
php
private function shouldRegionCodesBeConvertedToIso($archiveDate, $date, $period) { $timeOfSwitch = Option::get(GeoIp2::SWITCH_TO_ISO_REGIONS_OPTION_NAME); if (empty($timeOfSwitch)) { return false; // if option was not set, all codes are fips codes, so leave them } try { $dateOfSwitch = Date::factory((int)$timeOfSwitch); $period = Period\Factory::build($period, $date); $periodStart = $period->getDateStart(); } catch (Exception $e) { return false; } // if all region codes in log tables have been converted, check if archiving date was after the date of switch to iso // this check might not be fully correct in cases were only periods > day get recreated, but it should avoid some // double conversion if all archives have been recreated after converting all region codes $codesConverted = Option::get(ConvertRegionCodesToIso::OPTION_NAME); if ($codesConverted && $archiveDate) { try { $dateOfArchive = Date::factory($archiveDate); if ($dateOfArchive->isLater($dateOfSwitch)) { return false; } } catch (Exception $e) { } } if ($dateOfSwitch->isEarlier($periodStart)) { return false; } return true; }
[ "private", "function", "shouldRegionCodesBeConvertedToIso", "(", "$", "archiveDate", ",", "$", "date", ",", "$", "period", ")", "{", "$", "timeOfSwitch", "=", "Option", "::", "get", "(", "GeoIp2", "::", "SWITCH_TO_ISO_REGIONS_OPTION_NAME", ")", ";", "if", "(", ...
if no switch to ISO was done --> no conversion as only FIPS codes are in use and handled correctly if there has been a switch to ISO, we need to check the date: - if the start date of the period is after the date we switched to ISO: no conversion needed - if not we need to convert the codes to ISO, if the code is mappable Note: as all old codes are mapped, not mappable codes need to be iso codes already, so we leave them @param $date @param $period @return bool
[ "if", "no", "switch", "to", "ISO", "was", "done", "--", ">", "no", "conversion", "as", "only", "FIPS", "codes", "are", "in", "use", "and", "handled", "correctly", "if", "there", "has", "been", "a", "switch", "to", "ISO", "we", "need", "to", "check", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/API.php#L292-L329
train
Returns true if all region codes should be converted to ISO
[ 30522, 2797, 3853, 2323, 23784, 23237, 4783, 8663, 26686, 3406, 19565, 1006, 1002, 9749, 3686, 1010, 1002, 3058, 1010, 1002, 2558, 1007, 1063, 1002, 2051, 11253, 26760, 20189, 1027, 5724, 1024, 1024, 2131, 1006, 20248, 11514, 2475, 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...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/RoutingExtension.php
RoutingExtension.isUrlGenerationSafe
public function isUrlGenerationSafe(Node $argsNode) { // support named arguments $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( $argsNode->hasNode(1) ? $argsNode->getNode(1) : null ); if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 && (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression) ) { return ['html']; } return []; }
php
public function isUrlGenerationSafe(Node $argsNode) { // support named arguments $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( $argsNode->hasNode(1) ? $argsNode->getNode(1) : null ); if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 && (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression) ) { return ['html']; } return []; }
[ "public", "function", "isUrlGenerationSafe", "(", "Node", "$", "argsNode", ")", "{", "// support named arguments", "$", "paramsNode", "=", "$", "argsNode", "->", "hasNode", "(", "'parameters'", ")", "?", "$", "argsNode", "->", "getNode", "(", "'parameters'", ")"...
Determines at compile time whether the generated URL will be safe and thus saving the unneeded automatic escaping for performance reasons. The URL generation process percent encodes non-alphanumeric characters. So there is no risk that malicious/invalid characters are part of the URL. The only character within an URL that must be escaped in html is the ampersand ("&") which separates query params. So we cannot mark the URL generation as always safe, but only when we are sure there won't be multiple query params. This is the case when there are none or only one constant parameter given. E.g. we know beforehand this will be safe: - path('route') - path('route', {'param': 'value'}) But the following may not: - path('route', var) - path('route', {'param': ['val1', 'val2'] }) // a sub-array - path('route', {'param1': 'value1', 'param2': 'value2'}) If param1 and param2 reference placeholder in the route, it would still be safe. But we don't know. @param Node $argsNode The arguments of the path/url function @return array An array with the contexts the URL is safe @final
[ "Determines", "at", "compile", "time", "whether", "the", "generated", "URL", "will", "be", "safe", "and", "thus", "saving", "the", "unneeded", "automatic", "escaping", "for", "performance", "reasons", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php#L96-L110
train
Returns an array of url parameters that can be used to generate the url
[ 30522, 2270, 3853, 2003, 3126, 28875, 3678, 10708, 10354, 2063, 1006, 13045, 1002, 12098, 5620, 3630, 3207, 1007, 1063, 1013, 1013, 2490, 2315, 9918, 1002, 11498, 5244, 3630, 3207, 1027, 1002, 12098, 5620, 3630, 3207, 1011, 1028, 8440, 1024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Development.php
Development.methodExists
public static function methodExists($classOrObject, $method) { if (is_string($classOrObject)) { return class_exists($classOrObject) && method_exists($classOrObject, $method); } return method_exists($classOrObject, $method); }
php
public static function methodExists($classOrObject, $method) { if (is_string($classOrObject)) { return class_exists($classOrObject) && method_exists($classOrObject, $method); } return method_exists($classOrObject, $method); }
[ "public", "static", "function", "methodExists", "(", "$", "classOrObject", ",", "$", "method", ")", "{", "if", "(", "is_string", "(", "$", "classOrObject", ")", ")", "{", "return", "class_exists", "(", "$", "classOrObject", ")", "&&", "method_exists", "(", ...
Verifies whether a className of object implements the given method. It does not check whether the given method is actually callable (public). @param string|object $classOrObject @param string $method @return bool true if the method exists, false otherwise.
[ "Verifies", "whether", "a", "className", "of", "object", "implements", "the", "given", "method", ".", "It", "does", "not", "check", "whether", "the", "given", "method", "is", "actually", "callable", "(", "public", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Development.php#L51-L58
train
Method exists in the hierarchy of classes
[ 30522, 2270, 10763, 3853, 4118, 10288, 5130, 1006, 1002, 2465, 14604, 2497, 20614, 1010, 1002, 4118, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 2465, 14604, 2497, 20614, 1007, 1007, 1063, 2709, 2465, 1035, 6526, 1006, 1002, 2465,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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._metadatasFile
protected function _metadatasFile($id) { $path = $this->_path($id); $fileName = $this->_idToFileName('internal-metadatas---' . $id); return $path . $fileName; }
php
protected function _metadatasFile($id) { $path = $this->_path($id); $fileName = $this->_idToFileName('internal-metadatas---' . $id); return $path . $fileName; }
[ "protected", "function", "_metadatasFile", "(", "$", "id", ")", "{", "$", "path", "=", "$", "this", "->", "_path", "(", "$", "id", ")", ";", "$", "fileName", "=", "$", "this", "->", "_idToFileName", "(", "'internal-metadatas---'", ".", "$", "id", ")", ...
Make and return a file name (with path) for metadatas @param string $id Cache id @return string Metadatas file name (with path)
[ "Make", "and", "return", "a", "file", "name", "(", "with", "path", ")", "for", "metadatas" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L578-L583
train
Get the metadatas file name
[ 30522, 5123, 3853, 1035, 27425, 22747, 9463, 1006, 1002, 8909, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 1035, 4130, 1006, 1002, 8909, 1007, 1025, 1002, 5371, 18442, 1027, 1002, 2023, 1011, 1028, 1035, 8909, 3406, 8873, 20844, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Redis/Connections/PhpRedisConnection.php
PhpRedisConnection.zadd
public function zadd($key, ...$dictionary) { if (is_array(end($dictionary))) { foreach (array_pop($dictionary) as $member => $score) { $dictionary[] = $score; $dictionary[] = $member; } } $key = $this->applyPrefix($key); return $this->executeRaw(array_merge(['zadd', $key], $dictionary)); }
php
public function zadd($key, ...$dictionary) { if (is_array(end($dictionary))) { foreach (array_pop($dictionary) as $member => $score) { $dictionary[] = $score; $dictionary[] = $member; } } $key = $this->applyPrefix($key); return $this->executeRaw(array_merge(['zadd', $key], $dictionary)); }
[ "public", "function", "zadd", "(", "$", "key", ",", "...", "$", "dictionary", ")", "{", "if", "(", "is_array", "(", "end", "(", "$", "dictionary", ")", ")", ")", "{", "foreach", "(", "array_pop", "(", "$", "dictionary", ")", "as", "$", "member", "=...
Add one or more members to a sorted set or update its score if it already exists. @param string $key @param dynamic $dictionary @return int
[ "Add", "one", "or", "more", "members", "to", "a", "sorted", "set", "or", "update", "its", "score", "if", "it", "already", "exists", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L204-L216
train
Add key + dictionary
[ 30522, 2270, 3853, 23564, 14141, 1006, 1002, 3145, 1010, 1012, 1012, 1012, 1002, 9206, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 2203, 1006, 1002, 9206, 1007, 1007, 1007, 1063, 18921, 6776, 1006, 9140, 1035, 3769, 1006, 1002, 9206, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/thrift
lib/php/lib/Transport/TBufferedTransport.php
TBufferedTransport.write
public function write($buf) { $this->wBuf_ .= $buf; if (TStringFuncFactory::create()->strlen($this->wBuf_) >= $this->wBufSize_) { $out = $this->wBuf_; // Note that we clear the internal wBuf_ prior to the underlying write // to ensure we're in a sane state (i.e. internal buffer cleaned) // if the underlying write throws up an exception $this->wBuf_ = ''; $this->transport_->write($out); } }
php
public function write($buf) { $this->wBuf_ .= $buf; if (TStringFuncFactory::create()->strlen($this->wBuf_) >= $this->wBufSize_) { $out = $this->wBuf_; // Note that we clear the internal wBuf_ prior to the underlying write // to ensure we're in a sane state (i.e. internal buffer cleaned) // if the underlying write throws up an exception $this->wBuf_ = ''; $this->transport_->write($out); } }
[ "public", "function", "write", "(", "$", "buf", ")", "{", "$", "this", "->", "wBuf_", ".=", "$", "buf", ";", "if", "(", "TStringFuncFactory", "::", "create", "(", ")", "->", "strlen", "(", "$", "this", "->", "wBuf_", ")", ">=", "$", "this", "->", ...
@inheritdoc @param string $buf @throws TTransportException
[ "@inheritdoc" ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TBufferedTransport.php#L174-L186
train
Write the buffer to the transport
[ 30522, 2270, 3853, 4339, 1006, 1002, 20934, 2546, 1007, 1063, 1002, 2023, 1011, 1028, 25610, 16093, 1035, 1012, 1027, 1002, 20934, 2546, 1025, 2065, 1006, 24529, 18886, 3070, 11263, 12273, 21450, 1024, 1024, 3443, 1006, 1007, 1011, 1028, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
domnikl/DesignPatternsPHP
Behavioral/TemplateMethod/Journey.php
Journey.takeATrip
final public function takeATrip() { $this->thingsToDo[] = $this->buyAFlight(); $this->thingsToDo[] = $this->takePlane(); $this->thingsToDo[] = $this->enjoyVacation(); $buyGift = $this->buyGift(); if ($buyGift !== null) { $this->thingsToDo[] = $buyGift; } $this->thingsToDo[] = $this->takePlane(); }
php
final public function takeATrip() { $this->thingsToDo[] = $this->buyAFlight(); $this->thingsToDo[] = $this->takePlane(); $this->thingsToDo[] = $this->enjoyVacation(); $buyGift = $this->buyGift(); if ($buyGift !== null) { $this->thingsToDo[] = $buyGift; } $this->thingsToDo[] = $this->takePlane(); }
[ "final", "public", "function", "takeATrip", "(", ")", "{", "$", "this", "->", "thingsToDo", "[", "]", "=", "$", "this", "->", "buyAFlight", "(", ")", ";", "$", "this", "->", "thingsToDo", "[", "]", "=", "$", "this", "->", "takePlane", "(", ")", ";"...
This is the public service provided by this class and its subclasses. Notice it is final to "freeze" the global behavior of algorithm. If you want to override this contract, make an interface with only takeATrip() and subclass it.
[ "This", "is", "the", "public", "service", "provided", "by", "this", "class", "and", "its", "subclasses", ".", "Notice", "it", "is", "final", "to", "freeze", "the", "global", "behavior", "of", "algorithm", ".", "If", "you", "want", "to", "override", "this",...
5f5649b57ea94471e20b54eb439c6368dea07886
https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/Behavioral/TemplateMethod/Journey.php#L18-L30
train
Take AFlight Take Plane
[ 30522, 2345, 2270, 3853, 2202, 4017, 29443, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 2477, 3406, 3527, 1031, 1033, 1027, 1002, 2023, 1011, 1028, 4965, 10354, 7138, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 2477, 3406, 3527, 1031, 1033, 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...
octobercms/october
modules/backend/helpers/Backend.php
Backend.redirect
public function redirect($path, $status = 302, $headers = [], $secure = null) { return Redirect::to($this->uri() . '/' . $path, $status, $headers, $secure); }
php
public function redirect($path, $status = 302, $headers = [], $secure = null) { return Redirect::to($this->uri() . '/' . $path, $status, $headers, $secure); }
[ "public", "function", "redirect", "(", "$", "path", ",", "$", "status", "=", "302", ",", "$", "headers", "=", "[", "]", ",", "$", "secure", "=", "null", ")", "{", "return", "Redirect", "::", "to", "(", "$", "this", "->", "uri", "(", ")", ".", "...
Create a new redirect response to a given backend path.
[ "Create", "a", "new", "redirect", "response", "to", "a", "given", "backend", "path", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/helpers/Backend.php#L65-L68
train
Redirects to the current page
[ 30522, 2270, 3853, 2417, 7442, 6593, 1006, 1002, 4130, 1010, 1002, 3570, 1027, 22060, 1010, 1002, 20346, 2015, 1027, 1031, 1033, 1010, 1002, 5851, 1027, 19701, 1007, 1063, 2709, 2417, 7442, 6593, 1024, 1024, 2000, 1006, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Style.php
Style.set_list_style_image
function set_list_style_image($val) { //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["list_style_image"] = null; $this->_props["list_style_image"] = $this->_image($val); }
php
function set_list_style_image($val) { //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["list_style_image"] = null; $this->_props["list_style_image"] = $this->_image($val); }
[ "function", "set_list_style_image", "(", "$", "val", ")", "{", "//see __set and __get, on all assignments clear cache, not needed on direct set through __set", "$", "this", "->", "_prop_cache", "[", "\"list_style_image\"", "]", "=", "null", ";", "$", "this", "->", "_props",...
Sets the list style image @link http://www.w3.org/TR/CSS21/generate.html#propdef-list-style-image @param $val
[ "Sets", "the", "list", "style", "image" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L2503-L2508
train
set list style image
[ 30522, 3853, 2275, 1035, 2862, 1035, 2806, 1035, 3746, 1006, 1002, 11748, 1007, 1063, 1013, 1013, 2156, 1035, 1035, 2275, 1998, 1035, 1035, 2131, 1010, 2006, 2035, 14799, 3154, 17053, 1010, 2025, 2734, 2006, 3622, 2275, 2083, 1035, 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/UsersManager/UsersManager.php
UsersManager.recordAdminUsersInCache
public function recordAdminUsersInCache(&$attributes, $idSite) { $model = new Model(); $adminLogins = $model->getUsersLoginWithSiteAccess($idSite, Admin::ID); $writeLogins = $model->getUsersLoginWithSiteAccess($idSite, Write::ID); $attributes['tracking_token_auth'] = array(); if (!empty($adminLogins)) { $users = $model->getUsers($adminLogins); foreach ($users as $user) { $attributes['tracking_token_auth'][] = self::hashTrackingToken($user['token_auth'], $idSite); } } if (!empty($writeLogins)) { $users = $model->getUsers($writeLogins); foreach ($users as $user) { $attributes['tracking_token_auth'][] = self::hashTrackingToken($user['token_auth'], $idSite); } } }
php
public function recordAdminUsersInCache(&$attributes, $idSite) { $model = new Model(); $adminLogins = $model->getUsersLoginWithSiteAccess($idSite, Admin::ID); $writeLogins = $model->getUsersLoginWithSiteAccess($idSite, Write::ID); $attributes['tracking_token_auth'] = array(); if (!empty($adminLogins)) { $users = $model->getUsers($adminLogins); foreach ($users as $user) { $attributes['tracking_token_auth'][] = self::hashTrackingToken($user['token_auth'], $idSite); } } if (!empty($writeLogins)) { $users = $model->getUsers($writeLogins); foreach ($users as $user) { $attributes['tracking_token_auth'][] = self::hashTrackingToken($user['token_auth'], $idSite); } } }
[ "public", "function", "recordAdminUsersInCache", "(", "&", "$", "attributes", ",", "$", "idSite", ")", "{", "$", "model", "=", "new", "Model", "(", ")", ";", "$", "adminLogins", "=", "$", "model", "->", "getUsersLoginWithSiteAccess", "(", "$", "idSite", ",...
Hooks when a website tracker cache is flushed (website/user updated, cache deleted, or empty cache) Will record in the tracker config file the list of Admin token_auth for this website. This will be used when the Tracking API is used with setIp(), setForceDateTime(), setVisitorId(), etc. @param $attributes @param $idSite @return void
[ "Hooks", "when", "a", "website", "tracker", "cache", "is", "flushed", "(", "website", "/", "user", "updated", "cache", "deleted", "or", "empty", "cache", ")", "Will", "record", "in", "the", "tracker", "config", "file", "the", "list", "of", "Admin", "token_...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/UsersManager.php#L74-L95
train
Records Admin Users in Cache
[ 30522, 2270, 3853, 2501, 4215, 10020, 20330, 11493, 3540, 5403, 1006, 1004, 1002, 12332, 1010, 1002, 8909, 28032, 2063, 1007, 1063, 1002, 2944, 1027, 2047, 2944, 1006, 1007, 1025, 1002, 4748, 10020, 21197, 7076, 1027, 1002, 2944, 1011, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/PhpEngine.php
PhpEngine.setCharset
public function setCharset($charset) { if ('UTF8' === $charset = strtoupper($charset)) { $charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8" } $this->charset = $charset; foreach ($this->helpers as $helper) { $helper->setCharset($this->charset); } }
php
public function setCharset($charset) { if ('UTF8' === $charset = strtoupper($charset)) { $charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8" } $this->charset = $charset; foreach ($this->helpers as $helper) { $helper->setCharset($this->charset); } }
[ "public", "function", "setCharset", "(", "$", "charset", ")", "{", "if", "(", "'UTF8'", "===", "$", "charset", "=", "strtoupper", "(", "$", "charset", ")", ")", "{", "$", "charset", "=", "'UTF-8'", ";", "// iconv on Windows requires \"UTF-8\" instead of \"UTF8\"...
Sets the charset to use. @param string $charset The charset
[ "Sets", "the", "charset", "to", "use", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L330-L340
train
Set charset of all languages
[ 30522, 2270, 3853, 2275, 7507, 22573, 2102, 1006, 1002, 25869, 13462, 1007, 1063, 2065, 1006, 1005, 21183, 2546, 2620, 1005, 1027, 1027, 1027, 1002, 25869, 13462, 1027, 2358, 5339, 7140, 18620, 1006, 1002, 25869, 13462, 1007, 1007, 1063, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Encoder/ChainEncoder.php
ChainEncoder.supportsEncoding
public function supportsEncoding($format, array $context = []) { try { $this->getEncoder($format, $context); } catch (RuntimeException $e) { return false; } return true; }
php
public function supportsEncoding($format, array $context = []) { try { $this->getEncoder($format, $context); } catch (RuntimeException $e) { return false; } return true; }
[ "public", "function", "supportsEncoding", "(", "$", "format", ",", "array", "$", "context", "=", "[", "]", ")", "{", "try", "{", "$", "this", "->", "getEncoder", "(", "$", "format", ",", "$", "context", ")", ";", "}", "catch", "(", "RuntimeException", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php#L46-L55
train
Returns true if the current locale supports the given encoding
[ 30522, 2270, 3853, 6753, 2368, 3597, 4667, 1006, 1002, 4289, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 3046, 1063, 1002, 2023, 1011, 1028, 2131, 2368, 16044, 2099, 1006, 1002, 4289, 1010, 1002, 6123, 1007, 1025, 1065, 4608, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cookie/Middleware/EncryptCookies.php
EncryptCookies.decryptCookie
protected function decryptCookie($name, $cookie) { return is_array($cookie) ? $this->decryptArray($cookie) : $this->encrypter->decrypt($cookie, static::serialized($name)); }
php
protected function decryptCookie($name, $cookie) { return is_array($cookie) ? $this->decryptArray($cookie) : $this->encrypter->decrypt($cookie, static::serialized($name)); }
[ "protected", "function", "decryptCookie", "(", "$", "name", ",", "$", "cookie", ")", "{", "return", "is_array", "(", "$", "cookie", ")", "?", "$", "this", "->", "decryptArray", "(", "$", "cookie", ")", ":", "$", "this", "->", "encrypter", "->", "decryp...
Decrypt the given cookie and return the value. @param string $name @param string|array $cookie @return string|array
[ "Decrypt", "the", "given", "cookie", "and", "return", "the", "value", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L99-L104
train
Decrypt a cookie
[ 30522, 5123, 3853, 11703, 2854, 13876, 3597, 23212, 2063, 1006, 1002, 2171, 1010, 1002, 17387, 1007, 1063, 2709, 2003, 1035, 9140, 1006, 1002, 17387, 1007, 1029, 1002, 2023, 1011, 1028, 11703, 2854, 22799, 11335, 2100, 1006, 1002, 17387, 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/View/UIControl.php
UIControl.render
public function render() { if ($this->cssIdentifier === null) { throw new Exception("All UIControls must set a cssIdentifier property"); } if ($this->jsClass === null) { throw new Exception("All UIControls must set a jsClass property"); } return parent::render(); }
php
public function render() { if ($this->cssIdentifier === null) { throw new Exception("All UIControls must set a cssIdentifier property"); } if ($this->jsClass === null) { throw new Exception("All UIControls must set a jsClass property"); } return parent::render(); }
[ "public", "function", "render", "(", ")", "{", "if", "(", "$", "this", "->", "cssIdentifier", "===", "null", ")", "{", "throw", "new", "Exception", "(", "\"All UIControls must set a cssIdentifier property\"", ")", ";", "}", "if", "(", "$", "this", "->", "jsC...
Renders the control view within a containing <div> that is used by the UIControl JavaScript class. @return string
[ "Renders", "the", "control", "view", "within", "a", "containing", "<div", ">", "that", "is", "used", "by", "the", "UIControl", "JavaScript", "class", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/View/UIControl.php#L113-L124
train
Render the UIControls
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 20116, 7363, 16778, 8873, 2121, 1027, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6453, 1006, 1000, 2035, 21318, 8663, 13181, 4877, 2442, 2275, 1037, 20116, 7363...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Adapter/ChainAdapter.php
ChainAdapter.hasItem
public function hasItem($key) { foreach ($this->adapters as $adapter) { if ($adapter->hasItem($key)) { return true; } } return false; }
php
public function hasItem($key) { foreach ($this->adapters as $adapter) { if ($adapter->hasItem($key)) { return true; } } return false; }
[ "public", "function", "hasItem", "(", "$", "key", ")", "{", "foreach", "(", "$", "this", "->", "adapters", "as", "$", "adapter", ")", "{", "if", "(", "$", "adapter", "->", "hasItem", "(", "$", "key", ")", ")", "{", "return", "true", ";", "}", "}"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/ChainAdapter.php#L182-L191
train
Checks if an item exists in the tree
[ 30522, 2270, 3853, 2038, 4221, 2213, 1006, 1002, 3145, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 15581, 2545, 2004, 1002, 15581, 2121, 1007, 1063, 2065, 1006, 1002, 15581, 2121, 1011, 1028, 2038, 4221, 2213, 1006, 1002, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
ProxyAdapter.getItems
public function getItems(array $keys = []) { if ($this->namespaceLen) { foreach ($keys as $i => $key) { $keys[$i] = $this->getId($key); } } return $this->generateItems($this->pool->getItems($keys)); }
php
public function getItems(array $keys = []) { if ($this->namespaceLen) { foreach ($keys as $i => $key) { $keys[$i] = $this->getId($key); } } return $this->generateItems($this->pool->getItems($keys)); }
[ "public", "function", "getItems", "(", "array", "$", "keys", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "namespaceLen", ")", "{", "foreach", "(", "$", "keys", "as", "$", "i", "=>", "$", "key", ")", "{", "$", "keys", "[", "$", "i", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php#L129-L138
train
Get items from pool
[ 30522, 2270, 3853, 2131, 4221, 5244, 1006, 9140, 1002, 6309, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3415, 15327, 7770, 1007, 1063, 18921, 6776, 1006, 1002, 6309, 2004, 1002, 1045, 1027, 1028, 1002, 3145, 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...
symfony/symfony
src/Symfony/Component/OptionsResolver/OptionsResolver.php
OptionsResolver.offsetGet
public function offsetGet($option/*, bool $triggerDeprecation = true*/) { if (!$this->locked) { throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); } $triggerDeprecation = 1 === \func_num_args() || \func_get_arg(1); // Shortcut for resolved options if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) { if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option])) { @trigger_error(strtr($this->deprecated[$option], ['%name%' => $option]), E_USER_DEPRECATED); } return $this->resolved[$option]; } // Check whether the option is set at all if (!isset($this->defaults[$option]) && !\array_key_exists($option, $this->defaults)) { if (!isset($this->defined[$option])) { throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $option)); } $value = $this->defaults[$option]; // Resolve the option if it is a nested definition if (isset($this->nested[$option])) { // If the closure is already being called, we have a cyclic dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } if (!\is_array($value)) { throw new InvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $option, $this->formatValue($value), $this->formatTypeOf($value))); } // The following section must be protected from cyclic calls. $this->calling[$option] = true; try { $resolver = new self(); foreach ($this->nested[$option] as $closure) { $closure($resolver, $this); } $value = $resolver->resolve($value); } finally { unset($this->calling[$option]); } } // Resolve the option if the default value is lazily evaluated if (isset($this->lazy[$option])) { // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } // The following section must be protected from cyclic // calls. Set $calling for the current $option to detect a cyclic // dependency // BEGIN $this->calling[$option] = true; try { foreach ($this->lazy[$option] as $closure) { $value = $closure($this, $value); } } finally { unset($this->calling[$option]); } // END } // Validate the type of the resolved option if (isset($this->allowedTypes[$option])) { $valid = false; $invalidTypes = []; foreach ($this->allowedTypes[$option] as $type) { $type = self::$typeAliases[$type] ?? $type; if ($valid = $this->verifyTypes($type, $value, $invalidTypes)) { break; } } if (!$valid) { $keys = array_keys($invalidTypes); if (1 === \count($keys) && '[]' === substr($keys[0], -2)) { throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), $keys[0])); } throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), implode('|', array_keys($invalidTypes)))); } } // Validate the value of the resolved option if (isset($this->allowedValues[$option])) { $success = false; $printableAllowedValues = []; foreach ($this->allowedValues[$option] as $allowedValue) { if ($allowedValue instanceof \Closure) { if ($allowedValue($value)) { $success = true; break; } // Don't include closures in the exception message continue; } if ($value === $allowedValue) { $success = true; break; } $printableAllowedValues[] = $allowedValue; } if (!$success) { $message = sprintf( 'The option "%s" with value %s is invalid.', $option, $this->formatValue($value) ); if (\count($printableAllowedValues) > 0) { $message .= sprintf( ' Accepted values are: %s.', $this->formatValues($printableAllowedValues) ); } throw new InvalidOptionsException($message); } } // Check whether the option is deprecated // and it is provided by the user or is being called from a lazy evaluation if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || ($this->calling && \is_string($this->deprecated[$option])))) { $deprecationMessage = $this->deprecated[$option]; if ($deprecationMessage instanceof \Closure) { // If the closure is already being called, we have a cyclic dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } $this->calling[$option] = true; try { if (!\is_string($deprecationMessage = $deprecationMessage($this, $value))) { throw new InvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', \gettype($deprecationMessage))); } } finally { unset($this->calling[$option]); } } if ('' !== $deprecationMessage) { @trigger_error(strtr($deprecationMessage, ['%name%' => $option]), E_USER_DEPRECATED); } } // Normalize the validated option if (isset($this->normalizers[$option])) { // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } // The following section must be protected from cyclic // calls. Set $calling for the current $option to detect a cyclic // dependency // BEGIN $this->calling[$option] = true; try { foreach ($this->normalizers[$option] as $normalizer) { $value = $normalizer($this, $value); } } finally { unset($this->calling[$option]); } // END } // Mark as resolved $this->resolved[$option] = $value; return $value; }
php
public function offsetGet($option/*, bool $triggerDeprecation = true*/) { if (!$this->locked) { throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); } $triggerDeprecation = 1 === \func_num_args() || \func_get_arg(1); // Shortcut for resolved options if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) { if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option])) { @trigger_error(strtr($this->deprecated[$option], ['%name%' => $option]), E_USER_DEPRECATED); } return $this->resolved[$option]; } // Check whether the option is set at all if (!isset($this->defaults[$option]) && !\array_key_exists($option, $this->defaults)) { if (!isset($this->defined[$option])) { throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $option)); } $value = $this->defaults[$option]; // Resolve the option if it is a nested definition if (isset($this->nested[$option])) { // If the closure is already being called, we have a cyclic dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } if (!\is_array($value)) { throw new InvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $option, $this->formatValue($value), $this->formatTypeOf($value))); } // The following section must be protected from cyclic calls. $this->calling[$option] = true; try { $resolver = new self(); foreach ($this->nested[$option] as $closure) { $closure($resolver, $this); } $value = $resolver->resolve($value); } finally { unset($this->calling[$option]); } } // Resolve the option if the default value is lazily evaluated if (isset($this->lazy[$option])) { // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } // The following section must be protected from cyclic // calls. Set $calling for the current $option to detect a cyclic // dependency // BEGIN $this->calling[$option] = true; try { foreach ($this->lazy[$option] as $closure) { $value = $closure($this, $value); } } finally { unset($this->calling[$option]); } // END } // Validate the type of the resolved option if (isset($this->allowedTypes[$option])) { $valid = false; $invalidTypes = []; foreach ($this->allowedTypes[$option] as $type) { $type = self::$typeAliases[$type] ?? $type; if ($valid = $this->verifyTypes($type, $value, $invalidTypes)) { break; } } if (!$valid) { $keys = array_keys($invalidTypes); if (1 === \count($keys) && '[]' === substr($keys[0], -2)) { throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), $keys[0])); } throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), implode('|', array_keys($invalidTypes)))); } } // Validate the value of the resolved option if (isset($this->allowedValues[$option])) { $success = false; $printableAllowedValues = []; foreach ($this->allowedValues[$option] as $allowedValue) { if ($allowedValue instanceof \Closure) { if ($allowedValue($value)) { $success = true; break; } // Don't include closures in the exception message continue; } if ($value === $allowedValue) { $success = true; break; } $printableAllowedValues[] = $allowedValue; } if (!$success) { $message = sprintf( 'The option "%s" with value %s is invalid.', $option, $this->formatValue($value) ); if (\count($printableAllowedValues) > 0) { $message .= sprintf( ' Accepted values are: %s.', $this->formatValues($printableAllowedValues) ); } throw new InvalidOptionsException($message); } } // Check whether the option is deprecated // and it is provided by the user or is being called from a lazy evaluation if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || ($this->calling && \is_string($this->deprecated[$option])))) { $deprecationMessage = $this->deprecated[$option]; if ($deprecationMessage instanceof \Closure) { // If the closure is already being called, we have a cyclic dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } $this->calling[$option] = true; try { if (!\is_string($deprecationMessage = $deprecationMessage($this, $value))) { throw new InvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', \gettype($deprecationMessage))); } } finally { unset($this->calling[$option]); } } if ('' !== $deprecationMessage) { @trigger_error(strtr($deprecationMessage, ['%name%' => $option]), E_USER_DEPRECATED); } } // Normalize the validated option if (isset($this->normalizers[$option])) { // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } // The following section must be protected from cyclic // calls. Set $calling for the current $option to detect a cyclic // dependency // BEGIN $this->calling[$option] = true; try { foreach ($this->normalizers[$option] as $normalizer) { $value = $normalizer($this, $value); } } finally { unset($this->calling[$option]); } // END } // Mark as resolved $this->resolved[$option] = $value; return $value; }
[ "public", "function", "offsetGet", "(", "$", "option", "/*, bool $triggerDeprecation = true*/", ")", "{", "if", "(", "!", "$", "this", "->", "locked", ")", "{", "throw", "new", "AccessException", "(", "'Array access is only supported within closures of lazy options and no...
Returns the resolved value of an option. @param string $option The option name @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default) @return mixed The option value @throws AccessException If accessing this method outside of {@link resolve()} @throws NoSuchOptionException If the option is not set @throws InvalidOptionsException If the option doesn't fulfill the specified validation rules @throws OptionDefinitionException If there is a cyclic dependency between lazy options and/or normalizers
[ "Returns", "the", "resolved", "value", "of", "an", "option", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L843-L1037
train
Get an option value
[ 30522, 2270, 3853, 16396, 18150, 1006, 1002, 5724, 1013, 1008, 1010, 22017, 2140, 1002, 9495, 3207, 28139, 10719, 1027, 2995, 1008, 1013, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 3229, 10288, 24422,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.getRowsMetadata
public function getRowsMetadata($name) { $metadataValues = array(); foreach ($this->getRows() as $row) { $metadataValues[] = $row->getMetadata($name); } return $metadataValues; }
php
public function getRowsMetadata($name) { $metadataValues = array(); foreach ($this->getRows() as $row) { $metadataValues[] = $row->getMetadata($name); } return $metadataValues; }
[ "public", "function", "getRowsMetadata", "(", "$", "name", ")", "{", "$", "metadataValues", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getRows", "(", ")", "as", "$", "row", ")", "{", "$", "metadataValues", "[", "]", "=", "$", ...
Returns an array containing the requested metadata value of each row. @param string $name The metadata column to return. @return array
[ "Returns", "an", "array", "containing", "the", "requested", "metadata", "value", "of", "each", "row", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L985-L992
train
Get all metadata values of all rows
[ 30522, 2270, 3853, 2131, 10524, 6491, 12928, 2850, 2696, 1006, 1002, 2171, 1007, 1063, 1002, 27425, 10175, 15808, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 10524, 2015, 1006, 1007, 2004, 1002, 5216, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Output/ConsoleOutput.php
ConsoleOutput.setFormatter
public function setFormatter(OutputFormatterInterface $formatter) { parent::setFormatter($formatter); $this->stderr->setFormatter($formatter); }
php
public function setFormatter(OutputFormatterInterface $formatter) { parent::setFormatter($formatter); $this->stderr->setFormatter($formatter); }
[ "public", "function", "setFormatter", "(", "OutputFormatterInterface", "$", "formatter", ")", "{", "parent", "::", "setFormatter", "(", "$", "formatter", ")", ";", "$", "this", "->", "stderr", "->", "setFormatter", "(", "$", "formatter", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Output/ConsoleOutput.php#L72-L76
train
Set Formatter for all child pages
[ 30522, 2270, 3853, 2275, 14192, 20097, 1006, 6434, 14192, 20097, 18447, 30524, 1028, 2275, 14192, 20097, 1006, 1002, 4289, 3334, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Model.php
Model.resolvePerPage
protected function resolvePerPage($paginate) { if ($perPage = request($this->perPageName)) { if (is_array($paginate)) { $paginate['arguments'][0] = (int) $perPage; return $paginate['arguments']; } $this->perPage = (int) $perPage; } if (isset($paginate['arguments'][0])) { return $paginate['arguments']; } if ($name = $this->grid->getName()) { return [$this->perPage, ['*'], "{$name}_page"]; } return [$this->perPage]; }
php
protected function resolvePerPage($paginate) { if ($perPage = request($this->perPageName)) { if (is_array($paginate)) { $paginate['arguments'][0] = (int) $perPage; return $paginate['arguments']; } $this->perPage = (int) $perPage; } if (isset($paginate['arguments'][0])) { return $paginate['arguments']; } if ($name = $this->grid->getName()) { return [$this->perPage, ['*'], "{$name}_page"]; } return [$this->perPage]; }
[ "protected", "function", "resolvePerPage", "(", "$", "paginate", ")", "{", "if", "(", "$", "perPage", "=", "request", "(", "$", "this", "->", "perPageName", ")", ")", "{", "if", "(", "is_array", "(", "$", "paginate", ")", ")", "{", "$", "paginate", "...
Resolve perPage for pagination. @param array|null $paginate @return array
[ "Resolve", "perPage", "for", "pagination", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L469-L490
train
Resolve perPage name
[ 30522, 5123, 3853, 10663, 4842, 13704, 1006, 1002, 6643, 20876, 2618, 1007, 1063, 2065, 1006, 1002, 2566, 13704, 1027, 5227, 1006, 1002, 2023, 1011, 1028, 2566, 13704, 18442, 1007, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 6643,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Utils.php
Utils.sortArrayByArray
public static function sortArrayByArray(array $array, array $orderArray) { $ordered = array(); foreach ($orderArray as $key) { if (array_key_exists($key, $array)) { $ordered[$key] = $array[$key]; unset($array[$key]); } } return $ordered + $array; }
php
public static function sortArrayByArray(array $array, array $orderArray) { $ordered = array(); foreach ($orderArray as $key) { if (array_key_exists($key, $array)) { $ordered[$key] = $array[$key]; unset($array[$key]); } } return $ordered + $array; }
[ "public", "static", "function", "sortArrayByArray", "(", "array", "$", "array", ",", "array", "$", "orderArray", ")", "{", "$", "ordered", "=", "array", "(", ")", ";", "foreach", "(", "$", "orderArray", "as", "$", "key", ")", "{", "if", "(", "array_key...
Sort a multidimensional array by another array of ordered keys @param array $array @param array $orderArray @return array
[ "Sort", "a", "multidimensional", "array", "by", "another", "array", "of", "ordered", "keys" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1251-L1261
train
Sort array by array
[ 30522, 2270, 10763, 3853, 4066, 2906, 9447, 3762, 2906, 9447, 1006, 9140, 1002, 9140, 1010, 9140, 1002, 2344, 2906, 9447, 1007, 1063, 1002, 3641, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2344, 2906, 9447, 2004, 1002, 3145, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Extension.php
Extension.import
public static function import() { $extension = static::getInstance(); if ($menu = $extension->menu()) { if ($extension->validateMenu($menu)) { extract($menu); static::createMenu($title, $path, $icon); } } if ($permission = $extension->permission()) { if ($extension->validatePermission($permission)) { extract($permission); static::createPermission($name, $slug, $path); } } }
php
public static function import() { $extension = static::getInstance(); if ($menu = $extension->menu()) { if ($extension->validateMenu($menu)) { extract($menu); static::createMenu($title, $path, $icon); } } if ($permission = $extension->permission()) { if ($extension->validatePermission($permission)) { extract($permission); static::createPermission($name, $slug, $path); } } }
[ "public", "static", "function", "import", "(", ")", "{", "$", "extension", "=", "static", "::", "getInstance", "(", ")", ";", "if", "(", "$", "menu", "=", "$", "extension", "->", "menu", "(", ")", ")", "{", "if", "(", "$", "extension", "->", "valid...
Import menu item and permission to laravel-admin.
[ "Import", "menu", "item", "and", "permission", "to", "laravel", "-", "admin", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Extension.php#L230-L247
train
Imports menu and permission
[ 30522, 2270, 10763, 3853, 12324, 1006, 1007, 1063, 1002, 5331, 1027, 10763, 1024, 1024, 2131, 7076, 26897, 1006, 1007, 1025, 2065, 1006, 1002, 12183, 1027, 1002, 5331, 1011, 1028, 12183, 1006, 1007, 1007, 1063, 2065, 1006, 1002, 5331, 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...
dompdf/dompdf
src/Css/Style.php
Style.get_transform_origin
function get_transform_origin() { $values = preg_split("/\s+/", $this->_props['transform_origin']); if (count($values) === 0) { $values = preg_split("/\s+/", self::$_defaults["transform_origin"]); } $values = array_map(function($value) { if (in_array($value, array("top", "left"))) { return 0; } else if (in_array($value, array("bottom", "right"))) { return "100%"; } else { return $value; } }, $values); if (!isset($values[1])) { $values[1] = $values[0]; } return $values; }
php
function get_transform_origin() { $values = preg_split("/\s+/", $this->_props['transform_origin']); if (count($values) === 0) { $values = preg_split("/\s+/", self::$_defaults["transform_origin"]); } $values = array_map(function($value) { if (in_array($value, array("top", "left"))) { return 0; } else if (in_array($value, array("bottom", "right"))) { return "100%"; } else { return $value; } }, $values); if (!isset($values[1])) { $values[1] = $values[0]; } return $values; }
[ "function", "get_transform_origin", "(", ")", "{", "$", "values", "=", "preg_split", "(", "\"/\\s+/\"", ",", "$", "this", "->", "_props", "[", "'transform_origin'", "]", ")", ";", "if", "(", "count", "(", "$", "values", ")", "===", "0", ")", "{", "$", ...
Gets the CSS3 transform-origin property @link http://www.w3.org/TR/css3-2d-transforms/#transform-origin @return mixed[]
[ "Gets", "the", "CSS3", "transform", "-", "origin", "property" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L2778-L2800
train
Get the transform origin
[ 30522, 3853, 2131, 1035, 10938, 1035, 4761, 1006, 1007, 1063, 1002, 5300, 1027, 3653, 2290, 1035, 3975, 1006, 1000, 1013, 1032, 1055, 1009, 1013, 1000, 1010, 1002, 2023, 1011, 1028, 1035, 24387, 1031, 1005, 10938, 1035, 4761, 1005, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/ServiceProvider.php
ServiceProvider.registerBackendNavigation
protected function registerBackendNavigation() { BackendMenu::registerCallback(function ($manager) { $manager->registerMenuItems('October.Backend', [ 'dashboard' => [ 'label' => 'backend::lang.dashboard.menu_label', 'icon' => 'icon-dashboard', 'iconSvg' => 'modules/backend/assets/images/dashboard-icon.svg', 'url' => Backend::url('backend'), 'permissions' => ['backend.access_dashboard'], 'order' => 10 ], 'media' => [ 'label' => 'backend::lang.media.menu_label', 'icon' => 'icon-folder', 'iconSvg' => 'modules/backend/assets/images/media-icon.svg', 'url' => Backend::url('backend/media'), 'permissions' => ['media.*'], 'order' => 200 ] ]); }); }
php
protected function registerBackendNavigation() { BackendMenu::registerCallback(function ($manager) { $manager->registerMenuItems('October.Backend', [ 'dashboard' => [ 'label' => 'backend::lang.dashboard.menu_label', 'icon' => 'icon-dashboard', 'iconSvg' => 'modules/backend/assets/images/dashboard-icon.svg', 'url' => Backend::url('backend'), 'permissions' => ['backend.access_dashboard'], 'order' => 10 ], 'media' => [ 'label' => 'backend::lang.media.menu_label', 'icon' => 'icon-folder', 'iconSvg' => 'modules/backend/assets/images/media-icon.svg', 'url' => Backend::url('backend/media'), 'permissions' => ['media.*'], 'order' => 200 ] ]); }); }
[ "protected", "function", "registerBackendNavigation", "(", ")", "{", "BackendMenu", "::", "registerCallback", "(", "function", "(", "$", "manager", ")", "{", "$", "manager", "->", "registerMenuItems", "(", "'October.Backend'", ",", "[", "'dashboard'", "=>", "[", ...
/* Register navigation
[ "/", "*", "Register", "navigation" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/ServiceProvider.php#L92-L114
train
Registers the backend navigation
[ 30522, 5123, 3853, 4236, 5963, 10497, 2532, 5737, 12540, 1006, 1007, 1063, 2067, 10497, 3549, 2226, 1024, 1024, 4236, 9289, 20850, 8684, 1006, 3853, 1006, 1002, 3208, 1007, 1063, 1002, 3208, 1011, 1028, 4236, 3549, 14663, 6633, 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...
guzzle/guzzle
build/Burgomaster.php
Burgomaster.createPhar
public function createPhar( $dest, $stub = null, $autoloaderFilename = 'autoloader.php' ) { $this->startSection('phar'); $this->debug("Creating phar file at $dest"); $this->createDirIfNeeded(dirname($dest)); $phar = new \Phar($dest, 0, basename($dest)); $phar->buildFromDirectory($this->stageDir); if ($stub !== false) { if (!$stub) { $stub = $this->createStub($dest, $autoloaderFilename); } $phar->setStub($stub); } $this->debug("Created phar at $dest"); $this->endSection(); }
php
public function createPhar( $dest, $stub = null, $autoloaderFilename = 'autoloader.php' ) { $this->startSection('phar'); $this->debug("Creating phar file at $dest"); $this->createDirIfNeeded(dirname($dest)); $phar = new \Phar($dest, 0, basename($dest)); $phar->buildFromDirectory($this->stageDir); if ($stub !== false) { if (!$stub) { $stub = $this->createStub($dest, $autoloaderFilename); } $phar->setStub($stub); } $this->debug("Created phar at $dest"); $this->endSection(); }
[ "public", "function", "createPhar", "(", "$", "dest", ",", "$", "stub", "=", "null", ",", "$", "autoloaderFilename", "=", "'autoloader.php'", ")", "{", "$", "this", "->", "startSection", "(", "'phar'", ")", ";", "$", "this", "->", "debug", "(", "\"Creati...
Creates a phar that automatically registers an autoloader. Call this only after your staging directory is built. @param string $dest Where to save the file. The basename of the file is also used as the alias name in the phar (e.g., /path/to/guzzle.phar => guzzle.phar). @param string|bool|null $stub The path to the phar stub file. Pass or leave null to automatically have one created for you. Pass false to no use a stub in the generated phar. @param string $autoloaderFilename Name of the autolaoder filename.
[ "Creates", "a", "phar", "that", "automatically", "registers", "an", "autoloader", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/build/Burgomaster.php#L338-L358
train
Creates a phar file from the stage directory
[ 30522, 2270, 3853, 3443, 21890, 2099, 1006, 1002, 4078, 2102, 1010, 1002, 24646, 2497, 1027, 19701, 1010, 1002, 8285, 11066, 2121, 8873, 20844, 4168, 1027, 1005, 8285, 11066, 2121, 1012, 25718, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 4627...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Storage/Mbox.php
Zend_Mail_Storage_Mbox.getSize
public function getSize($id = 0) { if ($id) { $pos = $this->_positions[$id - 1]; return $pos['end'] - $pos['start']; } $result = array(); foreach ($this->_positions as $num => $pos) { $result[$num + 1] = $pos['end'] - $pos['start']; } return $result; }
php
public function getSize($id = 0) { if ($id) { $pos = $this->_positions[$id - 1]; return $pos['end'] - $pos['start']; } $result = array(); foreach ($this->_positions as $num => $pos) { $result[$num + 1] = $pos['end'] - $pos['start']; } return $result; }
[ "public", "function", "getSize", "(", "$", "id", "=", "0", ")", "{", "if", "(", "$", "id", ")", "{", "$", "pos", "=", "$", "this", "->", "_positions", "[", "$", "id", "-", "1", "]", ";", "return", "$", "pos", "[", "'end'", "]", "-", "$", "p...
Get a list of messages with number and size @param int|null $id number of message or null for all messages @return int|array size of given message of list with all messages as array(num => size)
[ "Get", "a", "list", "of", "messages", "with", "number", "and", "size" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Mbox.php#L98-L111
train
Get Size of Position
[ 30522, 2270, 3853, 4152, 4697, 1006, 1002, 8909, 1027, 1014, 1007, 1063, 2065, 1006, 1002, 8909, 1007, 1063, 1002, 13433, 2015, 1027, 1002, 2023, 1011, 1028, 1035, 4460, 1031, 1002, 8909, 1011, 1015, 1033, 1025, 2709, 1002, 13433, 2015, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('twig'); $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() ->scalarNode('exception_controller')->defaultValue('twig.controller.exception::showAction')->end() ->end() ; $this->addFormThemesSection($rootNode); $this->addGlobalsSection($rootNode); $this->addTwigOptions($rootNode); $this->addTwigFormatOptions($rootNode); return $treeBuilder; }
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('twig'); $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() ->scalarNode('exception_controller')->defaultValue('twig.controller.exception::showAction')->end() ->end() ; $this->addFormThemesSection($rootNode); $this->addGlobalsSection($rootNode); $this->addTwigOptions($rootNode); $this->addTwigFormatOptions($rootNode); return $treeBuilder; }
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'twig'", ")", ";", "$", "rootNode", "=", "$", "treeBuilder", "->", "getRootNode", "(", ")", ";", "$", "rootNode", "->", "children", "(", ")", ...
Generates the configuration tree builder. @return TreeBuilder The tree builder
[ "Generates", "the", "configuration", "tree", "builder", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php#L30-L47
train
Get the TreeBuilder for twig
[ 30522, 2270, 3853, 2131, 8663, 8873, 13512, 9910, 8569, 23891, 2099, 1006, 1007, 1063, 1002, 3392, 8569, 23891, 2099, 30524, 1011, 1028, 26743, 19139, 3207, 1006, 1005, 6453, 1035, 11486, 1005, 1007, 1011, 1028, 12398, 10175, 5657, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.init
public function init() { if ($this->initialized) { return $this; } $this->grav = Grav::instance(); $this->config = $this->grav['config']; // Enable/disable debugger based on configuration. $this->enabled = (bool)$this->config->get('system.debugger.enabled'); if ($this->enabled()) { $this->initialized = true; $plugins_config = (array)$this->config->get('plugins'); ksort($plugins_config); $debugbar = $this->debugbar; $debugbar->addCollector(new MemoryCollector()); $debugbar->addCollector(new ExceptionsCollector()); $debugbar->addCollector(new ConfigCollector((array)$this->config->get('system'), 'Config')); $debugbar->addCollector(new ConfigCollector($plugins_config, 'Plugins')); $this->addMessage('Grav v' . GRAV_VERSION); } return $this; }
php
public function init() { if ($this->initialized) { return $this; } $this->grav = Grav::instance(); $this->config = $this->grav['config']; // Enable/disable debugger based on configuration. $this->enabled = (bool)$this->config->get('system.debugger.enabled'); if ($this->enabled()) { $this->initialized = true; $plugins_config = (array)$this->config->get('plugins'); ksort($plugins_config); $debugbar = $this->debugbar; $debugbar->addCollector(new MemoryCollector()); $debugbar->addCollector(new ExceptionsCollector()); $debugbar->addCollector(new ConfigCollector((array)$this->config->get('system'), 'Config')); $debugbar->addCollector(new ConfigCollector($plugins_config, 'Plugins')); $this->addMessage('Grav v' . GRAV_VERSION); } return $this; }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "initialized", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "$", "this", "->", "config", "=", "$", ...
Initialize the debugger @return $this @throws \DebugBar\DebugBarException
[ "Initialize", "the", "debugger" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L92-L120
train
Initialize the class
[ 30522, 2270, 3853, 1999, 4183, 1006, 1007, 1063, 30524, 9530, 8873, 2290, 1027, 1002, 2023, 1011, 1028, 24665, 11431, 1031, 1005, 9530, 8873, 2290, 1005, 1033, 1025, 1013, 1013, 9585, 1013, 4487, 19150, 2139, 8569, 13327, 2241, 2006, 9563, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter/Layout/Layout.php
Layout.column
public function column($width, \Closure $closure) { if ($this->columns->isEmpty()) { $column = $this->current; $column->setWidth($width); } else { $column = new Column($width); $this->current = $column; } $this->columns->push($column); $closure($this->parent); }
php
public function column($width, \Closure $closure) { if ($this->columns->isEmpty()) { $column = $this->current; $column->setWidth($width); } else { $column = new Column($width); $this->current = $column; } $this->columns->push($column); $closure($this->parent); }
[ "public", "function", "column", "(", "$", "width", ",", "\\", "Closure", "$", "closure", ")", "{", "if", "(", "$", "this", "->", "columns", "->", "isEmpty", "(", ")", ")", "{", "$", "column", "=", "$", "this", "->", "current", ";", "$", "column", ...
Add a new column in layout. @param int $width @param \Closure $closure
[ "Add", "a", "new", "column", "in", "layout", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Layout/Layout.php#L55-L70
train
Adds a new column to the columns list
[ 30522, 2270, 3853, 5930, 1006, 1002, 9381, 1010, 1032, 8503, 1002, 8503, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 7753, 1011, 1028, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 1002, 5930, 1027, 1002, 2023, 1011, 1028, 2783, 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.getSupportedLocationInfo
public function getSupportedLocationInfo() { $result = array(); // assume country info is always available. it's an error if it's not. $result[self::CONTINENT_CODE_KEY] = true; $result[self::CONTINENT_NAME_KEY] = true; $result[self::COUNTRY_CODE_KEY] = true; $result[self::COUNTRY_NAME_KEY] = true; $result[self::REGION_CODE_KEY] = array_key_exists(self::getGeoIpServerVars(self::REGION_CODE_KEY), $_SERVER); $result[self::REGION_NAME_KEY] = array_key_exists(self::getGeoIpServerVars(self::REGION_NAME_KEY), $_SERVER); $result[self::LATITUDE_KEY] = array_key_exists(self::getGeoIpServerVars(self::LATITUDE_KEY), $_SERVER); $result[self::LONGITUDE_KEY] = array_key_exists(self::getGeoIpServerVars(self::LONGITUDE_KEY), $_SERVER); $result[self::POSTAL_CODE_KEY] = array_key_exists(self::getGeoIpServerVars(self::POSTAL_CODE_KEY), $_SERVER); $result[self::CITY_NAME_KEY] = array_key_exists(self::getGeoIpServerVars(self::CITY_NAME_KEY), $_SERVER); $result[self::ISP_KEY] = array_key_exists(self::getGeoIpServerVars(self::ISP_KEY), $_SERVER); $result[self::ORG_KEY] = array_key_exists(self::getGeoIpServerVars(self::ORG_KEY), $_SERVER); return $result; }
php
public function getSupportedLocationInfo() { $result = array(); // assume country info is always available. it's an error if it's not. $result[self::CONTINENT_CODE_KEY] = true; $result[self::CONTINENT_NAME_KEY] = true; $result[self::COUNTRY_CODE_KEY] = true; $result[self::COUNTRY_NAME_KEY] = true; $result[self::REGION_CODE_KEY] = array_key_exists(self::getGeoIpServerVars(self::REGION_CODE_KEY), $_SERVER); $result[self::REGION_NAME_KEY] = array_key_exists(self::getGeoIpServerVars(self::REGION_NAME_KEY), $_SERVER); $result[self::LATITUDE_KEY] = array_key_exists(self::getGeoIpServerVars(self::LATITUDE_KEY), $_SERVER); $result[self::LONGITUDE_KEY] = array_key_exists(self::getGeoIpServerVars(self::LONGITUDE_KEY), $_SERVER); $result[self::POSTAL_CODE_KEY] = array_key_exists(self::getGeoIpServerVars(self::POSTAL_CODE_KEY), $_SERVER); $result[self::CITY_NAME_KEY] = array_key_exists(self::getGeoIpServerVars(self::CITY_NAME_KEY), $_SERVER); $result[self::ISP_KEY] = array_key_exists(self::getGeoIpServerVars(self::ISP_KEY), $_SERVER); $result[self::ORG_KEY] = array_key_exists(self::getGeoIpServerVars(self::ORG_KEY), $_SERVER); return $result; }
[ "public", "function", "getSupportedLocationInfo", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "// assume country info is always available. it's an error if it's not.", "$", "result", "[", "self", "::", "CONTINENT_CODE_KEY", "]", "=", "true", ";", "$", ...
Returns an array describing the types of location information this provider will return. There's no way to tell exactly what database the HTTP server is using, so we just assume country and continent information is available. This can make diagnostics a bit more difficult, unfortunately. @return array
[ "Returns", "an", "array", "describing", "the", "types", "of", "location", "information", "this", "provider", "will", "return", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/LocationProvider/GeoIp2/ServerModule.php#L109-L129
train
Return all supported location info
[ 30522, 2270, 3853, 4152, 6279, 6442, 2098, 4135, 10719, 2378, 14876, 1006, 1007, 1063, 1002, 2765, 1027, 9140, 1006, 1007, 1025, 1013, 1013, 7868, 2406, 18558, 2003, 2467, 2800, 1012, 2009, 1005, 1055, 2019, 7561, 2065, 2009, 1005, 1055, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Message.php
Message.withAddedHeader
public function withAddedHeader($name, $value) { $clone = clone $this; $clone->headers->add($name, $value); if ($this instanceof Response && $this->body instanceof NonBufferedBody) { header(sprintf('%s: %s', $name, $clone->getHeaderLine($name))); } return $clone; }
php
public function withAddedHeader($name, $value) { $clone = clone $this; $clone->headers->add($name, $value); if ($this instanceof Response && $this->body instanceof NonBufferedBody) { header(sprintf('%s: %s', $name, $clone->getHeaderLine($name))); } return $clone; }
[ "public", "function", "withAddedHeader", "(", "$", "name", ",", "$", "value", ")", "{", "$", "clone", "=", "clone", "$", "this", ";", "$", "clone", "->", "headers", "->", "add", "(", "$", "name", ",", "$", "value", ")", ";", "if", "(", "$", "this...
Return an instance with the specified header appended with the given value. Existing values for the specified header will be maintained. The new value(s) will be appended to the existing list. If the header did not exist previously, it will be added. This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the new header and/or value. @param string $name Case-insensitive header field name to add. @param string|string[] $value Header value(s). @return static
[ "Return", "an", "instance", "with", "the", "specified", "header", "appended", "with", "the", "given", "value", "." ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Message.php#L228-L238
train
Add a header to the response
[ 30522, 2270, 3853, 2007, 4215, 5732, 4974, 2121, 1006, 1002, 2171, 1010, 1002, 3643, 1007, 1063, 1002, 17598, 1027, 17598, 1002, 2023, 1025, 1002, 17598, 1011, 1028, 20346, 2015, 1011, 1028, 5587, 1006, 1002, 2171, 1010, 1002, 3643, 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/Auth/Access/Gate.php
Gate.callAfterCallbacks
protected function callAfterCallbacks($user, $ability, array $arguments, $result) { foreach ($this->afterCallbacks as $after) { if (! $this->canBeCalledWithUser($user, $after)) { continue; } $afterResult = $after($user, $ability, $result, $arguments); $result = $result ?? $afterResult; } return $result; }
php
protected function callAfterCallbacks($user, $ability, array $arguments, $result) { foreach ($this->afterCallbacks as $after) { if (! $this->canBeCalledWithUser($user, $after)) { continue; } $afterResult = $after($user, $ability, $result, $arguments); $result = $result ?? $afterResult; } return $result; }
[ "protected", "function", "callAfterCallbacks", "(", "$", "user", ",", "$", "ability", ",", "array", "$", "arguments", ",", "$", "result", ")", "{", "foreach", "(", "$", "this", "->", "afterCallbacks", "as", "$", "after", ")", "{", "if", "(", "!", "$", ...
Call all of the after callbacks with check result. @param \Illuminate\Contracts\Auth\Authenticatable $user @param string $ability @param array $arguments @param bool $result @return bool|null
[ "Call", "all", "of", "the", "after", "callbacks", "with", "check", "result", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L485-L498
train
Call all after callbacks
[ 30522, 5123, 3853, 2655, 10354, 3334, 9289, 20850, 8684, 2015, 1006, 1002, 5310, 1010, 1002, 3754, 1010, 9140, 1002, 9918, 1010, 1002, 2765, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2044, 9289, 20850, 8684, 2015, 2004, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/User/FlexUser/User.php
User.def
public function def($name, $default = null, $separator = null) { $this->defNestedProperty($name, $default, $separator); return $this; }
php
public function def($name, $default = null, $separator = null) { $this->defNestedProperty($name, $default, $separator); return $this; }
[ "public", "function", "def", "(", "$", "name", ",", "$", "default", "=", "null", ",", "$", "separator", "=", "null", ")", "{", "$", "this", "->", "defNestedProperty", "(", "$", "name", ",", "$", "default", ",", "$", "separator", ")", ";", "return", ...
Set default value by using dot notation for nested arrays/objects. @example $data->def('this.is.my.nested.variable', 'default'); @param string $name Dot separated path to the requested value. @param mixed $default Default value (or null). @param string $separator Separator, defaults to '.' @return $this
[ "Set", "default", "value", "by", "using", "dot", "notation", "for", "nested", "arrays", "/", "objects", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L149-L154
train
def - Gets a nested property of the current class
[ 30522, 2270, 3853, 13366, 1006, 1002, 2171, 1010, 1002, 12398, 1027, 19701, 1010, 1002, 19802, 25879, 2953, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 13366, 5267, 3064, 21572, 4842, 3723, 1006, 1002, 2171, 1010, 1002, 12398, 1010, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/View/Concerns/ManagesComponents.php
ManagesComponents.slot
public function slot($name, $content = null) { if (func_num_args() === 2) { $this->slots[$this->currentComponent()][$name] = $content; } else { if (ob_start()) { $this->slots[$this->currentComponent()][$name] = ''; $this->slotStack[$this->currentComponent()][] = $name; } } }
php
public function slot($name, $content = null) { if (func_num_args() === 2) { $this->slots[$this->currentComponent()][$name] = $content; } else { if (ob_start()) { $this->slots[$this->currentComponent()][$name] = ''; $this->slotStack[$this->currentComponent()][] = $name; } } }
[ "public", "function", "slot", "(", "$", "name", ",", "$", "content", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "2", ")", "{", "$", "this", "->", "slots", "[", "$", "this", "->", "currentComponent", "(", ")", "]", "[", "$...
Start the slot rendering process. @param string $name @param string|null $content @return void
[ "Start", "the", "slot", "rendering", "process", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Concerns/ManagesComponents.php#L89-L100
train
This method is used to add a slot to the stack of active slots
[ 30522, 2270, 3853, 10453, 1006, 1002, 2171, 1010, 1002, 4180, 1027, 19701, 1007, 1063, 2065, 1006, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, 1027, 1027, 1027, 1016, 1007, 1063, 1002, 2023, 1011, 1028, 19832, 1031, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
NumberFormatter.round
private function round($value, $precision) { $precision = $this->getUninitializedPrecision($value, $precision); $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE); if (isset(self::$phpRoundingMap[$roundingModeAttribute])) { $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]); } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) { $roundingCoef = pow(10, $precision); $value *= $roundingCoef; $value = (float) (string) $value; switch ($roundingModeAttribute) { case self::ROUND_CEILING: $value = ceil($value); break; case self::ROUND_FLOOR: $value = floor($value); break; case self::ROUND_UP: $value = $value > 0 ? ceil($value) : floor($value); break; case self::ROUND_DOWN: $value = $value > 0 ? floor($value) : ceil($value); break; } $value /= $roundingCoef; } return $value; }
php
private function round($value, $precision) { $precision = $this->getUninitializedPrecision($value, $precision); $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE); if (isset(self::$phpRoundingMap[$roundingModeAttribute])) { $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]); } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) { $roundingCoef = pow(10, $precision); $value *= $roundingCoef; $value = (float) (string) $value; switch ($roundingModeAttribute) { case self::ROUND_CEILING: $value = ceil($value); break; case self::ROUND_FLOOR: $value = floor($value); break; case self::ROUND_UP: $value = $value > 0 ? ceil($value) : floor($value); break; case self::ROUND_DOWN: $value = $value > 0 ? floor($value) : ceil($value); break; } $value /= $roundingCoef; } return $value; }
[ "private", "function", "round", "(", "$", "value", ",", "$", "precision", ")", "{", "$", "precision", "=", "$", "this", "->", "getUninitializedPrecision", "(", "$", "value", ",", "$", "precision", ")", ";", "$", "roundingModeAttribute", "=", "$", "this", ...
Rounds a value. @param int|float $value The value to round @param int $precision The number of decimal digits to round to @return int|float The rounded value
[ "Rounds", "a", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L708-L739
train
Round value according to the rounding mode
[ 30522, 2797, 3853, 2461, 1006, 1002, 3643, 1010, 1002, 11718, 1007, 1063, 30524, 3089, 8569, 2618, 1027, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 2618, 1006, 2969, 1024, 1024, 26939, 1035, 5549, 1007, 1025, 2065, 1006, 26354, 3388, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/Support/Clockwork/Converter.php
Converter.convert
public function convert($data) { $meta = $data['__meta']; // Default output $output = [ 'id' => $meta['id'], 'method' => $meta['method'], 'uri' => $meta['uri'], 'time' => $meta['utime'], 'headers' => [], 'cookies' => [], 'emailsData' => [], 'getData' => [], 'log' => [], 'postData' => [], 'sessionData' => [], 'timelineData' => [], 'viewsData' => [], 'controller' => null, 'responseTime' => null, 'responseStatus' => null, 'responseDuration' => 0, ]; if (isset($data['clockwork'])) { $output = array_merge($output, $data['clockwork']); } if (isset($data['time'])) { $time = $data['time']; $output['time'] = $time['start']; $output['responseTime'] = $time['end']; $output['responseDuration'] = $time['duration'] * 1000; foreach($time['measures'] as $measure) { $output['timelineData'][] = [ 'data' => [], 'description' => $measure['label'], 'duration' => $measure['duration'] * 1000, 'end' => $measure['end'], 'start' => $measure['start'], 'relative_start' => $measure['start'] - $time['start'], ]; } } if (isset($data['route'])) { $route = $data['route']; $controller = null; if (isset($route['controller'])) { $controller = $route['controller']; } elseif (isset($route['uses'])) { $controller = $route['uses']; } $output['controller'] = $controller; list($method, $uri) = explode(' ', $route['uri'], 2); $output['routes'][] = [ 'action' => $controller, 'after' => isset($route['after']) ? $route['after'] : null, 'before' => isset($route['before']) ? $route['before'] : null, 'method' => $method, 'name' => isset($route['as']) ? $route['as'] : null, 'uri' => $uri, ]; } if (isset($data['messages'])) { foreach($data['messages']['messages'] as $message) { $output['log'][] = [ 'message' => $message['message'], 'time' => $message['time'], 'level' => $message['label'], ]; } } if (isset($data['queries'])) { $queries = $data['queries']; foreach($queries['statements'] as $statement){ if ($statement['type'] === 'explain') { continue; } $output['databaseQueries'][] = [ 'query' => $statement['sql'], 'bindings' => $statement['params'], 'duration' => $statement['duration'] * 1000, 'connection' => $statement['connection'] ]; } $output['databaseDuration'] = $queries['accumulated_duration'] * 1000; } if (isset($data['views'])) { foreach ($data['views']['templates'] as $view) { $output['viewsData'][] = [ 'description' => 'Rendering a view', 'duration' => 0, 'end' => 0, 'start' => 0, 'data' => [ 'name' => $view['name'], 'data' => $view['params'], ], ]; } } if (isset($data['swiftmailer_mails'])) { foreach($data['swiftmailer_mails']['mails'] as $mail) { $output['emailsData'][] = [ 'data' => [ 'to' => $mail['to'], 'subject' => $mail['subject'], 'headers' => isset($mail['headers']) ? explode("\n", $mail['headers']) : null, ], ]; } } return $output; }
php
public function convert($data) { $meta = $data['__meta']; // Default output $output = [ 'id' => $meta['id'], 'method' => $meta['method'], 'uri' => $meta['uri'], 'time' => $meta['utime'], 'headers' => [], 'cookies' => [], 'emailsData' => [], 'getData' => [], 'log' => [], 'postData' => [], 'sessionData' => [], 'timelineData' => [], 'viewsData' => [], 'controller' => null, 'responseTime' => null, 'responseStatus' => null, 'responseDuration' => 0, ]; if (isset($data['clockwork'])) { $output = array_merge($output, $data['clockwork']); } if (isset($data['time'])) { $time = $data['time']; $output['time'] = $time['start']; $output['responseTime'] = $time['end']; $output['responseDuration'] = $time['duration'] * 1000; foreach($time['measures'] as $measure) { $output['timelineData'][] = [ 'data' => [], 'description' => $measure['label'], 'duration' => $measure['duration'] * 1000, 'end' => $measure['end'], 'start' => $measure['start'], 'relative_start' => $measure['start'] - $time['start'], ]; } } if (isset($data['route'])) { $route = $data['route']; $controller = null; if (isset($route['controller'])) { $controller = $route['controller']; } elseif (isset($route['uses'])) { $controller = $route['uses']; } $output['controller'] = $controller; list($method, $uri) = explode(' ', $route['uri'], 2); $output['routes'][] = [ 'action' => $controller, 'after' => isset($route['after']) ? $route['after'] : null, 'before' => isset($route['before']) ? $route['before'] : null, 'method' => $method, 'name' => isset($route['as']) ? $route['as'] : null, 'uri' => $uri, ]; } if (isset($data['messages'])) { foreach($data['messages']['messages'] as $message) { $output['log'][] = [ 'message' => $message['message'], 'time' => $message['time'], 'level' => $message['label'], ]; } } if (isset($data['queries'])) { $queries = $data['queries']; foreach($queries['statements'] as $statement){ if ($statement['type'] === 'explain') { continue; } $output['databaseQueries'][] = [ 'query' => $statement['sql'], 'bindings' => $statement['params'], 'duration' => $statement['duration'] * 1000, 'connection' => $statement['connection'] ]; } $output['databaseDuration'] = $queries['accumulated_duration'] * 1000; } if (isset($data['views'])) { foreach ($data['views']['templates'] as $view) { $output['viewsData'][] = [ 'description' => 'Rendering a view', 'duration' => 0, 'end' => 0, 'start' => 0, 'data' => [ 'name' => $view['name'], 'data' => $view['params'], ], ]; } } if (isset($data['swiftmailer_mails'])) { foreach($data['swiftmailer_mails']['mails'] as $mail) { $output['emailsData'][] = [ 'data' => [ 'to' => $mail['to'], 'subject' => $mail['subject'], 'headers' => isset($mail['headers']) ? explode("\n", $mail['headers']) : null, ], ]; } } return $output; }
[ "public", "function", "convert", "(", "$", "data", ")", "{", "$", "meta", "=", "$", "data", "[", "'__meta'", "]", ";", "// Default output", "$", "output", "=", "[", "'id'", "=>", "$", "meta", "[", "'id'", "]", ",", "'method'", "=>", "$", "meta", "[...
Convert the phpdebugbar data to Clockwork format. @param array $data @return array
[ "Convert", "the", "phpdebugbar", "data", "to", "Clockwork", "format", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/Support/Clockwork/Converter.php#L11-L136
train
Convert array from response to response
[ 30522, 2270, 3853, 10463, 1006, 1002, 2951, 1007, 1063, 1002, 18804, 1027, 1002, 2951, 1031, 1005, 1035, 1035, 18804, 1005, 1033, 1025, 1013, 1013, 12398, 6434, 1002, 6434, 1027, 1031, 1005, 8909, 1005, 1027, 1028, 1002, 18804, 1031, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Form.php
Form.defineFormFields
protected function defineFormFields() { if ($this->fieldsDefined) { return; } /** * @event backend.form.extendFieldsBefore * Called before the form fields are defined * * Example usage: * * Event::listen('backend.form.extendFieldsBefore', function((\Backend\Widgets\Form) $formWidget) { * // You should always check to see if you're extending correct model/controller * if (!$widget->model instanceof \Foo\Example\Models\Bar) { * return; * } * * // Here you can't use addFields() because it will throw you an exception because form is not yet created * // and it does not have tabs and fields * // For this example we will pretend that we want to add a new field named example_field * $widget->fields['example_field'] = [ * 'label' => 'Example field', * 'comment' => 'Your example field', * 'type' => 'text', * ]; * }); * * Or * * $formWidget->bindEvent('form.extendFieldsBefore', function () use ((\Backend\Widgets\Form $formWidget)) { * // You should always check to see if you're extending correct model/controller * if (!$widget->model instanceof \Foo\Example\Models\Bar) { * return; * } * * // Here you can't use addFields() because it will throw you an exception because form is not yet created * // and it does not have tabs and fields * // For this example we will pretend that we want to add a new field named example_field * $widget->fields['example_field'] = [ * 'label' => 'Example field', * 'comment' => 'Your example field', * 'type' => 'text', * ]; * }); * */ $this->fireSystemEvent('backend.form.extendFieldsBefore'); /* * Outside fields */ if (!isset($this->fields) || !is_array($this->fields)) { $this->fields = []; } $this->allTabs->outside = new FormTabs(FormTabs::SECTION_OUTSIDE, (array) $this->config); $this->addFields($this->fields); /* * Primary Tabs + Fields */ if (!isset($this->tabs['fields']) || !is_array($this->tabs['fields'])) { $this->tabs['fields'] = []; } $this->allTabs->primary = new FormTabs(FormTabs::SECTION_PRIMARY, $this->tabs); $this->addFields($this->tabs['fields'], FormTabs::SECTION_PRIMARY); /* * Secondary Tabs + Fields */ if (!isset($this->secondaryTabs['fields']) || !is_array($this->secondaryTabs['fields'])) { $this->secondaryTabs['fields'] = []; } $this->allTabs->secondary = new FormTabs(FormTabs::SECTION_SECONDARY, $this->secondaryTabs); $this->addFields($this->secondaryTabs['fields'], FormTabs::SECTION_SECONDARY); /** * @event backend.form.extendFields * Called after the form fields are defined * * Example usage: * * Event::listen('backend.form.extendFields', function((\Backend\Widgets\Form) $formWidget) { * // Only for the User controller * if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) { * return; * } * * // Only for the User model * if (!$widget->model instanceof \RainLab\User\Models\User) { * return; * } * * // Add an extra birthday field * $widget->addFields([ * 'birthday' => [ * 'label' => 'Birthday', * 'comment' => 'Select the users birthday', * 'type' => 'datepicker' * ] * ]); * * // Remove a Surname field * $widget->removeField('surname'); * }); * * Or * * $formWidget->bindEvent('form.extendFields', function () use ((\Backend\Widgets\Form $formWidget)) { * // Only for the User controller * if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) { * return; * } * * // Only for the User model * if (!$widget->model instanceof \RainLab\User\Models\User) { * return; * } * * // Add an extra birthday field * $widget->addFields([ * 'birthday' => [ * 'label' => 'Birthday', * 'comment' => 'Select the users birthday', * 'type' => 'datepicker' * ] * ]); * * // Remove a Surname field * $widget->removeField('surname'); * }); * */ $this->fireSystemEvent('backend.form.extendFields', [$this->allFields]); /* * Convert automatic spanned fields */ foreach ($this->allTabs->outside->getFields() as $fields) { $this->processAutoSpan($fields); } foreach ($this->allTabs->primary->getFields() as $fields) { $this->processAutoSpan($fields); } foreach ($this->allTabs->secondary->getFields() as $fields) { $this->processAutoSpan($fields); } /* * At least one tab section should stretch */ if ( $this->allTabs->secondary->stretch === null && $this->allTabs->primary->stretch === null && $this->allTabs->outside->stretch === null ) { if ($this->allTabs->secondary->hasFields()) { $this->allTabs->secondary->stretch = true; } elseif ($this->allTabs->primary->hasFields()) { $this->allTabs->primary->stretch = true; } else { $this->allTabs->outside->stretch = true; } } /* * Bind all form widgets to controller */ foreach ($this->allFields as $field) { if ($field->type !== 'widget') { continue; } $widget = $this->makeFormFieldWidget($field); $widget->bindToController(); } $this->fieldsDefined = true; }
php
protected function defineFormFields() { if ($this->fieldsDefined) { return; } /** * @event backend.form.extendFieldsBefore * Called before the form fields are defined * * Example usage: * * Event::listen('backend.form.extendFieldsBefore', function((\Backend\Widgets\Form) $formWidget) { * // You should always check to see if you're extending correct model/controller * if (!$widget->model instanceof \Foo\Example\Models\Bar) { * return; * } * * // Here you can't use addFields() because it will throw you an exception because form is not yet created * // and it does not have tabs and fields * // For this example we will pretend that we want to add a new field named example_field * $widget->fields['example_field'] = [ * 'label' => 'Example field', * 'comment' => 'Your example field', * 'type' => 'text', * ]; * }); * * Or * * $formWidget->bindEvent('form.extendFieldsBefore', function () use ((\Backend\Widgets\Form $formWidget)) { * // You should always check to see if you're extending correct model/controller * if (!$widget->model instanceof \Foo\Example\Models\Bar) { * return; * } * * // Here you can't use addFields() because it will throw you an exception because form is not yet created * // and it does not have tabs and fields * // For this example we will pretend that we want to add a new field named example_field * $widget->fields['example_field'] = [ * 'label' => 'Example field', * 'comment' => 'Your example field', * 'type' => 'text', * ]; * }); * */ $this->fireSystemEvent('backend.form.extendFieldsBefore'); /* * Outside fields */ if (!isset($this->fields) || !is_array($this->fields)) { $this->fields = []; } $this->allTabs->outside = new FormTabs(FormTabs::SECTION_OUTSIDE, (array) $this->config); $this->addFields($this->fields); /* * Primary Tabs + Fields */ if (!isset($this->tabs['fields']) || !is_array($this->tabs['fields'])) { $this->tabs['fields'] = []; } $this->allTabs->primary = new FormTabs(FormTabs::SECTION_PRIMARY, $this->tabs); $this->addFields($this->tabs['fields'], FormTabs::SECTION_PRIMARY); /* * Secondary Tabs + Fields */ if (!isset($this->secondaryTabs['fields']) || !is_array($this->secondaryTabs['fields'])) { $this->secondaryTabs['fields'] = []; } $this->allTabs->secondary = new FormTabs(FormTabs::SECTION_SECONDARY, $this->secondaryTabs); $this->addFields($this->secondaryTabs['fields'], FormTabs::SECTION_SECONDARY); /** * @event backend.form.extendFields * Called after the form fields are defined * * Example usage: * * Event::listen('backend.form.extendFields', function((\Backend\Widgets\Form) $formWidget) { * // Only for the User controller * if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) { * return; * } * * // Only for the User model * if (!$widget->model instanceof \RainLab\User\Models\User) { * return; * } * * // Add an extra birthday field * $widget->addFields([ * 'birthday' => [ * 'label' => 'Birthday', * 'comment' => 'Select the users birthday', * 'type' => 'datepicker' * ] * ]); * * // Remove a Surname field * $widget->removeField('surname'); * }); * * Or * * $formWidget->bindEvent('form.extendFields', function () use ((\Backend\Widgets\Form $formWidget)) { * // Only for the User controller * if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) { * return; * } * * // Only for the User model * if (!$widget->model instanceof \RainLab\User\Models\User) { * return; * } * * // Add an extra birthday field * $widget->addFields([ * 'birthday' => [ * 'label' => 'Birthday', * 'comment' => 'Select the users birthday', * 'type' => 'datepicker' * ] * ]); * * // Remove a Surname field * $widget->removeField('surname'); * }); * */ $this->fireSystemEvent('backend.form.extendFields', [$this->allFields]); /* * Convert automatic spanned fields */ foreach ($this->allTabs->outside->getFields() as $fields) { $this->processAutoSpan($fields); } foreach ($this->allTabs->primary->getFields() as $fields) { $this->processAutoSpan($fields); } foreach ($this->allTabs->secondary->getFields() as $fields) { $this->processAutoSpan($fields); } /* * At least one tab section should stretch */ if ( $this->allTabs->secondary->stretch === null && $this->allTabs->primary->stretch === null && $this->allTabs->outside->stretch === null ) { if ($this->allTabs->secondary->hasFields()) { $this->allTabs->secondary->stretch = true; } elseif ($this->allTabs->primary->hasFields()) { $this->allTabs->primary->stretch = true; } else { $this->allTabs->outside->stretch = true; } } /* * Bind all form widgets to controller */ foreach ($this->allFields as $field) { if ($field->type !== 'widget') { continue; } $widget = $this->makeFormFieldWidget($field); $widget->bindToController(); } $this->fieldsDefined = true; }
[ "protected", "function", "defineFormFields", "(", ")", "{", "if", "(", "$", "this", "->", "fieldsDefined", ")", "{", "return", ";", "}", "/**\n * @event backend.form.extendFieldsBefore\n * Called before the form fields are defined\n *\n * Example usa...
Creates a flat array of form fields from the configuration. Also slots fields in to their respective tabs. @return void
[ "Creates", "a", "flat", "array", "of", "form", "fields", "from", "the", "configuration", ".", "Also", "slots", "fields", "in", "to", "their", "respective", "tabs", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L461-L646
train
Define form fields
[ 30522, 5123, 3853, 9375, 14192, 15155, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 4249, 3207, 23460, 2094, 1007, 1063, 2709, 1025, 1065, 1013, 1008, 1008, 1008, 1030, 2724, 2067, 10497, 1012, 2433, 1012, 7949, 15155, 4783, 29278,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Simple/ChainCache.php
ChainCache.setMultiple
public function setMultiple($values, $ttl = null) { if ($values instanceof \Traversable) { $valuesIterator = $values; $values = function () use ($valuesIterator, &$values) { $generatedValues = []; foreach ($valuesIterator as $key => $value) { yield $key => $value; $generatedValues[$key] = $value; } $values = $generatedValues; }; $values = $values(); } $saved = true; $i = $this->cacheCount; while ($i--) { $saved = $this->caches[$i]->setMultiple($values, $ttl) && $saved; } return $saved; }
php
public function setMultiple($values, $ttl = null) { if ($values instanceof \Traversable) { $valuesIterator = $values; $values = function () use ($valuesIterator, &$values) { $generatedValues = []; foreach ($valuesIterator as $key => $value) { yield $key => $value; $generatedValues[$key] = $value; } $values = $generatedValues; }; $values = $values(); } $saved = true; $i = $this->cacheCount; while ($i--) { $saved = $this->caches[$i]->setMultiple($values, $ttl) && $saved; } return $saved; }
[ "public", "function", "setMultiple", "(", "$", "values", ",", "$", "ttl", "=", "null", ")", "{", "if", "(", "$", "values", "instanceof", "\\", "Traversable", ")", "{", "$", "valuesIterator", "=", "$", "values", ";", "$", "values", "=", "function", "(",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ChainCache.php#L204-L228
train
Set Multiple Values
[ 30522, 2270, 3853, 2275, 12274, 7096, 11514, 2571, 1006, 1002, 5300, 1010, 1002, 23746, 2140, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 5300, 6013, 11253, 1032, 29053, 3085, 1007, 1063, 1002, 5300, 21646, 8844, 1027, 1002, 5300, 1025, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php
AbstractSurrogate.needsParsing
public function needsParsing(Response $response) { if (!$control = $response->headers->get('Surrogate-Control')) { return false; } $pattern = sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName())); return (bool) preg_match($pattern, $control); }
php
public function needsParsing(Response $response) { if (!$control = $response->headers->get('Surrogate-Control')) { return false; } $pattern = sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName())); return (bool) preg_match($pattern, $control); }
[ "public", "function", "needsParsing", "(", "Response", "$", "response", ")", "{", "if", "(", "!", "$", "control", "=", "$", "response", "->", "headers", "->", "get", "(", "'Surrogate-Control'", ")", ")", "{", "return", "false", ";", "}", "$", "pattern", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php#L77-L86
train
Returns true if the response needs to be parsed.
[ 30522, 2270, 3853, 3791, 19362, 7741, 1006, 3433, 1002, 3433, 1007, 1063, 2065, 1006, 999, 1002, 2491, 1027, 1002, 3433, 1011, 1028, 20346, 2015, 1011, 1028, 2131, 1006, 1005, 7505, 21799, 1011, 2491, 1005, 1007, 1007, 1063, 2709, 6270, 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/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
FormTypeCsrfExtension.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'csrf_protection' => $this->defaultEnabled, 'csrf_field_name' => $this->defaultFieldName, 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => $this->defaultTokenManager, 'csrf_token_id' => null, ]); }
php
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'csrf_protection' => $this->defaultEnabled, 'csrf_field_name' => $this->defaultFieldName, 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => $this->defaultTokenManager, 'csrf_token_id' => null, ]); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setDefaults", "(", "[", "'csrf_protection'", "=>", "$", "this", "->", "defaultEnabled", ",", "'csrf_field_name'", "=>", "$", "this", "->", "defau...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php#L105-L114
train
Configure the options for the Form
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 1002, 10663, 2099, 1007, 1063, 1002, 10663, 2099, 1011, 1028, 2275, 3207, 7011, 11314, 2015, 1006, 1031, 1005, 20116, 12881, 1035, 3860, 1005, 1027, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
ArrayNodeDefinition.useAttributeAsKey
public function useAttributeAsKey($name, $removeKeyItem = true) { $this->key = $name; $this->removeKeyItem = $removeKeyItem; return $this; }
php
public function useAttributeAsKey($name, $removeKeyItem = true) { $this->key = $name; $this->removeKeyItem = $removeKeyItem; return $this; }
[ "public", "function", "useAttributeAsKey", "(", "$", "name", ",", "$", "removeKeyItem", "=", "true", ")", "{", "$", "this", "->", "key", "=", "$", "name", ";", "$", "this", "->", "removeKeyItem", "=", "$", "removeKeyItem", ";", "return", "$", "this", "...
Sets the attribute which value is to be used as key. This is useful when you have an indexed array that should be an associative array. You can select an item from within the array to be the key of the particular item. For example, if "id" is the "key", then: [ ['id' => 'my_name', 'foo' => 'bar'], ]; becomes [ 'my_name' => ['foo' => 'bar'], ]; If you'd like "'id' => 'my_name'" to still be present in the resulting array, then you can set the second argument of this method to false. This method is applicable to prototype nodes only. @param string $name The name of the key @param bool $removeKeyItem Whether or not the key item should be removed @return $this
[ "Sets", "the", "attribute", "which", "value", "is", "to", "be", "used", "as", "key", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L237-L243
train
Create a new instance of the class - level namespace
[ 30522, 2270, 3853, 2224, 19321, 3089, 8569, 27058, 17140, 2100, 1006, 1002, 2171, 1010, 1002, 6366, 14839, 4221, 2213, 1027, 2995, 1007, 1063, 1002, 2023, 1011, 1028, 3145, 1027, 1002, 2171, 1025, 1002, 2023, 1011, 1028, 6366, 14839, 4221, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/flatbuffers
php/Table.php
Table.__string
protected function __string($offset) { $offset += $this->bb->getInt($offset); $len = $this->bb->getInt($offset); $startPos = $offset + Constants::SIZEOF_INT; return substr($this->bb->_buffer, $startPos, $len); }
php
protected function __string($offset) { $offset += $this->bb->getInt($offset); $len = $this->bb->getInt($offset); $startPos = $offset + Constants::SIZEOF_INT; return substr($this->bb->_buffer, $startPos, $len); }
[ "protected", "function", "__string", "(", "$", "offset", ")", "{", "$", "offset", "+=", "$", "this", "->", "bb", "->", "getInt", "(", "$", "offset", ")", ";", "$", "len", "=", "$", "this", "->", "bb", "->", "getInt", "(", "$", "offset", ")", ";",...
fetch utf8 encoded string. @param $offset @return string
[ "fetch", "utf8", "encoded", "string", "." ]
af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1
https://github.com/google/flatbuffers/blob/af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1/php/Table.php#L72-L78
train
Read a string from the buffer
[ 30522, 5123, 3853, 1035, 1035, 5164, 1006, 1002, 16396, 1007, 1063, 1002, 16396, 1009, 1027, 1002, 2023, 1011, 1028, 22861, 1011, 1028, 2131, 18447, 1006, 1002, 16396, 1007, 1025, 1002, 30524, 1007, 1025, 1002, 2707, 6873, 2015, 1027, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/LogDeleter.php
LogDeleter.deleteVisits
public function deleteVisits($visitIds) { $numDeletedVisits = 0; foreach ($this->logTablesProvider->getAllLogTables() as $logTable) { if ($logTable->getColumnToJoinOnIdVisit()) { $numVisits = $this->rawLogDao->deleteFromLogTable($logTable->getName(), $visitIds); if ($logTable->getName() === 'log_visit') { $numDeletedVisits = $numVisits; } } } return $numDeletedVisits; }
php
public function deleteVisits($visitIds) { $numDeletedVisits = 0; foreach ($this->logTablesProvider->getAllLogTables() as $logTable) { if ($logTable->getColumnToJoinOnIdVisit()) { $numVisits = $this->rawLogDao->deleteFromLogTable($logTable->getName(), $visitIds); if ($logTable->getName() === 'log_visit') { $numDeletedVisits = $numVisits; } } } return $numDeletedVisits; }
[ "public", "function", "deleteVisits", "(", "$", "visitIds", ")", "{", "$", "numDeletedVisits", "=", "0", ";", "foreach", "(", "$", "this", "->", "logTablesProvider", "->", "getAllLogTables", "(", ")", "as", "$", "logTable", ")", "{", "if", "(", "$", "log...
Deletes visits by ID. This method cascades, so conversions, conversion items and visit actions for the visits are also deleted. @param int[] $visitIds @return int The number of deleted visits.
[ "Deletes", "visits", "by", "ID", ".", "This", "method", "cascades", "so", "conversions", "conversion", "items", "and", "visit", "actions", "for", "the", "visits", "are", "also", "deleted", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/LogDeleter.php#L43-L57
train
Delete visits from all log tables
[ 30522, 2270, 3853, 3972, 12870, 11365, 12762, 1006, 1002, 3942, 9821, 1007, 1063, 1002, 16371, 26876, 12260, 3064, 11365, 12762, 1027, 1014, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 8833, 10880, 13102, 12298, 18688, 1011, 1028, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/AudioMedium.php
AudioMedium.loop
public function loop($status = false) { if($status) { $this->attributes['loop'] = true; } else { unset($this->attributes['loop']); } return $this; }
php
public function loop($status = false) { if($status) { $this->attributes['loop'] = true; } else { unset($this->attributes['loop']); } return $this; }
[ "public", "function", "loop", "(", "$", "status", "=", "false", ")", "{", "if", "(", "$", "status", ")", "{", "$", "this", "->", "attributes", "[", "'loop'", "]", "=", "true", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "attributes", ...
Allows to set the loop attribute @param bool $status @return $this
[ "Allows", "to", "set", "the", "loop", "attribute" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AudioMedium.php#L106-L115
train
Set loop attribute
[ 30522, 2270, 3853, 7077, 1006, 1002, 3570, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 3570, 1007, 1063, 1002, 2023, 1011, 1028, 12332, 1031, 1005, 7077, 1005, 1033, 1027, 2995, 1025, 1065, 2842, 1063, 4895, 13462, 1006, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/helpers/DateTime.php
DateTime.momentFormat
public static function momentFormat($format) { $replacements = [ 'd' => 'DD', 'D' => 'ddd', 'j' => 'D', 'l' => 'dddd', 'N' => 'E', 'S' => 'o', 'w' => 'e', 'z' => 'DDD', 'W' => 'W', 'F' => 'MMMM', 'm' => 'MM', 'M' => 'MMM', 'n' => 'M', 't' => '', // no equivalent 'L' => '', // no equivalent 'o' => 'YYYY', 'Y' => 'YYYY', 'y' => 'YY', 'a' => 'a', 'A' => 'A', 'B' => '', // no equivalent 'g' => 'h', 'G' => 'H', 'h' => 'hh', 'H' => 'HH', 'i' => 'mm', 's' => 'ss', 'u' => 'SSS', 'e' => 'zz', // deprecated since version 1.6.0 of moment.js 'I' => '', // no equivalent 'O' => '', // no equivalent 'P' => '', // no equivalent 'T' => '', // no equivalent 'Z' => '', // no equivalent 'c' => '', // no equivalent 'r' => '', // no equivalent 'U' => 'X', ]; foreach ($replacements as $from => $to) { $replacements['\\'.$from] = '['.$from.']'; } return strtr($format, $replacements); }
php
public static function momentFormat($format) { $replacements = [ 'd' => 'DD', 'D' => 'ddd', 'j' => 'D', 'l' => 'dddd', 'N' => 'E', 'S' => 'o', 'w' => 'e', 'z' => 'DDD', 'W' => 'W', 'F' => 'MMMM', 'm' => 'MM', 'M' => 'MMM', 'n' => 'M', 't' => '', // no equivalent 'L' => '', // no equivalent 'o' => 'YYYY', 'Y' => 'YYYY', 'y' => 'YY', 'a' => 'a', 'A' => 'A', 'B' => '', // no equivalent 'g' => 'h', 'G' => 'H', 'h' => 'hh', 'H' => 'HH', 'i' => 'mm', 's' => 'ss', 'u' => 'SSS', 'e' => 'zz', // deprecated since version 1.6.0 of moment.js 'I' => '', // no equivalent 'O' => '', // no equivalent 'P' => '', // no equivalent 'T' => '', // no equivalent 'Z' => '', // no equivalent 'c' => '', // no equivalent 'r' => '', // no equivalent 'U' => 'X', ]; foreach ($replacements as $from => $to) { $replacements['\\'.$from] = '['.$from.']'; } return strtr($format, $replacements); }
[ "public", "static", "function", "momentFormat", "(", "$", "format", ")", "{", "$", "replacements", "=", "[", "'d'", "=>", "'DD'", ",", "'D'", "=>", "'ddd'", ",", "'j'", "=>", "'D'", ",", "'l'", "=>", "'dddd'", ",", "'N'", "=>", "'E'", ",", "'S'", "...
Converts a PHP date format to "Moment.js" format. @param string $format @return string
[ "Converts", "a", "PHP", "date", "format", "to", "Moment", ".", "js", "format", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/helpers/DateTime.php#L86-L133
train
Format moment according to specifed format
[ 30522, 2270, 10763, 3853, 2617, 14192, 4017, 1006, 1002, 4289, 1007, 1063, 1002, 23936, 1027, 1031, 1005, 1040, 1005, 1027, 1028, 1005, 20315, 1005, 1010, 1005, 1040, 1005, 1027, 1028, 1005, 20315, 2094, 1005, 1010, 1005, 1046, 1005, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/FlexObject.php
FlexObject.getForm
public function getForm(string $name = '', array $form = null) { if (!isset($this->_forms[$name])) { $this->_forms[$name] = $this->createFormObject($name, $form); } return $this->_forms[$name]; }
php
public function getForm(string $name = '', array $form = null) { if (!isset($this->_forms[$name])) { $this->_forms[$name] = $this->createFormObject($name, $form); } return $this->_forms[$name]; }
[ "public", "function", "getForm", "(", "string", "$", "name", "=", "''", ",", "array", "$", "form", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_forms", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "_form...
{@inheritdoc} @see FlexObjectInterface::getForm()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexObject.php#L615-L622
train
Get Form Object
[ 30522, 2270, 3853, 2131, 14192, 1006, 5164, 1002, 2171, 1027, 1005, 1005, 1010, 9140, 1002, 2433, 1027, 19701, 1007, 30524, 1002, 2171, 1010, 1002, 2433, 1007, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 1035, 3596, 1031, 1002, 2171, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php
SwiftMailerHandler.send
protected function send($content, array $records) { parent::send($content, $records); if ($this->instantFlush) { $this->flushMemorySpool(); } }
php
protected function send($content, array $records) { parent::send($content, $records); if ($this->instantFlush) { $this->flushMemorySpool(); } }
[ "protected", "function", "send", "(", "$", "content", ",", "array", "$", "records", ")", "{", "parent", "::", "send", "(", "$", "content", ",", "$", "records", ")", ";", "if", "(", "$", "this", "->", "instantFlush", ")", "{", "$", "this", "->", "fl...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php#L55-L62
train
Override the send method to flush memory spool if necessary
[ 30522, 5123, 3853, 4604, 1006, 1002, 4180, 1010, 9140, 1002, 2636, 1007, 1063, 6687, 1024, 1024, 4604, 1006, 1002, 4180, 1010, 1002, 2636, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 7107, 10258, 20668, 1007, 1063, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Request.php
Request.getPageGenerationTime
public function getPageGenerationTime() { $generationTime = $this->getParam('gt_ms'); if ($generationTime > 0 && $generationTime < self::GENERATION_TIME_MS_MAXIMUM ) { return (int)$generationTime; } return false; }
php
public function getPageGenerationTime() { $generationTime = $this->getParam('gt_ms'); if ($generationTime > 0 && $generationTime < self::GENERATION_TIME_MS_MAXIMUM ) { return (int)$generationTime; } return false; }
[ "public", "function", "getPageGenerationTime", "(", ")", "{", "$", "generationTime", "=", "$", "this", "->", "getParam", "(", "'gt_ms'", ")", ";", "if", "(", "$", "generationTime", ">", "0", "&&", "$", "generationTime", "<", "self", "::", "GENERATION_TIME_MS...
1 hour
[ "1", "hour" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Request.php#L846-L856
train
Get Page Generation Time
[ 30522, 2270, 3853, 2131, 13704, 6914, 16754, 7292, 1006, 1007, 1063, 1002, 4245, 7292, 1027, 1002, 2023, 1011, 1028, 2131, 28689, 2213, 1006, 1005, 14181, 1035, 5796, 1005, 1007, 1025, 2065, 1006, 1002, 4245, 7292, 1028, 1014, 1004, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RankingQuery.php
RankingQuery.generateRankingQuery
public function generateRankingQuery($innerQuery) { // +1 to include "Others" $limit = $this->limit + 1; $counterExpression = $this->getCounterExpression($limit); // generate select clauses for label columns $labelColumnsString = '`' . implode('`, `', array_keys($this->labelColumns)) . '`'; $labelColumnsOthersSwitch = array(); foreach ($this->labelColumns as $column => $true) { $labelColumnsOthersSwitch[] = " CASE WHEN counter = $limit THEN '" . $this->othersLabelValue . "' ELSE `$column` END AS `$column` "; } $labelColumnsOthersSwitch = implode(', ', $labelColumnsOthersSwitch); // generate select clauses for additional columns $additionalColumnsString = ''; $additionalColumnsAggregatedString = ''; foreach ($this->additionalColumns as $additionalColumn => $aggregation) { $additionalColumnsString .= ', `' . $additionalColumn . '`'; if ($aggregation !== false) { $additionalColumnsAggregatedString .= ', ' . $aggregation . '(`' . $additionalColumn . '`) AS `' . $additionalColumn . '`'; } else { $additionalColumnsAggregatedString .= ', `' . $additionalColumn . '`'; } } // initialize the counters if ($this->partitionColumn !== false) { $initCounter = ''; foreach ($this->partitionColumnValues as $value) { $initCounter .= '( SELECT @counter' . intval($value) . ':=0 ) initCounter' . intval($value) . ', '; } } else { $initCounter = '( SELECT @counter:=0 ) initCounter,'; } // add a counter to the query // we rely on the sorting of the inner query $withCounter = " SELECT $labelColumnsString, $counterExpression AS counter $additionalColumnsString FROM $initCounter ( $innerQuery ) actualQuery "; // group by the counter - this groups "Others" because the counter stops at $limit $groupBy = 'counter'; if ($this->partitionColumn !== false) { $groupBy .= ', `' . $this->partitionColumn . '`'; } $groupOthers = " SELECT $labelColumnsOthersSwitch $additionalColumnsAggregatedString FROM ( $withCounter ) AS withCounter GROUP BY $groupBy "; return $groupOthers; }
php
public function generateRankingQuery($innerQuery) { // +1 to include "Others" $limit = $this->limit + 1; $counterExpression = $this->getCounterExpression($limit); // generate select clauses for label columns $labelColumnsString = '`' . implode('`, `', array_keys($this->labelColumns)) . '`'; $labelColumnsOthersSwitch = array(); foreach ($this->labelColumns as $column => $true) { $labelColumnsOthersSwitch[] = " CASE WHEN counter = $limit THEN '" . $this->othersLabelValue . "' ELSE `$column` END AS `$column` "; } $labelColumnsOthersSwitch = implode(', ', $labelColumnsOthersSwitch); // generate select clauses for additional columns $additionalColumnsString = ''; $additionalColumnsAggregatedString = ''; foreach ($this->additionalColumns as $additionalColumn => $aggregation) { $additionalColumnsString .= ', `' . $additionalColumn . '`'; if ($aggregation !== false) { $additionalColumnsAggregatedString .= ', ' . $aggregation . '(`' . $additionalColumn . '`) AS `' . $additionalColumn . '`'; } else { $additionalColumnsAggregatedString .= ', `' . $additionalColumn . '`'; } } // initialize the counters if ($this->partitionColumn !== false) { $initCounter = ''; foreach ($this->partitionColumnValues as $value) { $initCounter .= '( SELECT @counter' . intval($value) . ':=0 ) initCounter' . intval($value) . ', '; } } else { $initCounter = '( SELECT @counter:=0 ) initCounter,'; } // add a counter to the query // we rely on the sorting of the inner query $withCounter = " SELECT $labelColumnsString, $counterExpression AS counter $additionalColumnsString FROM $initCounter ( $innerQuery ) actualQuery "; // group by the counter - this groups "Others" because the counter stops at $limit $groupBy = 'counter'; if ($this->partitionColumn !== false) { $groupBy .= ', `' . $this->partitionColumn . '`'; } $groupOthers = " SELECT $labelColumnsOthersSwitch $additionalColumnsAggregatedString FROM ( $withCounter ) AS withCounter GROUP BY $groupBy "; return $groupOthers; }
[ "public", "function", "generateRankingQuery", "(", "$", "innerQuery", ")", "{", "// +1 to include \"Others\"", "$", "limit", "=", "$", "this", "->", "limit", "+", "1", ";", "$", "counterExpression", "=", "$", "this", "->", "getCounterExpression", "(", "$", "li...
Generate the SQL code that does the magic. If you want to get the result, use execute() instead. If you want to run the query yourself, use this method. @param $innerQuery string The "payload" query that does the actual data aggregation. The ordering has to be specified in this query. {@link RankingQuery} cannot apply ordering itself. @return string The entire ranking query SQL.
[ "Generate", "the", "SQL", "code", "that", "does", "the", "magic", ".", "If", "you", "want", "to", "get", "the", "result", "use", "execute", "()", "instead", ".", "If", "you", "want", "to", "run", "the", "query", "yourself", "use", "this", "method", "."...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/RankingQuery.php#L279-L345
train
Generate the ranking query for the query
[ 30522, 2270, 3853, 9699, 26763, 2075, 4226, 2854, 1006, 1002, 5110, 4226, 2854, 1007, 1063, 1013, 1013, 1009, 1015, 2000, 2421, 1000, 2500, 1000, 1002, 5787, 1027, 1002, 2023, 1011, 1028, 5787, 1009, 1015, 1025, 1002, 4675, 10288, 20110, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Facades/Storage.php
Storage.persistentFake
public static function persistentFake($disk = null) { $disk = $disk ?: self::$app['config']->get('filesystems.default'); static::set($disk, $fake = self::createLocalDriver([ 'root' => storage_path('framework/testing/disks/'.$disk), ])); return $fake; }
php
public static function persistentFake($disk = null) { $disk = $disk ?: self::$app['config']->get('filesystems.default'); static::set($disk, $fake = self::createLocalDriver([ 'root' => storage_path('framework/testing/disks/'.$disk), ])); return $fake; }
[ "public", "static", "function", "persistentFake", "(", "$", "disk", "=", "null", ")", "{", "$", "disk", "=", "$", "disk", "?", ":", "self", "::", "$", "app", "[", "'config'", "]", "->", "get", "(", "'filesystems.default'", ")", ";", "static", "::", "...
Replace the given disk with a persistent local testing disk. @param string|null $disk @return \Illuminate\Filesystem\Filesystem
[ "Replace", "the", "given", "disk", "with", "a", "persistent", "local", "testing", "disk", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Facades/Storage.php#L40-L49
train
Create a persistent fake disk
[ 30522, 2270, 10763, 3853, 14516, 7011, 3489, 1006, 1002, 9785, 1027, 19701, 1007, 1063, 1002, 9785, 1027, 1002, 9785, 1029, 1024, 2969, 1024, 1024, 1002, 10439, 1031, 1005, 9530, 8873, 2290, 1005, 1033, 1011, 1028, 2131, 1006, 1005, 6764, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/Relation.php
Relation.whereInMethod
protected function whereInMethod(Model $model, $key) { return $model->getKeyName() === last(explode('.', $key)) && $model->getIncrementing() && in_array($model->getKeyType(), ['int', 'integer']) ? 'whereIntegerInRaw' : 'whereIn'; }
php
protected function whereInMethod(Model $model, $key) { return $model->getKeyName() === last(explode('.', $key)) && $model->getIncrementing() && in_array($model->getKeyType(), ['int', 'integer']) ? 'whereIntegerInRaw' : 'whereIn'; }
[ "protected", "function", "whereInMethod", "(", "Model", "$", "model", ",", "$", "key", ")", "{", "return", "$", "model", "->", "getKeyName", "(", ")", "===", "last", "(", "explode", "(", "'.'", ",", "$", "key", ")", ")", "&&", "$", "model", "->", "...
Get the name of the "where in" method for eager loading. @param \Illuminate\Database\Eloquent\Model $model @param string $key @return string
[ "Get", "the", "name", "of", "the", "where", "in", "method", "for", "eager", "loading", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Relation.php#L317-L324
train
Internal method to check if the key is in the right order
[ 30522, 5123, 3853, 16726, 11368, 6806, 2094, 1006, 2944, 1002, 2944, 1010, 1002, 3145, 1007, 1063, 2709, 1002, 2944, 1011, 1028, 2131, 14839, 18442, 1006, 1007, 1027, 1027, 1027, 2197, 1006, 15044, 1006, 1005, 1012, 1005, 1010, 1002, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/FlexObject.php
FlexObject.exists
public function exists(): bool { $key = $this->getStorageKey(); return $key && $this->getFlexDirectory()->getStorage()->hasKey($key); }
php
public function exists(): bool { $key = $this->getStorageKey(); return $key && $this->getFlexDirectory()->getStorage()->hasKey($key); }
[ "public", "function", "exists", "(", ")", ":", "bool", "{", "$", "key", "=", "$", "this", "->", "getStorageKey", "(", ")", ";", "return", "$", "key", "&&", "$", "this", "->", "getFlexDirectory", "(", ")", "->", "getStorage", "(", ")", "->", "hasKey",...
{@inheritdoc} @see FlexObjectInterface::exists()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexObject.php#L221-L226
train
Check if the current page exists in the flex directory
[ 30522, 2270, 3853, 6526, 1006, 1007, 1024, 22017, 2140, 1063, 1002, 3145, 1027, 1002, 2023, 1011, 1028, 4152, 4263, 4270, 14839, 1006, 1007, 1025, 2709, 1002, 3145, 1004, 1004, 1002, 2023, 1011, 1028, 2131, 21031, 2595, 4305, 2890, 16761, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Console/InstallCommand.php
InstallCommand.createAuthController
public function createAuthController() { $authController = $this->directory.'/Controllers/AuthController.php'; $contents = $this->getStub('AuthController'); $this->laravel['files']->put( $authController, str_replace('DummyNamespace', config('admin.route.namespace'), $contents) ); $this->line('<info>AuthController file was created:</info> '.str_replace(base_path(), '', $authController)); }
php
public function createAuthController() { $authController = $this->directory.'/Controllers/AuthController.php'; $contents = $this->getStub('AuthController'); $this->laravel['files']->put( $authController, str_replace('DummyNamespace', config('admin.route.namespace'), $contents) ); $this->line('<info>AuthController file was created:</info> '.str_replace(base_path(), '', $authController)); }
[ "public", "function", "createAuthController", "(", ")", "{", "$", "authController", "=", "$", "this", "->", "directory", ".", "'/Controllers/AuthController.php'", ";", "$", "contents", "=", "$", "this", "->", "getStub", "(", "'AuthController'", ")", ";", "$", ...
Create AuthController. @return void
[ "Create", "AuthController", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/InstallCommand.php#L108-L118
train
Create AuthController file
[ 30522, 2270, 3853, 3443, 4887, 2705, 8663, 13181, 10820, 1006, 1007, 1063, 1002, 8740, 2705, 8663, 13181, 10820, 1027, 1002, 2023, 1011, 1028, 14176, 1012, 1005, 1013, 21257, 1013, 8740, 2705, 8663, 13181, 10820, 1012, 25718, 1005, 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...
laravel/framework
src/Illuminate/Filesystem/FilesystemAdapter.php
FilesystemAdapter.readStream
public function readStream($path) { try { $resource = $this->driver->readStream($path); return $resource ? $resource : null; } catch (FileNotFoundException $e) { throw new ContractFileNotFoundException($e->getMessage(), $e->getCode(), $e); } }
php
public function readStream($path) { try { $resource = $this->driver->readStream($path); return $resource ? $resource : null; } catch (FileNotFoundException $e) { throw new ContractFileNotFoundException($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "readStream", "(", "$", "path", ")", "{", "try", "{", "$", "resource", "=", "$", "this", "->", "driver", "->", "readStream", "(", "$", "path", ")", ";", "return", "$", "resource", "?", "$", "resource", ":", "null", ";", "}", "...
{@inheritdoc}
[ "{" ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L415-L424
train
Reads a stream of file
[ 30522, 2270, 3853, 9631, 25379, 1006, 1002, 4130, 1007, 1063, 3046, 1063, 1002, 7692, 1027, 1002, 2023, 1011, 1028, 4062, 1011, 1028, 9631, 25379, 1006, 1002, 4130, 1007, 1025, 2709, 1002, 7692, 1029, 1002, 7692, 1024, 19701, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreAdminHome/Tasks.php
Tasks.updateSpammerBlacklist
public function updateSpammerBlacklist() { $url = 'https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt'; $list = Http::sendHttpRequest($url, 30); $list = preg_split("/\r\n|\n|\r/", $list); if (count($list) < 10) { throw new \Exception(sprintf( 'The spammers list downloaded from %s contains less than 10 entries, considering it a fail', $url )); } Option::set(ReferrerSpamFilter::OPTION_STORAGE_NAME, serialize($list)); }
php
public function updateSpammerBlacklist() { $url = 'https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt'; $list = Http::sendHttpRequest($url, 30); $list = preg_split("/\r\n|\n|\r/", $list); if (count($list) < 10) { throw new \Exception(sprintf( 'The spammers list downloaded from %s contains less than 10 entries, considering it a fail', $url )); } Option::set(ReferrerSpamFilter::OPTION_STORAGE_NAME, serialize($list)); }
[ "public", "function", "updateSpammerBlacklist", "(", ")", "{", "$", "url", "=", "'https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt'", ";", "$", "list", "=", "Http", "::", "sendHttpRequest", "(", "$", "url", ",", "30", ")", ";", ...
Update the referrer spam blacklist @see https://github.com/matomo-org/referrer-spam-blacklist
[ "Update", "the", "referrer", "spam", "blacklist" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Tasks.php#L250-L263
train
Update the referrer spam blacklist
[ 30522, 2270, 3853, 14409, 4502, 15810, 28522, 3600, 9863, 1006, 1007, 1063, 1002, 24471, 2140, 1027, 1005, 16770, 1024, 1013, 1013, 6315, 1012, 21025, 2705, 12083, 20330, 8663, 6528, 2102, 1012, 4012, 1013, 13523, 19506, 1011, 8917, 1013, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Notifications/VerifyEmail.php
VerifyEmail.toMail
public function toMail($notifiable) { if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable); } return (new MailMessage) ->subject(Lang::getFromJson('Verify Email Address')) ->line(Lang::getFromJson('Please click the button below to verify your email address.')) ->action( Lang::getFromJson('Verify Email Address'), $this->verificationUrl($notifiable) ) ->line(Lang::getFromJson('If you did not create an account, no further action is required.')); }
php
public function toMail($notifiable) { if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable); } return (new MailMessage) ->subject(Lang::getFromJson('Verify Email Address')) ->line(Lang::getFromJson('Please click the button below to verify your email address.')) ->action( Lang::getFromJson('Verify Email Address'), $this->verificationUrl($notifiable) ) ->line(Lang::getFromJson('If you did not create an account, no further action is required.')); }
[ "public", "function", "toMail", "(", "$", "notifiable", ")", "{", "if", "(", "static", "::", "$", "toMailCallback", ")", "{", "return", "call_user_func", "(", "static", "::", "$", "toMailCallback", ",", "$", "notifiable", ")", ";", "}", "return", "(", "n...
Build the mail representation of the notification. @param mixed $notifiable @return \Illuminate\Notifications\Messages\MailMessage
[ "Build", "the", "mail", "representation", "of", "the", "notification", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Notifications/VerifyEmail.php#L38-L52
train
To Mail Message
[ 30522, 2270, 3853, 3419, 12502, 1006, 1002, 2025, 10128, 19210, 1007, 1063, 2065, 1006, 10763, 1024, 1024, 1002, 3419, 12502, 9289, 20850, 8684, 1007, 1063, 2709, 2655, 1035, 5310, 1035, 4569, 2278, 1006, 10763, 1024, 1024, 1002, 3419, 1250...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Content.php
Content.parseMarkup
public function parseMarkup() { $extension = strtolower(File::extension($this->fileName)); switch ($extension) { case 'txt': $result = htmlspecialchars($this->markup); break; case 'md': $result = Markdown::parse($this->markup); break; default: $result = $this->markup; } return $result; }
php
public function parseMarkup() { $extension = strtolower(File::extension($this->fileName)); switch ($extension) { case 'txt': $result = htmlspecialchars($this->markup); break; case 'md': $result = Markdown::parse($this->markup); break; default: $result = $this->markup; } return $result; }
[ "public", "function", "parseMarkup", "(", ")", "{", "$", "extension", "=", "strtolower", "(", "File", "::", "extension", "(", "$", "this", "->", "fileName", ")", ")", ";", "switch", "(", "$", "extension", ")", "{", "case", "'txt'", ":", "$", "result", ...
Parses the content markup according to the file type. @return string
[ "Parses", "the", "content", "markup", "according", "to", "the", "file", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Content.php#L56-L72
train
Parse markup for the current file
[ 30522, 2270, 3853, 11968, 3366, 10665, 6279, 1006, 1007, 1063, 1002, 5331, 1027, 2358, 5339, 12898, 13777, 1006, 5371, 1024, 1024, 5331, 1006, 1002, 2023, 1011, 1028, 5371, 18442, 1007, 1007, 1025, 6942, 1006, 1002, 5331, 1007, 1063, 2553, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Archive.php
Archive.cacheArchiveIdsAfterLaunching
private function cacheArchiveIdsAfterLaunching($archiveGroups, $plugins) { $this->invalidatedReportsIfNeeded(); $today = Date::today(); foreach ($this->params->getPeriods() as $period) { $twoDaysBeforePeriod = $period->getDateStart()->subDay(2); $twoDaysAfterPeriod = $period->getDateEnd()->addDay(2); foreach ($this->params->getIdSites() as $idSite) { $site = new Site($idSite); // if the END of the period is BEFORE the website creation date // we already know there are no stats for this period // we add one day to make sure we don't miss the day of the website creation if ($twoDaysAfterPeriod->isEarlier($site->getCreationDate())) { Log::debug("Archive site %s, %s (%s) skipped, archive is before the website was created.", $idSite, $period->getLabel(), $period->getPrettyString()); continue; } // if the starting date is in the future we know there is no visiidsite = ?t if ($twoDaysBeforePeriod->isLater($today)) { Log::debug("Archive site %s, %s (%s) skipped, archive is after today.", $idSite, $period->getLabel(), $period->getPrettyString()); continue; } $this->prepareArchive($archiveGroups, $site, $period); } } }
php
private function cacheArchiveIdsAfterLaunching($archiveGroups, $plugins) { $this->invalidatedReportsIfNeeded(); $today = Date::today(); foreach ($this->params->getPeriods() as $period) { $twoDaysBeforePeriod = $period->getDateStart()->subDay(2); $twoDaysAfterPeriod = $period->getDateEnd()->addDay(2); foreach ($this->params->getIdSites() as $idSite) { $site = new Site($idSite); // if the END of the period is BEFORE the website creation date // we already know there are no stats for this period // we add one day to make sure we don't miss the day of the website creation if ($twoDaysAfterPeriod->isEarlier($site->getCreationDate())) { Log::debug("Archive site %s, %s (%s) skipped, archive is before the website was created.", $idSite, $period->getLabel(), $period->getPrettyString()); continue; } // if the starting date is in the future we know there is no visiidsite = ?t if ($twoDaysBeforePeriod->isLater($today)) { Log::debug("Archive site %s, %s (%s) skipped, archive is after today.", $idSite, $period->getLabel(), $period->getPrettyString()); continue; } $this->prepareArchive($archiveGroups, $site, $period); } } }
[ "private", "function", "cacheArchiveIdsAfterLaunching", "(", "$", "archiveGroups", ",", "$", "plugins", ")", "{", "$", "this", "->", "invalidatedReportsIfNeeded", "(", ")", ";", "$", "today", "=", "Date", "::", "today", "(", ")", ";", "foreach", "(", "$", ...
Gets the IDs of the archives we're querying for and stores them in $this->archives. This function will launch the archiving process for each period/site/plugin if metrics/reports have not been calculated/archived already. @param array $archiveGroups @see getArchiveGroupOfReport @param array $plugins List of plugin names to archive.
[ "Gets", "the", "IDs", "of", "the", "archives", "we", "re", "querying", "for", "and", "stores", "them", "in", "$this", "-", ">", "archives", ".", "This", "function", "will", "launch", "the", "archiving", "process", "for", "each", "period", "/", "site", "/...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L639-L671
train
Cache archive ids after launching
[ 30522, 2797, 3853, 17053, 2906, 5428, 3726, 9821, 10354, 3334, 17298, 12680, 2075, 1006, 1002, 8756, 17058, 2015, 1010, 1002, 13354, 7076, 1007, 1063, 1002, 2023, 1011, 1028, 19528, 4383, 2890, 25378, 10128, 24045, 5732, 1006, 1007, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/CronArchive.php
CronArchive.archiveReportsFor
private function archiveReportsFor($idSite, $period, $date, $archiveSegments, Timer $periodTimer, $visitsToday = 0, $visitsLastDays = 0) { $url = $this->getVisitsRequestUrl($idSite, $period, $date, $segment = false); $url = $this->makeRequestUrl($url); $visitsInLastPeriod = $visitsToday; $visitsInLastPeriods = $visitsLastDays; $success = true; $urls = array(); $cliMulti = $this->makeCliMulti(); $noSegmentUrl = $url; // already processed above for "day" if ($period != "day") { if ($this->isAlreadyArchivingUrl($url, $idSite, $period, $date)) { $success = false; return $success; } $self = $this; $request = new Request($url); $request->before(function () use ($self, $url, $idSite, $period, $date) { if ($self->isAlreadyArchivingUrl($url, $idSite, $period, $date)) { return Request::ABORT; } }); $urls[] = $request; $this->logArchiveWebsite($idSite, $period, $date); } $segmentRequestsCount = 0; if ($archiveSegments) { $urlsWithSegment = $this->getUrlsWithSegment($idSite, $period, $date); $urls = array_merge($urls, $urlsWithSegment); $segmentRequestsCount = count($urlsWithSegment); // in case several segment URLs for period=range had the date= rewritten to the same value, we only call API once $urls = array_unique($urls); } $this->requests += count($urls); $response = $cliMulti->request($urls); foreach ($urls as $index => $url) { $content = array_key_exists($index, $response) ? $response[$index] : null; $success = $success && $this->checkResponse($content, $url); if ($noSegmentUrl == $url && $success) { $stats = Common::safe_unserialize($content); if (!is_array($stats)) { $this->logError("Error unserializing the following response from $url: " . $content); $success = false; } if ($period == 'range') { // range returns one dataset (the sum of data between the two dates), // whereas other periods return lastN which is N datasets in an array. Here we make our period=range dataset look like others: $stats = array($stats); } $visitsInLastPeriods = $this->getVisitsFromApiResponse($stats); $visitsInLastPeriod = $this->getVisitsLastPeriodFromApiResponse($stats); } } $this->logArchivedWebsite($idSite, $period, $date, $segmentRequestsCount, $visitsInLastPeriods, $visitsInLastPeriod, $periodTimer); return $success; }
php
private function archiveReportsFor($idSite, $period, $date, $archiveSegments, Timer $periodTimer, $visitsToday = 0, $visitsLastDays = 0) { $url = $this->getVisitsRequestUrl($idSite, $period, $date, $segment = false); $url = $this->makeRequestUrl($url); $visitsInLastPeriod = $visitsToday; $visitsInLastPeriods = $visitsLastDays; $success = true; $urls = array(); $cliMulti = $this->makeCliMulti(); $noSegmentUrl = $url; // already processed above for "day" if ($period != "day") { if ($this->isAlreadyArchivingUrl($url, $idSite, $period, $date)) { $success = false; return $success; } $self = $this; $request = new Request($url); $request->before(function () use ($self, $url, $idSite, $period, $date) { if ($self->isAlreadyArchivingUrl($url, $idSite, $period, $date)) { return Request::ABORT; } }); $urls[] = $request; $this->logArchiveWebsite($idSite, $period, $date); } $segmentRequestsCount = 0; if ($archiveSegments) { $urlsWithSegment = $this->getUrlsWithSegment($idSite, $period, $date); $urls = array_merge($urls, $urlsWithSegment); $segmentRequestsCount = count($urlsWithSegment); // in case several segment URLs for period=range had the date= rewritten to the same value, we only call API once $urls = array_unique($urls); } $this->requests += count($urls); $response = $cliMulti->request($urls); foreach ($urls as $index => $url) { $content = array_key_exists($index, $response) ? $response[$index] : null; $success = $success && $this->checkResponse($content, $url); if ($noSegmentUrl == $url && $success) { $stats = Common::safe_unserialize($content); if (!is_array($stats)) { $this->logError("Error unserializing the following response from $url: " . $content); $success = false; } if ($period == 'range') { // range returns one dataset (the sum of data between the two dates), // whereas other periods return lastN which is N datasets in an array. Here we make our period=range dataset look like others: $stats = array($stats); } $visitsInLastPeriods = $this->getVisitsFromApiResponse($stats); $visitsInLastPeriod = $this->getVisitsLastPeriodFromApiResponse($stats); } } $this->logArchivedWebsite($idSite, $period, $date, $segmentRequestsCount, $visitsInLastPeriods, $visitsInLastPeriod, $periodTimer); return $success; }
[ "private", "function", "archiveReportsFor", "(", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "archiveSegments", ",", "Timer", "$", "periodTimer", ",", "$", "visitsToday", "=", "0", ",", "$", "visitsLastDays", "=", "0", ")", "{", "$", ...
Will trigger API requests for the specified Website $idSite, for the specified $period, for all segments that are pre-processed for this website. Requests are triggered using cURL multi handle @param $idSite int @param $period string @param $date string @param $archiveSegments bool Whether to pre-process all custom segments @param Timer $periodTimer @param $visitsToday int Visits for the "day" period of today @param $visitsLastDays int Visits for the last N days periods @return bool True on success, false if some request failed
[ "Will", "trigger", "API", "requests", "for", "the", "specified", "Website", "$idSite", "for", "the", "specified", "$period", "for", "all", "segments", "that", "are", "pre", "-", "processed", "for", "this", "website", ".", "Requests", "are", "triggered", "using...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive.php#L976-L1050
train
Archives reports for a given site
[ 30522, 2797, 3853, 8756, 2890, 25378, 29278, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 8264, 13910, 8163, 1010, 25309, 1002, 2558, 7292, 2099, 1010, 1002, 7879, 3406, 10259, 1027, 1014, 1010, 1002, 7879,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.findPackage
public function findPackage($search, $ignore_exception = false) { $search = strtolower($search); $found = $this->getRepositoryTheme($search); if ($found) { return $found; } $found = $this->getRepositoryPlugin($search); if ($found) { return $found; } $themes = $this->getRepositoryThemes(); $plugins = $this->getRepositoryPlugins(); if (!$themes && !$plugins) { if (!is_writable(ROOT_DIR . '/cache/gpm')) { throw new \RuntimeException("The cache/gpm folder is not writable. Please check the folder permissions."); } if ($ignore_exception) { return false; } throw new \RuntimeException("GPM not reachable. Please check your internet connection or check the Grav site is reachable"); } if ($themes) { foreach ($themes as $slug => $theme) { if ($search == $slug || $search == $theme->name) { return $theme; } } } if ($plugins) { foreach ($plugins as $slug => $plugin) { if ($search == $slug || $search == $plugin->name) { return $plugin; } } } return false; }
php
public function findPackage($search, $ignore_exception = false) { $search = strtolower($search); $found = $this->getRepositoryTheme($search); if ($found) { return $found; } $found = $this->getRepositoryPlugin($search); if ($found) { return $found; } $themes = $this->getRepositoryThemes(); $plugins = $this->getRepositoryPlugins(); if (!$themes && !$plugins) { if (!is_writable(ROOT_DIR . '/cache/gpm')) { throw new \RuntimeException("The cache/gpm folder is not writable. Please check the folder permissions."); } if ($ignore_exception) { return false; } throw new \RuntimeException("GPM not reachable. Please check your internet connection or check the Grav site is reachable"); } if ($themes) { foreach ($themes as $slug => $theme) { if ($search == $slug || $search == $theme->name) { return $theme; } } } if ($plugins) { foreach ($plugins as $slug => $plugin) { if ($search == $slug || $search == $plugin->name) { return $plugin; } } } return false; }
[ "public", "function", "findPackage", "(", "$", "search", ",", "$", "ignore_exception", "=", "false", ")", "{", "$", "search", "=", "strtolower", "(", "$", "search", ")", ";", "$", "found", "=", "$", "this", "->", "getRepositoryTheme", "(", "$", "search",...
Searches for a Package in the repository @param string $search Can be either the slug or the name @param bool $ignore_exception True if should not fire an exception (for use in Twig) @return Remote\Package|bool Package if found, FALSE if not
[ "Searches", "for", "a", "Package", "in", "the", "repository" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L457-L503
train
Find a package by slug
[ 30522, 2270, 3853, 2424, 23947, 4270, 1006, 1002, 3945, 1010, 1002, 8568, 1035, 6453, 1027, 6270, 1007, 1063, 1002, 3945, 1027, 2358, 5339, 12898, 13777, 1006, 1002, 3945, 1007, 1025, 1002, 2179, 1027, 1002, 2023, 1011, 1028, 2131, 2890, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/Grammar.php
Grammar.compileForeign
public function compileForeign(Blueprint $blueprint, Fluent $command) { // We need to prepare several of the elements of the foreign key definition // before we can create the SQL, such as wrapping the tables and convert // an array of columns to comma-delimited strings for the SQL queries. $sql = sprintf('alter table %s add constraint %s ', $this->wrapTable($blueprint), $this->wrap($command->index) ); // Once we have the initial portion of the SQL statement we will add on the // key name, table name, and referenced columns. These will complete the // main portion of the SQL statement and this SQL will almost be done. $sql .= sprintf('foreign key (%s) references %s (%s)', $this->columnize($command->columns), $this->wrapTable($command->on), $this->columnize((array) $command->references) ); // Once we have the basic foreign key creation statement constructed we can // build out the syntax for what should happen on an update or delete of // the affected columns, which will get something like "cascade", etc. if (! is_null($command->onDelete)) { $sql .= " on delete {$command->onDelete}"; } if (! is_null($command->onUpdate)) { $sql .= " on update {$command->onUpdate}"; } return $sql; }
php
public function compileForeign(Blueprint $blueprint, Fluent $command) { // We need to prepare several of the elements of the foreign key definition // before we can create the SQL, such as wrapping the tables and convert // an array of columns to comma-delimited strings for the SQL queries. $sql = sprintf('alter table %s add constraint %s ', $this->wrapTable($blueprint), $this->wrap($command->index) ); // Once we have the initial portion of the SQL statement we will add on the // key name, table name, and referenced columns. These will complete the // main portion of the SQL statement and this SQL will almost be done. $sql .= sprintf('foreign key (%s) references %s (%s)', $this->columnize($command->columns), $this->wrapTable($command->on), $this->columnize((array) $command->references) ); // Once we have the basic foreign key creation statement constructed we can // build out the syntax for what should happen on an update or delete of // the affected columns, which will get something like "cascade", etc. if (! is_null($command->onDelete)) { $sql .= " on delete {$command->onDelete}"; } if (! is_null($command->onUpdate)) { $sql .= " on update {$command->onUpdate}"; } return $sql; }
[ "public", "function", "compileForeign", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "command", ")", "{", "// We need to prepare several of the elements of the foreign key definition", "// before we can create the SQL, such as wrapping the tables and convert", "// an array o...
Compile a foreign key command. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $command @return string
[ "Compile", "a", "foreign", "key", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/Grammar.php#L65-L96
train
Compiles the foreign key definition
[ 30522, 2270, 3853, 4012, 22090, 29278, 7416, 16206, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 3094, 1007, 1063, 1013, 1013, 2057, 2342, 2000, 7374, 2195, 1997, 1996, 3787, 1997, 1996, 3097, 3145, 6210, 1013, 1013, 2077, 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...
dompdf/dompdf
src/Css/AttributeTranslator.php
AttributeTranslator._set_table_cellpadding
static protected function _set_table_cellpadding(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "; padding: {$value}px;"); } return null; }
php
static protected function _set_table_cellpadding(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { self::append_style($cell, "; padding: {$value}px;"); } return null; }
[ "static", "protected", "function", "_set_table_cellpadding", "(", "\\", "DOMElement", "$", "node", ",", "$", "value", ")", "{", "$", "cell_list", "=", "self", "::", "get_cell_list", "(", "$", "node", ")", ";", "foreach", "(", "$", "cell_list", "as", "$", ...
@param \DOMElement $node @param string $value @return null
[ "@param", "\\", "DOMElement", "$node", "@param", "string", "$value" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/AttributeTranslator.php#L361-L370
train
Set Table cell padding
[ 30522, 10763, 5123, 3853, 1035, 2275, 1035, 2795, 1035, 3526, 15455, 4667, 1006, 1032, 8514, 16930, 4765, 1002, 13045, 1010, 1002, 3643, 1007, 1063, 1002, 3526, 1035, 2862, 1027, 2969, 1024, 1024, 2131, 1035, 3526, 1035, 2862, 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...
guzzle/guzzle
src/Pool.php
Pool.batch
public static function batch( ClientInterface $client, $requests, array $options = [] ) { $res = []; self::cmpCallback($options, 'fulfilled', $res); self::cmpCallback($options, 'rejected', $res); $pool = new static($client, $requests, $options); $pool->promise()->wait(); ksort($res); return $res; }
php
public static function batch( ClientInterface $client, $requests, array $options = [] ) { $res = []; self::cmpCallback($options, 'fulfilled', $res); self::cmpCallback($options, 'rejected', $res); $pool = new static($client, $requests, $options); $pool->promise()->wait(); ksort($res); return $res; }
[ "public", "static", "function", "batch", "(", "ClientInterface", "$", "client", ",", "$", "requests", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "res", "=", "[", "]", ";", "self", "::", "cmpCallback", "(", "$", "options", ",", "'fulf...
Sends multiple requests concurrently and returns an array of responses and exceptions that uses the same ordering as the provided requests. IMPORTANT: This method keeps every request and response in memory, and as such, is NOT recommended when sending a large number or an indeterminate number of requests concurrently. @param ClientInterface $client Client used to send the requests @param array|\Iterator $requests Requests to send concurrently. @param array $options Passes through the options available in {@see GuzzleHttp\Pool::__construct} @return array Returns an array containing the response or an exception in the same order that the requests were sent. @throws \InvalidArgumentException if the event format is incorrect.
[ "Sends", "multiple", "requests", "concurrently", "and", "returns", "an", "array", "of", "responses", "and", "exceptions", "that", "uses", "the", "same", "ordering", "as", "the", "provided", "requests", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Pool.php#L94-L107
train
Batch request to cache
[ 30522, 2270, 10763, 3853, 14108, 1006, 7396, 18447, 2121, 12172, 1002, 7396, 1010, 1002, 11186, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 24501, 1027, 1031, 1033, 1025, 2969, 1024, 1024, 4642, 15042, 8095, 5963, 1006, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Translation/Transifex/API.php
API.getAvailableLanguageCodes
public function getAvailableLanguageCodes() { $cache = Cache::getTransientCache(); $cacheId = 'transifex_languagescodes_' . $this->projectSlug; $languageCodes = $cache->fetch($cacheId); if (empty($languageCodes)) { $apiData = $this->getApiResults('project/' . $this->projectSlug . '/languages'); foreach ($apiData as $languageData) { $languageCodes[] = $languageData->language_code; } $cache->save($cacheId, $languageCodes); } return $languageCodes; }
php
public function getAvailableLanguageCodes() { $cache = Cache::getTransientCache(); $cacheId = 'transifex_languagescodes_' . $this->projectSlug; $languageCodes = $cache->fetch($cacheId); if (empty($languageCodes)) { $apiData = $this->getApiResults('project/' . $this->projectSlug . '/languages'); foreach ($apiData as $languageData) { $languageCodes[] = $languageData->language_code; } $cache->save($cacheId, $languageCodes); } return $languageCodes; }
[ "public", "function", "getAvailableLanguageCodes", "(", ")", "{", "$", "cache", "=", "Cache", "::", "getTransientCache", "(", ")", ";", "$", "cacheId", "=", "'transifex_languagescodes_'", ".", "$", "this", "->", "projectSlug", ";", "$", "languageCodes", "=", "...
Returns all language codes the transifex project is available for @return array @throws AuthenticationFailedException @throws Exception
[ "Returns", "all", "language", "codes", "the", "transifex", "project", "is", "available", "for" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Translation/Transifex/API.php#L74-L88
train
Get available language codes
[ 30522, 2270, 3853, 2131, 12462, 11733, 3468, 25023, 6692, 3351, 23237, 1006, 1007, 1063, 1002, 17053, 1027, 17053, 1024, 1024, 2131, 6494, 3619, 11638, 3540, 5403, 1006, 1007, 1025, 1002, 17053, 3593, 1027, 1005, 9099, 29323, 2595, 1035, 41...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RawLogDao.php
RawLogDao.createLogIterationQuery
private function createLogIterationQuery($logTable, $idField, $fields, $conditions, $iterationStep) { $bind = array(); $sql = "SELECT " . implode(', ', $fields) . " FROM `" . Common::prefixTable($logTable) . "` WHERE $idField > ?"; foreach ($conditions as $condition) { list($column, $operator, $value) = $condition; if (is_array($value)) { $sql .= " AND $column IN (" . Common::getSqlStringFieldsArray($value) . ")"; $bind = array_merge($bind, $value); } else { $sql .= " AND $column $operator ?"; $bind[] = $value; } } $sql .= " ORDER BY $idField ASC LIMIT " . (int)$iterationStep; return array($sql, $bind); }
php
private function createLogIterationQuery($logTable, $idField, $fields, $conditions, $iterationStep) { $bind = array(); $sql = "SELECT " . implode(', ', $fields) . " FROM `" . Common::prefixTable($logTable) . "` WHERE $idField > ?"; foreach ($conditions as $condition) { list($column, $operator, $value) = $condition; if (is_array($value)) { $sql .= " AND $column IN (" . Common::getSqlStringFieldsArray($value) . ")"; $bind = array_merge($bind, $value); } else { $sql .= " AND $column $operator ?"; $bind[] = $value; } } $sql .= " ORDER BY $idField ASC LIMIT " . (int)$iterationStep; return array($sql, $bind); }
[ "private", "function", "createLogIterationQuery", "(", "$", "logTable", ",", "$", "idField", ",", "$", "fields", ",", "$", "conditions", ",", "$", "iterationStep", ")", "{", "$", "bind", "=", "array", "(", ")", ";", "$", "sql", "=", "\"SELECT \"", ".", ...
mapping for dimensions => segments, and each dimension should automatically have a segment.
[ "mapping", "for", "dimensions", "=", ">", "segments", "and", "each", "dimension", "should", "automatically", "have", "a", "segment", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/RawLogDao.php#L249-L272
train
Creates the SQL query for the log iteration
[ 30522, 2797, 3853, 3443, 21197, 21646, 3370, 4226, 2854, 1006, 1002, 8833, 10880, 1010, 1002, 24011, 12891, 1010, 1002, 4249, 1010, 1002, 3785, 1010, 1002, 27758, 13473, 2361, 1007, 1063, 1002, 14187, 1027, 9140, 1006, 1007, 1025, 1002, 292...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RecursiveFolderFilterIterator.php
RecursiveFolderFilterIterator.accept
public function accept() { /** @var \SplFileInfo $current */ $current = $this->current(); return $current->isDir() && !in_array($current->getFilename(), $this::$ignore_folders, true); }
php
public function accept() { /** @var \SplFileInfo $current */ $current = $this->current(); return $current->isDir() && !in_array($current->getFilename(), $this::$ignore_folders, true); }
[ "public", "function", "accept", "(", ")", "{", "/** @var \\SplFileInfo $current */", "$", "current", "=", "$", "this", "->", "current", "(", ")", ";", "return", "$", "current", "->", "isDir", "(", ")", "&&", "!", "in_array", "(", "$", "current", "->", "g...
Check whether the current element of the iterator is acceptable @return bool true if the current element is acceptable, otherwise false.
[ "Check", "whether", "the", "current", "element", "of", "the", "iterator", "is", "acceptable" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php#L40-L46
train
Accept the current directory
[ 30522, 2270, 3853, 5138, 1006, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 1032, 11867, 10270, 9463, 2378, 14876, 1002, 2783, 1008, 1013, 1002, 2783, 1027, 1002, 2023, 1011, 1028, 2783, 1006, 1007, 1025, 2709, 1002, 2783, 1011, 1028, 2003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Router.php
Router.actionReferencesController
protected function actionReferencesController($action) { if (! $action instanceof Closure) { return is_string($action) || (isset($action['uses']) && is_string($action['uses'])); } return false; }
php
protected function actionReferencesController($action) { if (! $action instanceof Closure) { return is_string($action) || (isset($action['uses']) && is_string($action['uses'])); } return false; }
[ "protected", "function", "actionReferencesController", "(", "$", "action", ")", "{", "if", "(", "!", "$", "action", "instanceof", "Closure", ")", "{", "return", "is_string", "(", "$", "action", ")", "||", "(", "isset", "(", "$", "action", "[", "'uses'", ...
Determine if the action is routing to a controller. @param array $action @return bool
[ "Determine", "if", "the", "action", "is", "routing", "to", "a", "controller", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L487-L494
train
Checks if the action references a controller
[ 30522, 5123, 3853, 2895, 2890, 25523, 9363, 3372, 26611, 1006, 1002, 2895, 1007, 1063, 2065, 1006, 999, 30524, 2003, 1035, 5164, 1006, 1002, 2895, 1031, 1005, 3594, 1005, 1033, 1007, 1007, 1025, 1065, 2709, 6270, 1025, 1065, 102, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Intl.php
Intl.getLanguageBundle
public static function getLanguageBundle() { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" or "%s" instead.', __METHOD__, Languages::class, Scripts::class), E_USER_DEPRECATED); if (null === self::$languageBundle) { self::$languageBundle = new LanguageBundle( self::getDataDirectory().'/'.self::LANGUAGE_DIR, self::getEntryReader(), self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader()), new ScriptDataProvider( self::getDataDirectory().'/'.self::SCRIPT_DIR, self::getEntryReader() ) ); } return self::$languageBundle; }
php
public static function getLanguageBundle() { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" or "%s" instead.', __METHOD__, Languages::class, Scripts::class), E_USER_DEPRECATED); if (null === self::$languageBundle) { self::$languageBundle = new LanguageBundle( self::getDataDirectory().'/'.self::LANGUAGE_DIR, self::getEntryReader(), self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader()), new ScriptDataProvider( self::getDataDirectory().'/'.self::SCRIPT_DIR, self::getEntryReader() ) ); } return self::$languageBundle; }
[ "public", "static", "function", "getLanguageBundle", "(", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The method \"%s()\" is deprecated since Symfony 4.3, use \"%s\" or \"%s\" instead.'", ",", "__METHOD__", ",", "Languages", "::", "class", ",", "Scripts", "::", ...
Returns the bundle containing language information. @return LanguageBundleInterface The language resource bundle @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Languages} or {@see Scripts} instead.
[ "Returns", "the", "bundle", "containing", "language", "information", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Intl.php#L146-L163
train
Returns the language bundle
[ 30522, 2270, 10763, 3853, 2131, 25023, 6692, 3351, 27265, 2571, 1006, 1007, 1063, 1030, 9495, 1035, 7561, 1006, 9043, 2546, 1006, 1005, 1996, 4118, 1000, 1003, 1055, 1006, 1007, 1000, 2003, 2139, 28139, 12921, 2144, 25353, 2213, 14876, 4890...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ZendPlatform.php
Zend_Cache_Backend_ZendPlatform._clean
private function _clean($dir, $mode) { $d = @dir($dir); if (!$d) { return false; } $result = true; while (false !== ($file = $d->read())) { if ($file == '.' || $file == '..') { continue; } $file = $d->path . $file; if (is_dir($file)) { $result = ($this->_clean($file .'/', $mode)) && ($result); } else { if ($mode == Zend_Cache::CLEANING_MODE_ALL) { $result = ($this->_remove($file)) && ($result); } else if ($mode == Zend_Cache::CLEANING_MODE_OLD) { // Files older than lifetime get deleted from cache if ($this->_directives['lifetime'] !== null) { if ((time() - @filemtime($file)) > $this->_directives['lifetime']) { $result = ($this->_remove($file)) && ($result); } } } } } $d->close(); return $result; }
php
private function _clean($dir, $mode) { $d = @dir($dir); if (!$d) { return false; } $result = true; while (false !== ($file = $d->read())) { if ($file == '.' || $file == '..') { continue; } $file = $d->path . $file; if (is_dir($file)) { $result = ($this->_clean($file .'/', $mode)) && ($result); } else { if ($mode == Zend_Cache::CLEANING_MODE_ALL) { $result = ($this->_remove($file)) && ($result); } else if ($mode == Zend_Cache::CLEANING_MODE_OLD) { // Files older than lifetime get deleted from cache if ($this->_directives['lifetime'] !== null) { if ((time() - @filemtime($file)) > $this->_directives['lifetime']) { $result = ($this->_remove($file)) && ($result); } } } } } $d->close(); return $result; }
[ "private", "function", "_clean", "(", "$", "dir", ",", "$", "mode", ")", "{", "$", "d", "=", "@", "dir", "(", "$", "dir", ")", ";", "if", "(", "!", "$", "d", ")", "{", "return", "false", ";", "}", "$", "result", "=", "true", ";", "while", "...
Clean a directory and recursivly go over it's subdirectories Remove all the cached files that need to be cleaned (according to mode and files mtime) @param string $dir Path of directory ot clean @param string $mode The same parameter as in Zend_Cache_Backend_ZendPlatform::clean() @return boolean True if ok
[ "Clean", "a", "directory", "and", "recursivly", "go", "over", "it", "s", "subdirectories" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/ZendPlatform.php#L260-L289
train
Recursive function to clean directory
[ 30522, 2797, 3853, 1035, 4550, 1006, 1002, 16101, 1010, 1002, 5549, 1007, 1063, 1002, 1040, 1027, 1030, 16101, 1006, 1002, 16101, 1007, 1025, 2065, 1006, 999, 1002, 1040, 1007, 1063, 2709, 6270, 1025, 1065, 1002, 2765, 1027, 2995, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Widgets/Widget.php
Widget.formatAttributes
public function formatAttributes() { $html = []; foreach ((array) $this->getAttributes() as $key => $value) { $element = $this->attributeElement($key, $value); if (!is_null($element)) { $html[] = $element; } } return count($html) > 0 ? ' '.implode(' ', $html) : ''; }
php
public function formatAttributes() { $html = []; foreach ((array) $this->getAttributes() as $key => $value) { $element = $this->attributeElement($key, $value); if (!is_null($element)) { $html[] = $element; } } return count($html) > 0 ? ' '.implode(' ', $html) : ''; }
[ "public", "function", "formatAttributes", "(", ")", "{", "$", "html", "=", "[", "]", ";", "foreach", "(", "(", "array", ")", "$", "this", "->", "getAttributes", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "element", "=", "$", "...
Build an HTML attribute string from an array. @return string
[ "Build", "an", "HTML", "attribute", "string", "from", "an", "array", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Widget.php#L34-L45
train
Format attributes to string
[ 30522, 2270, 3853, 4289, 19321, 3089, 8569, 4570, 1006, 1007, 1063, 1002, 16129, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1006, 9140, 1007, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 4570, 1006, 1007, 2004, 1002, 3145, 1027, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php
MethodMarkingStore.getMarking
public function getMarking($subject) { $method = 'get'.ucfirst($this->property); if (!method_exists($subject, $method)) { throw new LogicException(sprintf('The method "%s::%s()" does not exists.', \get_class($subject), $method)); } $marking = $subject->{$method}(); if (!$marking) { return new Marking(); } if ($this->singleState) { $marking = [$marking => 1]; } return new Marking($marking); }
php
public function getMarking($subject) { $method = 'get'.ucfirst($this->property); if (!method_exists($subject, $method)) { throw new LogicException(sprintf('The method "%s::%s()" does not exists.', \get_class($subject), $method)); } $marking = $subject->{$method}(); if (!$marking) { return new Marking(); } if ($this->singleState) { $marking = [$marking => 1]; } return new Marking($marking); }
[ "public", "function", "getMarking", "(", "$", "subject", ")", "{", "$", "method", "=", "'get'", ".", "ucfirst", "(", "$", "this", "->", "property", ")", ";", "if", "(", "!", "method_exists", "(", "$", "subject", ",", "$", "method", ")", ")", "{", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php#L49-L68
train
Get the marking for the subject
[ 30522, 2270, 3853, 2131, 10665, 2075, 1006, 1002, 3395, 1007, 1063, 1002, 4118, 1027, 1005, 2131, 1005, 1012, 15384, 8873, 12096, 1006, 1002, 2023, 1011, 1028, 3200, 1007, 1025, 2065, 1006, 999, 4118, 1035, 6526, 1006, 1002, 3395, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/User/ServiceProvider.php
ServiceProvider.register
public function register(Container $app) { $app['user'] = function ($app) { return new UserClient($app); }; $app['user_tag'] = function ($app) { return new TagClient($app); }; }
php
public function register(Container $app) { $app['user'] = function ($app) { return new UserClient($app); }; $app['user_tag'] = function ($app) { return new TagClient($app); }; }
[ "public", "function", "register", "(", "Container", "$", "app", ")", "{", "$", "app", "[", "'user'", "]", "=", "function", "(", "$", "app", ")", "{", "return", "new", "UserClient", "(", "$", "app", ")", ";", "}", ";", "$", "app", "[", "'user_tag'",...
{@inheritdoc}.
[ "{" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/User/ServiceProvider.php#L25-L34
train
Register the user and tag clients
[ 30522, 2270, 3853, 4236, 1006, 11661, 1002, 10439, 1007, 1063, 1002, 10439, 1031, 1005, 5310, 1005, 1033, 1027, 3853, 1006, 1002, 10439, 1007, 1063, 2709, 2047, 5310, 20464, 11638, 1006, 1002, 10439, 1007, 1025, 1065, 1025, 1002, 10439, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreAdminHome/API.php
API.runCronArchiving
public function runCronArchiving() { Piwik::checkUserHasSuperUserAccess(); // HTTP request: logs needs to be dumped in the HTTP response (on top of existing log destinations) /** @var \Monolog\Logger $logger */ $logger = StaticContainer::get('Psr\Log\LoggerInterface'); $handler = new StreamHandler('php://output', Logger::INFO); $handler->setFormatter(StaticContainer::get('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')); $logger->pushHandler($handler); $archiver = new CronArchive(); $archiver->main(); }
php
public function runCronArchiving() { Piwik::checkUserHasSuperUserAccess(); // HTTP request: logs needs to be dumped in the HTTP response (on top of existing log destinations) /** @var \Monolog\Logger $logger */ $logger = StaticContainer::get('Psr\Log\LoggerInterface'); $handler = new StreamHandler('php://output', Logger::INFO); $handler->setFormatter(StaticContainer::get('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')); $logger->pushHandler($handler); $archiver = new CronArchive(); $archiver->main(); }
[ "public", "function", "runCronArchiving", "(", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "// HTTP request: logs needs to be dumped in the HTTP response (on top of existing log destinations)", "/** @var \\Monolog\\Logger $logger */", "$", "logger", "=", ...
Initiates cron archiving via web request. @hideExceptForSuperUser
[ "Initiates", "cron", "archiving", "via", "web", "request", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/API.php#L175-L188
train
Runs the cron archiving process
[ 30522, 2270, 3853, 2448, 26775, 7856, 11140, 14966, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1025, 1013, 1013, 8299, 5227, 1024, 15664, 3791, 2000, 2022, 14019, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Data/Blueprint.php
Blueprint.extra
public function extra(array $data, $prefix = '') { $this->initInternals(); return $this->blueprintSchema->extra($data, $prefix); }
php
public function extra(array $data, $prefix = '') { $this->initInternals(); return $this->blueprintSchema->extra($data, $prefix); }
[ "public", "function", "extra", "(", "array", "$", "data", ",", "$", "prefix", "=", "''", ")", "{", "$", "this", "->", "initInternals", "(", ")", ";", "return", "$", "this", "->", "blueprintSchema", "->", "extra", "(", "$", "data", ",", "$", "prefix",...
Return data fields that do not exist in blueprints. @param array $data @param string $prefix @return array
[ "Return", "data", "fields", "that", "do", "not", "exist", "in", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprint.php#L164-L169
train
Extra data for the blueprint
[ 30522, 2270, 3853, 4469, 1006, 9140, 1002, 2951, 1010, 1002, 17576, 1027, 1005, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 1999, 25090, 10111, 12789, 4877, 1006, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 2630, 16550, 22842, 2863, 1011, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/models/User.php
User.sendInvitation
public function sendInvitation() { $data = [ 'name' => $this->full_name, 'login' => $this->login, 'password' => $this->getOriginalHashValue('password'), 'link' => Backend::url('backend'), ]; Mail::send('backend::mail.invite', $data, function ($message) { $message->to($this->email, $this->full_name); }); }
php
public function sendInvitation() { $data = [ 'name' => $this->full_name, 'login' => $this->login, 'password' => $this->getOriginalHashValue('password'), 'link' => Backend::url('backend'), ]; Mail::send('backend::mail.invite', $data, function ($message) { $message->to($this->email, $this->full_name); }); }
[ "public", "function", "sendInvitation", "(", ")", "{", "$", "data", "=", "[", "'name'", "=>", "$", "this", "->", "full_name", ",", "'login'", "=>", "$", "this", "->", "login", ",", "'password'", "=>", "$", "this", "->", "getOriginalHashValue", "(", "'pas...
Sends an invitation to the user using template "backend::mail.invite". @return void
[ "Sends", "an", "invitation", "to", "the", "user", "using", "template", "backend", "::", "mail", ".", "invite", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/User.php#L146-L158
train
Send invite email
[ 30522, 2270, 3853, 4604, 2378, 28403, 3508, 1006, 1007, 1063, 1002, 2951, 1027, 1031, 1005, 2171, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 2440, 1035, 2171, 1010, 1005, 8833, 2378, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 8833, 2378, 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/Twig.php
Twig.init
public function init() { if (null === $this->twig) { /** @var Config $config */ $config = $this->grav['config']; /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; /** @var Language $language */ $language = $this->grav['language']; $active_language = $language->getActive(); // handle language templates if available if ($language->enabled()) { $lang_templates = $locator->findResource('theme://templates/' . ($active_language ? $active_language : $language->getDefault())); if ($lang_templates) { $this->twig_paths[] = $lang_templates; } } $this->twig_paths = array_merge($this->twig_paths, $locator->findResources('theme://templates')); $this->grav->fireEvent('onTwigTemplatePaths'); // Add Grav core templates location $core_templates = array_merge($locator->findResources('system://templates'), $locator->findResources('system://templates/testing')); $this->twig_paths = array_merge($this->twig_paths, $core_templates); $this->loader = new \Twig_Loader_Filesystem($this->twig_paths); // Register all other prefixes as namespaces in twig foreach ($locator->getPaths('theme') as $prefix => $_) { if ($prefix === '') { continue; } $twig_paths = []; // handle language templates if available if ($language->enabled()) { $lang_templates = $locator->findResource('theme://'.$prefix.'templates/' . ($active_language ? $active_language : $language->getDefault())); if ($lang_templates) { $twig_paths[] = $lang_templates; } } $twig_paths = array_merge($twig_paths, $locator->findResources('theme://'.$prefix.'templates')); $namespace = trim($prefix, '/'); $this->loader->setPaths($twig_paths, $namespace); } $this->grav->fireEvent('onTwigLoader'); $this->loaderArray = new \Twig_Loader_Array([]); $loader_chain = new \Twig_Loader_Chain([$this->loaderArray, $this->loader]); $params = $config->get('system.twig'); if (!empty($params['cache'])) { $cachePath = $locator->findResource('cache://twig', true, true); $params['cache'] = new \Twig_Cache_Filesystem($cachePath, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION); } if (!$config->get('system.strict_mode.twig_compat', true)) { // Force autoescape on for all files if in strict mode. $params['autoescape'] = 'html'; } elseif (!empty($this->autoescape)) { $params['autoescape'] = $this->autoescape ? 'html' : false; } if (empty($params['autoescape'])) { user_error('Grav 2.0 will have Twig auto-escaping forced on (can be emulated by turning off \'system.strict_mode.twig_compat\' setting in your configuration)', E_USER_DEPRECATED); } $this->twig = new TwigEnvironment($loader_chain, $params); if ($config->get('system.twig.undefined_functions')) { $this->twig->registerUndefinedFunctionCallback(function ($name) { if (function_exists($name)) { return new \Twig_SimpleFunction($name, $name); } return new \Twig_SimpleFunction($name, function () { }); }); } if ($config->get('system.twig.undefined_filters')) { $this->twig->registerUndefinedFilterCallback(function ($name) { if (function_exists($name)) { return new \Twig_SimpleFilter($name, $name); } return new \Twig_SimpleFilter($name, function () { }); }); } $this->grav->fireEvent('onTwigInitialized'); // set default date format if set in config if ($config->get('system.pages.dateformat.long')) { /** @var \Twig_Extension_Core $extension */ $extension = $this->twig->getExtension('Twig_Extension_Core'); $extension->setDateFormat($config->get('system.pages.dateformat.long')); } // enable the debug extension if required if ($config->get('system.twig.debug')) { $this->twig->addExtension(new \Twig_Extension_Debug()); } $this->twig->addExtension(new TwigExtension()); $this->twig->addExtension(new DeferredExtension()); $this->grav->fireEvent('onTwigExtensions'); /** @var Pages $pages */ $pages = $this->grav['pages']; // Set some standard variables for twig $this->twig_vars += [ 'config' => $config, 'system' => $config->get('system'), 'theme' => $config->get('theme'), 'site' => $config->get('site'), 'uri' => $this->grav['uri'], 'assets' => $this->grav['assets'], 'taxonomy' => $this->grav['taxonomy'], 'browser' => $this->grav['browser'], 'base_dir' => rtrim(ROOT_DIR, '/'), 'home_url' => $pages->homeUrl($active_language), 'base_url' => $pages->baseUrl($active_language), 'base_url_absolute' => $pages->baseUrl($active_language, true), 'base_url_relative' => $pages->baseUrl($active_language, false), 'base_url_simple' => $this->grav['base_url'], 'theme_dir' => $locator->findResource('theme://'), 'theme_url' => $this->grav['base_url'] . '/' . $locator->findResource('theme://', false), 'html_lang' => $this->grav['language']->getActive() ?: $config->get('site.default_lang', 'en'), 'language_codes' => new LanguageCodes, ]; } return $this; }
php
public function init() { if (null === $this->twig) { /** @var Config $config */ $config = $this->grav['config']; /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; /** @var Language $language */ $language = $this->grav['language']; $active_language = $language->getActive(); // handle language templates if available if ($language->enabled()) { $lang_templates = $locator->findResource('theme://templates/' . ($active_language ? $active_language : $language->getDefault())); if ($lang_templates) { $this->twig_paths[] = $lang_templates; } } $this->twig_paths = array_merge($this->twig_paths, $locator->findResources('theme://templates')); $this->grav->fireEvent('onTwigTemplatePaths'); // Add Grav core templates location $core_templates = array_merge($locator->findResources('system://templates'), $locator->findResources('system://templates/testing')); $this->twig_paths = array_merge($this->twig_paths, $core_templates); $this->loader = new \Twig_Loader_Filesystem($this->twig_paths); // Register all other prefixes as namespaces in twig foreach ($locator->getPaths('theme') as $prefix => $_) { if ($prefix === '') { continue; } $twig_paths = []; // handle language templates if available if ($language->enabled()) { $lang_templates = $locator->findResource('theme://'.$prefix.'templates/' . ($active_language ? $active_language : $language->getDefault())); if ($lang_templates) { $twig_paths[] = $lang_templates; } } $twig_paths = array_merge($twig_paths, $locator->findResources('theme://'.$prefix.'templates')); $namespace = trim($prefix, '/'); $this->loader->setPaths($twig_paths, $namespace); } $this->grav->fireEvent('onTwigLoader'); $this->loaderArray = new \Twig_Loader_Array([]); $loader_chain = new \Twig_Loader_Chain([$this->loaderArray, $this->loader]); $params = $config->get('system.twig'); if (!empty($params['cache'])) { $cachePath = $locator->findResource('cache://twig', true, true); $params['cache'] = new \Twig_Cache_Filesystem($cachePath, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION); } if (!$config->get('system.strict_mode.twig_compat', true)) { // Force autoescape on for all files if in strict mode. $params['autoescape'] = 'html'; } elseif (!empty($this->autoescape)) { $params['autoescape'] = $this->autoescape ? 'html' : false; } if (empty($params['autoescape'])) { user_error('Grav 2.0 will have Twig auto-escaping forced on (can be emulated by turning off \'system.strict_mode.twig_compat\' setting in your configuration)', E_USER_DEPRECATED); } $this->twig = new TwigEnvironment($loader_chain, $params); if ($config->get('system.twig.undefined_functions')) { $this->twig->registerUndefinedFunctionCallback(function ($name) { if (function_exists($name)) { return new \Twig_SimpleFunction($name, $name); } return new \Twig_SimpleFunction($name, function () { }); }); } if ($config->get('system.twig.undefined_filters')) { $this->twig->registerUndefinedFilterCallback(function ($name) { if (function_exists($name)) { return new \Twig_SimpleFilter($name, $name); } return new \Twig_SimpleFilter($name, function () { }); }); } $this->grav->fireEvent('onTwigInitialized'); // set default date format if set in config if ($config->get('system.pages.dateformat.long')) { /** @var \Twig_Extension_Core $extension */ $extension = $this->twig->getExtension('Twig_Extension_Core'); $extension->setDateFormat($config->get('system.pages.dateformat.long')); } // enable the debug extension if required if ($config->get('system.twig.debug')) { $this->twig->addExtension(new \Twig_Extension_Debug()); } $this->twig->addExtension(new TwigExtension()); $this->twig->addExtension(new DeferredExtension()); $this->grav->fireEvent('onTwigExtensions'); /** @var Pages $pages */ $pages = $this->grav['pages']; // Set some standard variables for twig $this->twig_vars += [ 'config' => $config, 'system' => $config->get('system'), 'theme' => $config->get('theme'), 'site' => $config->get('site'), 'uri' => $this->grav['uri'], 'assets' => $this->grav['assets'], 'taxonomy' => $this->grav['taxonomy'], 'browser' => $this->grav['browser'], 'base_dir' => rtrim(ROOT_DIR, '/'), 'home_url' => $pages->homeUrl($active_language), 'base_url' => $pages->baseUrl($active_language), 'base_url_absolute' => $pages->baseUrl($active_language, true), 'base_url_relative' => $pages->baseUrl($active_language, false), 'base_url_simple' => $this->grav['base_url'], 'theme_dir' => $locator->findResource('theme://'), 'theme_url' => $this->grav['base_url'] . '/' . $locator->findResource('theme://', false), 'html_lang' => $this->grav['language']->getActive() ?: $config->get('site.default_lang', 'en'), 'language_codes' => new LanguageCodes, ]; } return $this; }
[ "public", "function", "init", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "twig", ")", "{", "/** @var Config $config */", "$", "config", "=", "$", "this", "->", "grav", "[", "'config'", "]", ";", "/** @var UniformResourceLocator $locator */", ...
Twig initialization that sets the twig loader chain, then the environment, then extensions and also the base set of twig vars
[ "Twig", "initialization", "that", "sets", "the", "twig", "loader", "chain", "then", "the", "environment", "then", "extensions", "and", "also", "the", "base", "set", "of", "twig", "vars" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/Twig.php#L77-L219
train
Initializes the twig environment
[ 30522, 2270, 3853, 1999, 4183, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 1056, 16279, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 9530, 8873, 2290, 1002, 9530, 8873, 2290, 1008, 1013, 1002, 9530, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
AbstractDoctrineExtension.registerMappingDrivers
protected function registerMappingDrivers($objectManager, ContainerBuilder $container) { // configure metadata driver for each bundle based on the type of mapping files found if ($container->hasDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'))) { $chainDriverDef = $container->getDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver')); } else { $chainDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.driver_chain.class%')); $chainDriverDef->setPublic(false); } foreach ($this->drivers as $driverType => $driverPaths) { $mappingService = $this->getObjectManagerElementName($objectManager['name'].'_'.$driverType.'_metadata_driver'); if ($container->hasDefinition($mappingService)) { $mappingDriverDef = $container->getDefinition($mappingService); $args = $mappingDriverDef->getArguments(); if ('annotation' == $driverType) { $args[1] = array_merge(array_values($driverPaths), $args[1]); } else { $args[0] = array_merge(array_values($driverPaths), $args[0]); } $mappingDriverDef->setArguments($args); } elseif ('annotation' == $driverType) { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [ new Reference($this->getObjectManagerElementName('metadata.annotation_reader')), array_values($driverPaths), ]); } else { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [ array_values($driverPaths), ]); } $mappingDriverDef->setPublic(false); if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) { $mappingDriverDef->setArguments([array_flip($driverPaths)]); $mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']); } $container->setDefinition($mappingService, $mappingDriverDef); foreach ($driverPaths as $prefix => $driverPath) { $chainDriverDef->addMethodCall('addDriver', [new Reference($mappingService), $prefix]); } } $container->setDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'), $chainDriverDef); }
php
protected function registerMappingDrivers($objectManager, ContainerBuilder $container) { // configure metadata driver for each bundle based on the type of mapping files found if ($container->hasDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'))) { $chainDriverDef = $container->getDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver')); } else { $chainDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.driver_chain.class%')); $chainDriverDef->setPublic(false); } foreach ($this->drivers as $driverType => $driverPaths) { $mappingService = $this->getObjectManagerElementName($objectManager['name'].'_'.$driverType.'_metadata_driver'); if ($container->hasDefinition($mappingService)) { $mappingDriverDef = $container->getDefinition($mappingService); $args = $mappingDriverDef->getArguments(); if ('annotation' == $driverType) { $args[1] = array_merge(array_values($driverPaths), $args[1]); } else { $args[0] = array_merge(array_values($driverPaths), $args[0]); } $mappingDriverDef->setArguments($args); } elseif ('annotation' == $driverType) { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [ new Reference($this->getObjectManagerElementName('metadata.annotation_reader')), array_values($driverPaths), ]); } else { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [ array_values($driverPaths), ]); } $mappingDriverDef->setPublic(false); if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) { $mappingDriverDef->setArguments([array_flip($driverPaths)]); $mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']); } $container->setDefinition($mappingService, $mappingDriverDef); foreach ($driverPaths as $prefix => $driverPath) { $chainDriverDef->addMethodCall('addDriver', [new Reference($mappingService), $prefix]); } } $container->setDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'), $chainDriverDef); }
[ "protected", "function", "registerMappingDrivers", "(", "$", "objectManager", ",", "ContainerBuilder", "$", "container", ")", "{", "// configure metadata driver for each bundle based on the type of mapping files found", "if", "(", "$", "container", "->", "hasDefinition", "(", ...
Register all the collected mapping information with the object manager by registering the appropriate mapping drivers. @param array $objectManager @param ContainerBuilder $container A ContainerBuilder instance
[ "Register", "all", "the", "collected", "mapping", "information", "with", "the", "object", "manager", "by", "registering", "the", "appropriate", "mapping", "drivers", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php#L178-L223
train
Registers mapping drivers for the object managers
[ 30522, 5123, 3853, 4236, 2863, 14853, 23663, 2869, 1006, 1002, 4874, 24805, 4590, 1010, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 1013, 1013, 9530, 8873, 27390, 2063, 27425, 4062, 2005, 2169, 14012, 2241, 2006, 1996, 2828, 1997, 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...
overtrue/wechat
src/Payment/Transfer/Client.php
Client.toBalance
public function toBalance(array $params) { $base = [ 'mch_id' => null, 'mchid' => $this->app['config']->mch_id, 'mch_appid' => $this->app['config']->app_id, ]; if (empty($params['spbill_create_ip'])) { $params['spbill_create_ip'] = get_server_ip(); } return $this->safeRequest('mmpaymkttransfers/promotion/transfers', array_merge($base, $params)); }
php
public function toBalance(array $params) { $base = [ 'mch_id' => null, 'mchid' => $this->app['config']->mch_id, 'mch_appid' => $this->app['config']->app_id, ]; if (empty($params['spbill_create_ip'])) { $params['spbill_create_ip'] = get_server_ip(); } return $this->safeRequest('mmpaymkttransfers/promotion/transfers', array_merge($base, $params)); }
[ "public", "function", "toBalance", "(", "array", "$", "params", ")", "{", "$", "base", "=", "[", "'mch_id'", "=>", "null", ",", "'mchid'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "->", "mch_id", ",", "'mch_appid'", "=>", "$", "this", "-...
Send MerchantPay to balance. @param array $params @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Send", "MerchantPay", "to", "balance", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Transfer/Client.php#L55-L68
train
To Balance Transfers
[ 30522, 2270, 3853, 2000, 26657, 1006, 9140, 1002, 11498, 5244, 1007, 1063, 1002, 2918, 1027, 1031, 1005, 11338, 2232, 1035, 8909, 1005, 1027, 1028, 19701, 1010, 1005, 11338, 27511, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 10439, 1031, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Form.php
Form.onRefresh
public function onRefresh() { $result = []; $saveData = $this->getSaveData(); /** * @event backend.form.beforeRefresh * Called before the form is refreshed, modify the $dataHolder->data property in place * * Example usage: * * Event::listen('backend.form.beforeRefresh', function((\Backend\Widgets\Form) $formWidget, (stdClass) $dataHolder) { * $dataHolder->data = $arrayOfSaveDataToReplaceExistingDataWith; * }); * * Or * * $formWidget->bindEvent('form.beforeRefresh', function ((stdClass) $dataHolder) { * $dataHolder->data = $arrayOfSaveDataToReplaceExistingDataWith; * }); * */ $dataHolder = (object) ['data' => $saveData]; $this->fireSystemEvent('backend.form.beforeRefresh', [$dataHolder]); $saveData = $dataHolder->data; /* * Set the form variables and prepare the widget */ $this->setFormValues($saveData); $this->prepareVars(); /** * @event backend.form.refreshFields * Called when the form is refreshed, giving the opportunity to modify the form fields * * Example usage: * * Event::listen('backend.form.refreshFields', function((\Backend\Widgets\Form) $formWidget, (array) $allFields) { * $allFields['name']->required = false; * }); * * Or * * $formWidget->bindEvent('form.refreshFields', function ((array) $allFields) { * $allFields['name']->required = false; * }); * */ $this->fireSystemEvent('backend.form.refreshFields', [$this->allFields]); /* * If an array of fields is supplied, update specified fields individually. */ if (($updateFields = post('fields')) && is_array($updateFields)) { foreach ($updateFields as $field) { if (!isset($this->allFields[$field])) { continue; } /** @var FormWidgetBase $fieldObject */ $fieldObject = $this->allFields[$field]; $result['#' . $fieldObject->getId('group')] = $this->makePartial('field', ['field' => $fieldObject]); } } /* * Update the whole form */ if (empty($result)) { $result = ['#'.$this->getId() => $this->makePartial('form')]; } /** * @event backend.form.refresh * Called after the form is refreshed, should return an array of additional result parameters. * * Example usage: * * Event::listen('backend.form.refresh', function((\Backend\Widgets\Form) $formWidget, (array) $result) { * $result['#my-partial-id' => $formWidget->makePartial('$/path/to/custom/backend/partial.htm')]; * return $result; * }); * * Or * * $formWidget->bindEvent('form.refresh', function ((array) $result) use ((\Backend\Widgets\Form $formWidget)) { * $result['#my-partial-id' => $formWidget->makePartial('$/path/to/custom/backend/partial.htm')]; * return $result; * }); * */ $eventResults = $this->fireSystemEvent('backend.form.refresh', [$result], false); foreach ($eventResults as $eventResult) { $result = $eventResult + $result; } return $result; }
php
public function onRefresh() { $result = []; $saveData = $this->getSaveData(); /** * @event backend.form.beforeRefresh * Called before the form is refreshed, modify the $dataHolder->data property in place * * Example usage: * * Event::listen('backend.form.beforeRefresh', function((\Backend\Widgets\Form) $formWidget, (stdClass) $dataHolder) { * $dataHolder->data = $arrayOfSaveDataToReplaceExistingDataWith; * }); * * Or * * $formWidget->bindEvent('form.beforeRefresh', function ((stdClass) $dataHolder) { * $dataHolder->data = $arrayOfSaveDataToReplaceExistingDataWith; * }); * */ $dataHolder = (object) ['data' => $saveData]; $this->fireSystemEvent('backend.form.beforeRefresh', [$dataHolder]); $saveData = $dataHolder->data; /* * Set the form variables and prepare the widget */ $this->setFormValues($saveData); $this->prepareVars(); /** * @event backend.form.refreshFields * Called when the form is refreshed, giving the opportunity to modify the form fields * * Example usage: * * Event::listen('backend.form.refreshFields', function((\Backend\Widgets\Form) $formWidget, (array) $allFields) { * $allFields['name']->required = false; * }); * * Or * * $formWidget->bindEvent('form.refreshFields', function ((array) $allFields) { * $allFields['name']->required = false; * }); * */ $this->fireSystemEvent('backend.form.refreshFields', [$this->allFields]); /* * If an array of fields is supplied, update specified fields individually. */ if (($updateFields = post('fields')) && is_array($updateFields)) { foreach ($updateFields as $field) { if (!isset($this->allFields[$field])) { continue; } /** @var FormWidgetBase $fieldObject */ $fieldObject = $this->allFields[$field]; $result['#' . $fieldObject->getId('group')] = $this->makePartial('field', ['field' => $fieldObject]); } } /* * Update the whole form */ if (empty($result)) { $result = ['#'.$this->getId() => $this->makePartial('form')]; } /** * @event backend.form.refresh * Called after the form is refreshed, should return an array of additional result parameters. * * Example usage: * * Event::listen('backend.form.refresh', function((\Backend\Widgets\Form) $formWidget, (array) $result) { * $result['#my-partial-id' => $formWidget->makePartial('$/path/to/custom/backend/partial.htm')]; * return $result; * }); * * Or * * $formWidget->bindEvent('form.refresh', function ((array) $result) use ((\Backend\Widgets\Form $formWidget)) { * $result['#my-partial-id' => $formWidget->makePartial('$/path/to/custom/backend/partial.htm')]; * return $result; * }); * */ $eventResults = $this->fireSystemEvent('backend.form.refresh', [$result], false); foreach ($eventResults as $eventResult) { $result = $eventResult + $result; } return $result; }
[ "public", "function", "onRefresh", "(", ")", "{", "$", "result", "=", "[", "]", ";", "$", "saveData", "=", "$", "this", "->", "getSaveData", "(", ")", ";", "/**\n * @event backend.form.beforeRefresh\n * Called before the form is refreshed, modify the $data...
Event handler for refreshing the form. @return array
[ "Event", "handler", "for", "refreshing", "the", "form", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L353-L453
train
On refresh event
[ 30522, 2270, 3853, 2006, 2890, 19699, 9953, 1006, 1007, 1063, 1002, 2765, 1027, 1031, 1033, 1025, 1002, 5552, 6790, 1027, 1002, 2023, 1011, 1028, 4152, 10696, 2850, 2696, 1006, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 2724, 2067, 10497, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...