repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
matomo-org/matomo
libs/Zend/Db/Statement/Pdo.php
Zend_Db_Statement_Pdo.nextRowset
public function nextRowset() { try { return $this->_stmt->nextRowset(); } catch (PDOException $e) { // require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }
php
public function nextRowset() { try { return $this->_stmt->nextRowset(); } catch (PDOException $e) { // require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "nextRowset", "(", ")", "{", "try", "{", "return", "$", "this", "->", "_stmt", "->", "nextRowset", "(", ")", ";", "}", "catch", "(", "PDOException", "$", "e", ")", "{", "// require_once 'Zend/Db/Statement/Exception.php';", "throw", "new",...
Retrieves the next rowset (result set) for a SQL statement that has multiple result sets. An example is a stored procedure that returns the results of multiple queries. @return bool @throws Zend_Db_Statement_Exception
[ "Retrieves", "the", "next", "rowset", "(", "result", "set", ")", "for", "a", "SQL", "statement", "that", "has", "multiple", "result", "sets", ".", "An", "example", "is", "a", "stored", "procedure", "that", "returns", "the", "results", "of", "multiple", "qu...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L375-L383
train
Return the next rowset in the result set
[ 30522, 2270, 3853, 2279, 10524, 13462, 1006, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1011, 1028, 2279, 10524, 13462, 1006, 1007, 1025, 1065, 4608, 1006, 22851, 8913, 2595, 24422, 1002, 1041, 1007, 1063, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Dompdf.php
Dompdf.setDefaultView
public function setDefaultView($defaultView, $options) { $this->defaultView = $defaultView; $this->defaultViewOptions = $options; return $this; }
php
public function setDefaultView($defaultView, $options) { $this->defaultView = $defaultView; $this->defaultViewOptions = $options; return $this; }
[ "public", "function", "setDefaultView", "(", "$", "defaultView", ",", "$", "options", ")", "{", "$", "this", "->", "defaultView", "=", "$", "defaultView", ";", "$", "this", "->", "defaultViewOptions", "=", "$", "options", ";", "return", "$", "this", ";", ...
Sets the default view @param string $defaultView The default document view @param array $options The view's options @return $this
[ "Sets", "the", "default", "view" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Dompdf.php#L1248-L1253
train
Set Default View
[ 30522, 2270, 3853, 2275, 3207, 7011, 11314, 8584, 1006, 1002, 12398, 8584, 1010, 1002, 7047, 1007, 1063, 1002, 2023, 1011, 1028, 12398, 8584, 1027, 1002, 12398, 8584, 1025, 1002, 2023, 1011, 1028, 12398, 8584, 7361, 9285, 1027, 1002, 7047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/GeoIP2AutoUpdater.php
GeoIP2AutoUpdater.getGeoIPUrlExtension
public static function getGeoIPUrlExtension($url) { // check for &suffix= query param that is special to MaxMind URLs if (preg_match('/suffix=([^&]+)/', $url, $matches)) { $ext = $matches[1]; } else { // use basename of url $filenameParts = explode('.', basename($url), 2); if (count($filenameParts) > 1) { $ext = end($filenameParts); } else { $ext = reset($filenameParts); } } self::checkForSupportedArchiveType($ext); return $ext; }
php
public static function getGeoIPUrlExtension($url) { // check for &suffix= query param that is special to MaxMind URLs if (preg_match('/suffix=([^&]+)/', $url, $matches)) { $ext = $matches[1]; } else { // use basename of url $filenameParts = explode('.', basename($url), 2); if (count($filenameParts) > 1) { $ext = end($filenameParts); } else { $ext = reset($filenameParts); } } self::checkForSupportedArchiveType($ext); return $ext; }
[ "public", "static", "function", "getGeoIPUrlExtension", "(", "$", "url", ")", "{", "// check for &suffix= query param that is special to MaxMind URLs", "if", "(", "preg_match", "(", "'/suffix=([^&]+)/'", ",", "$", "url", ",", "$", "matches", ")", ")", "{", "$", "ext...
Returns the extension of a URL used to update a GeoIP 2 database, if it can be found.
[ "Returns", "the", "extension", "of", "a", "URL", "used", "to", "update", "a", "GeoIP", "2", "database", "if", "it", "can", "be", "found", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/GeoIP2AutoUpdater.php#L452-L470
train
Get extension of url
[ 30522, 2270, 10763, 3853, 2131, 3351, 10448, 5311, 2571, 18413, 6132, 3258, 1006, 1002, 24471, 2140, 1007, 1063, 1013, 1013, 4638, 2005, 1004, 16809, 1027, 23032, 11498, 2213, 2008, 2003, 2569, 2000, 4098, 23356, 24471, 4877, 2065, 1006, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Style/SymfonyStyle.php
SymfonyStyle.write
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; } foreach ($messages as $message) { parent::write($message, $newline, $type); $this->writeBuffer($message, $newline, $type); } }
php
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; } foreach ($messages as $message) { parent::write($message, $newline, $type); $this->writeBuffer($message, $newline, $type); } }
[ "public", "function", "write", "(", "$", "messages", ",", "$", "newline", "=", "false", ",", "$", "type", "=", "self", "::", "OUTPUT_NORMAL", ")", "{", "if", "(", "!", "is_iterable", "(", "$", "messages", ")", ")", "{", "$", "messages", "=", "[", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Style/SymfonyStyle.php#L322-L332
train
Write messages to the output stream
[ 30522, 2270, 3853, 4339, 1006, 1002, 7696, 1010, 1002, 2047, 4179, 1027, 6270, 1010, 1002, 2828, 1027, 2969, 1024, 1024, 6434, 1035, 3671, 1007, 1063, 2065, 1006, 999, 2003, 1035, 2009, 6906, 3468, 1006, 1002, 7696, 1007, 1007, 1063, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.compileJsonUpdateColumn
protected function compileJsonUpdateColumn($key, $value) { $parts = explode('->', $key); $field = $this->wrap(array_shift($parts)); $path = '\'{"'.implode('","', $parts).'"}\''; return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})"; }
php
protected function compileJsonUpdateColumn($key, $value) { $parts = explode('->', $key); $field = $this->wrap(array_shift($parts)); $path = '\'{"'.implode('","', $parts).'"}\''; return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})"; }
[ "protected", "function", "compileJsonUpdateColumn", "(", "$", "key", ",", "$", "value", ")", "{", "$", "parts", "=", "explode", "(", "'->'", ",", "$", "key", ")", ";", "$", "field", "=", "$", "this", "->", "wrap", "(", "array_shift", "(", "$", "parts...
Prepares a JSON column being updated using the JSONB_SET function. @param string $key @param mixed $value @return string
[ "Prepares", "a", "JSON", "column", "being", "updated", "using", "the", "JSONB_SET", "function", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php#L268-L277
train
Compile JSON update column
[ 30522, 5123, 3853, 4012, 22090, 22578, 2239, 6279, 13701, 25778, 2819, 2078, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 1002, 3033, 1027, 15044, 1006, 1005, 1011, 1028, 1005, 1010, 1002, 3145, 1007, 1025, 1002, 2492, 1027, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/File/Size.php
Zend_Validate_File_Size.getMin
public function getMin($raw = false) { $min = $this->_min; if (!$raw && $this->useByteString()) { $min = $this->_toByteString($min); } return $min; }
php
public function getMin($raw = false) { $min = $this->_min; if (!$raw && $this->useByteString()) { $min = $this->_toByteString($min); } return $min; }
[ "public", "function", "getMin", "(", "$", "raw", "=", "false", ")", "{", "$", "min", "=", "$", "this", "->", "_min", ";", "if", "(", "!", "$", "raw", "&&", "$", "this", "->", "useByteString", "(", ")", ")", "{", "$", "min", "=", "$", "this", ...
Returns the minimum filesize @param bool $raw Whether or not to force return of the raw value (defaults off) @return integer|string
[ "Returns", "the", "minimum", "filesize" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/Size.php#L164-L172
train
Get Minimum Value of this Field
[ 30522, 2270, 3853, 2131, 10020, 1006, 1002, 6315, 1027, 6270, 1007, 1063, 1002, 8117, 1027, 1002, 2023, 1011, 1028, 1035, 8117, 1025, 2065, 1006, 999, 1002, 6315, 1004, 1004, 1002, 2023, 1011, 1028, 2224, 3762, 22199, 4892, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/NavigationManager.php
NavigationManager.addSideMenuItems
public function addSideMenuItems($owner, $code, array $definitions) { foreach ($definitions as $sideCode => $definition) { $this->addSideMenuItem($owner, $code, $sideCode, (array) $definition); } }
php
public function addSideMenuItems($owner, $code, array $definitions) { foreach ($definitions as $sideCode => $definition) { $this->addSideMenuItem($owner, $code, $sideCode, (array) $definition); } }
[ "public", "function", "addSideMenuItems", "(", "$", "owner", ",", "$", "code", ",", "array", "$", "definitions", ")", "{", "foreach", "(", "$", "definitions", "as", "$", "sideCode", "=>", "$", "definition", ")", "{", "$", "this", "->", "addSideMenuItem", ...
Dynamically add an array of side menu items @param string $owner @param string $code @param array $definitions
[ "Dynamically", "add", "an", "array", "of", "side", "menu", "items" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L247-L252
train
Add side menu items
[ 30522, 2270, 3853, 9909, 5178, 3549, 14663, 6633, 2015, 1006, 1002, 3954, 1010, 1002, 3642, 1010, 9140, 1002, 15182, 1007, 1063, 18921, 6776, 1006, 1002, 15182, 2004, 1002, 2217, 16044, 1027, 1028, 1002, 6210, 1007, 1063, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/Relation.php
Relation.getKeys
protected function getKeys(array $models, $key = null) { return collect($models)->map(function ($value) use ($key) { return $key ? $value->getAttribute($key) : $value->getKey(); })->values()->unique(null, true)->sort()->all(); }
php
protected function getKeys(array $models, $key = null) { return collect($models)->map(function ($value) use ($key) { return $key ? $value->getAttribute($key) : $value->getKey(); })->values()->unique(null, true)->sort()->all(); }
[ "protected", "function", "getKeys", "(", "array", "$", "models", ",", "$", "key", "=", "null", ")", "{", "return", "collect", "(", "$", "models", ")", "->", "map", "(", "function", "(", "$", "value", ")", "use", "(", "$", "key", ")", "{", "return",...
Get all of the primary keys for an array of models. @param array $models @param string $key @return array
[ "Get", "all", "of", "the", "primary", "keys", "for", "an", "array", "of", "models", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Relation.php#L223-L228
train
Get all the keys of the model
[ 30522, 5123, 3853, 2131, 14839, 2015, 1006, 9140, 1002, 4275, 1010, 1002, 3145, 1027, 19701, 1007, 1063, 2709, 8145, 1006, 1002, 4275, 1007, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 3643, 1007, 2224, 1006, 1002, 3145, 1007, 1063, 2709, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Classification/MLPClassifier.php
MLPClassifier.getTargetClass
public function getTargetClass($target): int { if (!in_array($target, $this->classes, true)) { throw new InvalidArgumentException( sprintf('Target with value "%s" is not part of the accepted classes', $target) ); } return array_search($target, $this->classes, true); }
php
public function getTargetClass($target): int { if (!in_array($target, $this->classes, true)) { throw new InvalidArgumentException( sprintf('Target with value "%s" is not part of the accepted classes', $target) ); } return array_search($target, $this->classes, true); }
[ "public", "function", "getTargetClass", "(", "$", "target", ")", ":", "int", "{", "if", "(", "!", "in_array", "(", "$", "target", ",", "$", "this", "->", "classes", ",", "true", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", ...
@param mixed $target @throws InvalidArgumentException
[ "@param", "mixed", "$target" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/MLPClassifier.php#L17-L26
train
Returns the class that is accepted by the target
[ 30522, 2270, 3853, 2131, 7559, 18150, 26266, 1006, 1002, 4539, 1007, 1024, 20014, 1063, 2065, 1006, 999, 1999, 1035, 9140, 1006, 1002, 4539, 1010, 1002, 2023, 1011, 1028, 4280, 1010, 2995, 1007, 1007, 1063, 5466, 2047, 19528, 2906, 22850, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Association/Apriori.php
Apriori.powerSet
private function powerSet(array $sample): array { $results = [[]]; foreach ($sample as $item) { foreach ($results as $combination) { $results[] = array_merge([$item], $combination); } } return $results; }
php
private function powerSet(array $sample): array { $results = [[]]; foreach ($sample as $item) { foreach ($results as $combination) { $results[] = array_merge([$item], $combination); } } return $results; }
[ "private", "function", "powerSet", "(", "array", "$", "sample", ")", ":", "array", "{", "$", "results", "=", "[", "[", "]", "]", ";", "foreach", "(", "$", "sample", "as", "$", "item", ")", "{", "foreach", "(", "$", "results", "as", "$", "combinatio...
Generates the power set for given item set $sample. @param mixed[] $sample @return mixed[][]
[ "Generates", "the", "power", "set", "for", "given", "item", "set", "$sample", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L156-L166
train
Power Set.
[ 30522, 2797, 3853, 4204, 3388, 1006, 9140, 1002, 7099, 1007, 1024, 9140, 1063, 1002, 3463, 1027, 1031, 1031, 1033, 1033, 1025, 18921, 6776, 1006, 1002, 7099, 2004, 1002, 8875, 1007, 1063, 18921, 6776, 1006, 1002, 3463, 2004, 1002, 5257, 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/DependencyInjection/Compiler/Compiler.php
Compiler.addPass
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) { $this->passConfig->addPass($pass, $type, $priority); }
php
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) { $this->passConfig->addPass($pass, $type, $priority); }
[ "public", "function", "addPass", "(", "CompilerPassInterface", "$", "pass", ",", "$", "type", "=", "PassConfig", "::", "TYPE_BEFORE_OPTIMIZATION", ",", "int", "$", "priority", "=", "0", ")", "{", "$", "this", "->", "passConfig", "->", "addPass", "(", "$", ...
Adds a pass to the PassConfig. @param CompilerPassInterface $pass A compiler pass @param string $type The type of the pass @param int $priority Used to sort the passes
[ "Adds", "a", "pass", "to", "the", "PassConfig", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php#L61-L64
train
Adds a pass to the list of passes
[ 30522, 2270, 3853, 5587, 15194, 1006, 21624, 15194, 18447, 2121, 12172, 1002, 3413, 1010, 1002, 2828, 1027, 3413, 8663, 8873, 2290, 1024, 1024, 2828, 1035, 2077, 1035, 20600, 1010, 20014, 1002, 9470, 1027, 1014, 1007, 1063, 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...
symfony/symfony
src/Symfony/Component/Mime/Header/Headers.php
Headers.addMailboxListHeader
public function addMailboxListHeader(string $name, array $addresses) { return $this->add(new MailboxListHeader($name, Address::createArray($addresses))); }
php
public function addMailboxListHeader(string $name, array $addresses) { return $this->add(new MailboxListHeader($name, Address::createArray($addresses))); }
[ "public", "function", "addMailboxListHeader", "(", "string", "$", "name", ",", "array", "$", "addresses", ")", "{", "return", "$", "this", "->", "add", "(", "new", "MailboxListHeader", "(", "$", "name", ",", "Address", "::", "createArray", "(", "$", "addre...
@param (NamedAddress|Address|string)[] $addresses @return $this
[ "@param", "(", "NamedAddress|Address|string", ")", "[]", "$addresses" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Header/Headers.php#L69-L72
train
Add a new mailbox list header
[ 30522, 2270, 3853, 5587, 21397, 8758, 9863, 4974, 2121, 1006, 5164, 1002, 2171, 1010, 9140, 1002, 11596, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5587, 1006, 2047, 5653, 8758, 9863, 4974, 2121, 1006, 1002, 2171, 1010, 4769, 1024, 1024, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreVisualizations/Visualizations/Sparklines/Config.php
Config.getGraphParamsModified
private function getGraphParamsModified($paramsToSet = array()) { if (!isset($paramsToSet['period'])) { $period = Common::getRequestVar('period'); } else { $period = $paramsToSet['period']; } if ($period == 'range') { return $paramsToSet; } if (!isset($paramsToSet['range'])) { $range = 'last30'; } else { $range = $paramsToSet['range']; } if (!isset($paramsToSet['idSite'])) { $idSite = Common::getRequestVar('idSite'); } else { $idSite = $paramsToSet['idSite']; } if (!isset($paramsToSet['date'])) { $endDate = Common::getRequestVar('date', 'yesterday', 'string'); } else { $endDate = $paramsToSet['date']; } $site = new Site($idSite); if (is_null($site)) { throw new NoAccessException("Website not initialized, check that you are logged in and/or using the correct token_auth."); } $paramDate = Range::getRelativeToEndDate($period, $range, $endDate, $site); $params = array_merge($paramsToSet, array('date' => $paramDate)); return $params; }
php
private function getGraphParamsModified($paramsToSet = array()) { if (!isset($paramsToSet['period'])) { $period = Common::getRequestVar('period'); } else { $period = $paramsToSet['period']; } if ($period == 'range') { return $paramsToSet; } if (!isset($paramsToSet['range'])) { $range = 'last30'; } else { $range = $paramsToSet['range']; } if (!isset($paramsToSet['idSite'])) { $idSite = Common::getRequestVar('idSite'); } else { $idSite = $paramsToSet['idSite']; } if (!isset($paramsToSet['date'])) { $endDate = Common::getRequestVar('date', 'yesterday', 'string'); } else { $endDate = $paramsToSet['date']; } $site = new Site($idSite); if (is_null($site)) { throw new NoAccessException("Website not initialized, check that you are logged in and/or using the correct token_auth."); } $paramDate = Range::getRelativeToEndDate($period, $range, $endDate, $site); $params = array_merge($paramsToSet, array('date' => $paramDate)); return $params; }
[ "private", "function", "getGraphParamsModified", "(", "$", "paramsToSet", "=", "array", "(", ")", ")", "{", "if", "(", "!", "isset", "(", "$", "paramsToSet", "[", "'period'", "]", ")", ")", "{", "$", "period", "=", "Common", "::", "getRequestVar", "(", ...
Returns the array of new processed parameters once the parameters are applied. For example: if you set range=last30 and date=2008-03-10, the date element of the returned array will be "2008-02-10,2008-03-10" Parameters you can set: - range: last30, previous10, etc. - date: YYYY-MM-DD, today, yesterday - period: day, week, month, year @param array $paramsToSet array( 'date' => 'last50', 'viewDataTable' =>'sparkline' ) @throws \Piwik\NoAccessException @return array
[ "Returns", "the", "array", "of", "new", "processed", "parameters", "once", "the", "parameters", "are", "applied", ".", "For", "example", ":", "if", "you", "set", "range", "=", "last30", "and", "date", "=", "2008", "-", "03", "-", "10", "the", "date", "...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php#L357-L397
train
Returns the parameters for the graph.
[ 30522, 2797, 3853, 2131, 14413, 28689, 5244, 5302, 4305, 10451, 1006, 1002, 11498, 5244, 22282, 2102, 1027, 9140, 1006, 1007, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 11498, 5244, 22282, 2102, 1031, 1005, 2558, 1005, 1033, 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/Routing/Matcher/UrlMatcher.php
UrlMatcher.handleRouteRequirements
protected function handleRouteRequirements($pathinfo, $name, Route $route) { // expression condition if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) { return [self::REQUIREMENT_MISMATCH, null]; } return [self::REQUIREMENT_MATCH, null]; }
php
protected function handleRouteRequirements($pathinfo, $name, Route $route) { // expression condition if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) { return [self::REQUIREMENT_MISMATCH, null]; } return [self::REQUIREMENT_MATCH, null]; }
[ "protected", "function", "handleRouteRequirements", "(", "$", "pathinfo", ",", "$", "name", ",", "Route", "$", "route", ")", "{", "// expression condition", "if", "(", "$", "route", "->", "getCondition", "(", ")", "&&", "!", "$", "this", "->", "getExpression...
Handles specific route requirements. @param string $pathinfo The path @param string $name The route name @param Route $route The route @return array The first element represents the status, the second contains additional information
[ "Handles", "specific", "route", "requirements", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/UrlMatcher.php#L246-L254
train
Handle route requirements
[ 30522, 5123, 3853, 28213, 5833, 7869, 15549, 28578, 11187, 1006, 1002, 4130, 2378, 14876, 1010, 1002, 2171, 1010, 2799, 1002, 2799, 1007, 1063, 1013, 1013, 3670, 4650, 2065, 1006, 1002, 2799, 1011, 1028, 2131, 8663, 20562, 1006, 1007, 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...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
IntegerType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'grouping' => false, // Integer cast rounds towards 0, so do the same when displaying fractions 'rounding_mode' => IntegerToLocalizedStringTransformer::ROUND_DOWN, 'compound' => false, ]); $resolver->setAllowedValues('rounding_mode', [ IntegerToLocalizedStringTransformer::ROUND_FLOOR, IntegerToLocalizedStringTransformer::ROUND_DOWN, IntegerToLocalizedStringTransformer::ROUND_HALF_DOWN, IntegerToLocalizedStringTransformer::ROUND_HALF_EVEN, IntegerToLocalizedStringTransformer::ROUND_HALF_UP, IntegerToLocalizedStringTransformer::ROUND_UP, IntegerToLocalizedStringTransformer::ROUND_CEILING, ]); $resolver->setDefined('scale'); $resolver->setAllowedTypes('scale', ['null', 'int']); $resolver->setDeprecated('scale'); }
php
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'grouping' => false, // Integer cast rounds towards 0, so do the same when displaying fractions 'rounding_mode' => IntegerToLocalizedStringTransformer::ROUND_DOWN, 'compound' => false, ]); $resolver->setAllowedValues('rounding_mode', [ IntegerToLocalizedStringTransformer::ROUND_FLOOR, IntegerToLocalizedStringTransformer::ROUND_DOWN, IntegerToLocalizedStringTransformer::ROUND_HALF_DOWN, IntegerToLocalizedStringTransformer::ROUND_HALF_EVEN, IntegerToLocalizedStringTransformer::ROUND_HALF_UP, IntegerToLocalizedStringTransformer::ROUND_UP, IntegerToLocalizedStringTransformer::ROUND_CEILING, ]); $resolver->setDefined('scale'); $resolver->setAllowedTypes('scale', ['null', 'int']); $resolver->setDeprecated('scale'); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setDefaults", "(", "[", "'grouping'", "=>", "false", ",", "// Integer cast rounds towards 0, so do the same when displaying fractions", "'rounding_mode'", "=...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php#L44-L66
train
Configure the options for the parser
[ 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, 19765, 1005, 1027, 1028, 6270, 1010, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Node.php
HTML_QuickForm2_Node.toggleFrozen
public function toggleFrozen($freeze = null) { $old = $this->frozen; if (null !== $freeze) { $this->frozen = (bool)$freeze; } return $old; }
php
public function toggleFrozen($freeze = null) { $old = $this->frozen; if (null !== $freeze) { $this->frozen = (bool)$freeze; } return $old; }
[ "public", "function", "toggleFrozen", "(", "$", "freeze", "=", "null", ")", "{", "$", "old", "=", "$", "this", "->", "frozen", ";", "if", "(", "null", "!==", "$", "freeze", ")", "{", "$", "this", "->", "frozen", "=", "(", "bool", ")", "$", "freez...
Changes the element's frozen status @param bool Whether the element should be frozen or editable. If omitted, the method will not change the frozen status, just return its current value @return bool Old value of element's frozen status
[ "Changes", "the", "element", "s", "frozen", "status" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Node.php#L392-L399
train
Toggle frozen flag
[ 30522, 2270, 3853, 2000, 24679, 19699, 18153, 2368, 1006, 1002, 13184, 1027, 19701, 1007, 1063, 1002, 2214, 1027, 1002, 2023, 1011, 1028, 7708, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 13184, 1007, 1063, 1002, 2023, 1011, 1028, 7708,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
AssetsInstallCommand.relativeSymlinkWithFallback
private function relativeSymlinkWithFallback(string $originDir, string $targetDir): string { try { $this->symlink($originDir, $targetDir, true); $method = self::METHOD_RELATIVE_SYMLINK; } catch (IOException $e) { $method = $this->absoluteSymlinkWithFallback($originDir, $targetDir); } return $method; }
php
private function relativeSymlinkWithFallback(string $originDir, string $targetDir): string { try { $this->symlink($originDir, $targetDir, true); $method = self::METHOD_RELATIVE_SYMLINK; } catch (IOException $e) { $method = $this->absoluteSymlinkWithFallback($originDir, $targetDir); } return $method; }
[ "private", "function", "relativeSymlinkWithFallback", "(", "string", "$", "originDir", ",", "string", "$", "targetDir", ")", ":", "string", "{", "try", "{", "$", "this", "->", "symlink", "(", "$", "originDir", ",", "$", "targetDir", ",", "true", ")", ";", ...
Try to create relative symlink. Falling back to absolute symlink and finally hard copy.
[ "Try", "to", "create", "relative", "symlink", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php#L206-L216
train
Symlinks a directory with a fallback to a relative symlink.
[ 30522, 2797, 3853, 9064, 24335, 13767, 24415, 13976, 5963, 1006, 5164, 1002, 4761, 4305, 2099, 1010, 5164, 1002, 4539, 4305, 2099, 1007, 1024, 5164, 1063, 3046, 1063, 1002, 2023, 1011, 1028, 25353, 19968, 19839, 1006, 1002, 4761, 4305, 2099...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Db/Adapter.php
Adapter.factory
public static function factory($adapterName, & $dbInfos, $connect = true) { if ($connect) { if ($dbInfos['port'][0] == '/') { $dbInfos['unix_socket'] = $dbInfos['port']; unset($dbInfos['host']); unset($dbInfos['port']); } // not used by Zend Framework unset($dbInfos['tables_prefix']); unset($dbInfos['adapter']); unset($dbInfos['schema']); } $className = self::getAdapterClassName($adapterName); // make sure not to pass any references otherwise they will modify $dbInfos $infos = array(); foreach ($dbInfos as $key => $val) { $infos[$key] = $val; } $adapter = new $className($infos); if ($connect) { $adapter->getConnection(); Zend_Db_Table::setDefaultAdapter($adapter); // we don't want the connection information to appear in the logs $adapter->resetConfig(); } return $adapter; }
php
public static function factory($adapterName, & $dbInfos, $connect = true) { if ($connect) { if ($dbInfos['port'][0] == '/') { $dbInfos['unix_socket'] = $dbInfos['port']; unset($dbInfos['host']); unset($dbInfos['port']); } // not used by Zend Framework unset($dbInfos['tables_prefix']); unset($dbInfos['adapter']); unset($dbInfos['schema']); } $className = self::getAdapterClassName($adapterName); // make sure not to pass any references otherwise they will modify $dbInfos $infos = array(); foreach ($dbInfos as $key => $val) { $infos[$key] = $val; } $adapter = new $className($infos); if ($connect) { $adapter->getConnection(); Zend_Db_Table::setDefaultAdapter($adapter); // we don't want the connection information to appear in the logs $adapter->resetConfig(); } return $adapter; }
[ "public", "static", "function", "factory", "(", "$", "adapterName", ",", "&", "$", "dbInfos", ",", "$", "connect", "=", "true", ")", "{", "if", "(", "$", "connect", ")", "{", "if", "(", "$", "dbInfos", "[", "'port'", "]", "[", "0", "]", "==", "'/...
Create adapter @param string $adapterName database adapter name @param array $dbInfos database connection info @param bool $connect @return AdapterInterface
[ "Create", "adapter" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter.php#L25-L59
train
Factory method for creating new Adapter objects
[ 30522, 2270, 10763, 3853, 4713, 1006, 1002, 15581, 11795, 14074, 1010, 1004, 1002, 16962, 2378, 14876, 2015, 1010, 1002, 7532, 1027, 2995, 1007, 1063, 2065, 1006, 1002, 7532, 1007, 1063, 2065, 1006, 1002, 16962, 2378, 14876, 2015, 1031, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Frontend/Page.php
Zend_Cache_Frontend_Page._setContentTypeMemorization
protected function _setContentTypeMemorization($value) { $found = null; foreach ($this->_specificOptions['memorize_headers'] as $key => $value) { if (strtolower($value) == 'content-type') { $found = $key; } } if ($value) { if (!$found) { $this->_specificOptions['memorize_headers'][] = 'Content-Type'; } } else { if ($found) { unset($this->_specificOptions['memorize_headers'][$found]); } } }
php
protected function _setContentTypeMemorization($value) { $found = null; foreach ($this->_specificOptions['memorize_headers'] as $key => $value) { if (strtolower($value) == 'content-type') { $found = $key; } } if ($value) { if (!$found) { $this->_specificOptions['memorize_headers'][] = 'Content-Type'; } } else { if ($found) { unset($this->_specificOptions['memorize_headers'][$found]); } } }
[ "protected", "function", "_setContentTypeMemorization", "(", "$", "value", ")", "{", "$", "found", "=", "null", ";", "foreach", "(", "$", "this", "->", "_specificOptions", "[", "'memorize_headers'", "]", "as", "$", "key", "=>", "$", "value", ")", "{", "if"...
Set the deprecated contentTypeMemorization option @param boolean $value value @return void @deprecated
[ "Set", "the", "deprecated", "contentTypeMemorization", "option" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/Page.php#L186-L203
train
Set Content - Type Memorization
[ 30522, 5123, 3853, 1035, 2275, 8663, 6528, 15353, 5051, 4168, 24610, 9276, 1006, 1002, 3643, 1007, 1063, 1002, 2179, 1027, 19701, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 1035, 3563, 7361, 9285, 1031, 1005, 24443, 25709, 1035, 20346...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Card/JssdkClient.php
JssdkClient.attachExtension
public function attachExtension($cardId, array $extension = []) { $timestamp = time(); $nonce = str_random(6); $ticket = $this->getTicket()['ticket']; $ext = array_merge(['timestamp' => $timestamp, 'nonce_str' => $nonce], Arr::only( $extension, ['code', 'openid', 'outer_id', 'balance', 'fixed_begintimestamp', 'outer_str'] )); $ext['signature'] = $this->dictionaryOrderSignature($ticket, $timestamp, $cardId, $ext['code'] ?? '', $ext['openid'] ?? '', $nonce); return [ 'cardId' => $cardId, 'cardExt' => json_encode($ext), ]; }
php
public function attachExtension($cardId, array $extension = []) { $timestamp = time(); $nonce = str_random(6); $ticket = $this->getTicket()['ticket']; $ext = array_merge(['timestamp' => $timestamp, 'nonce_str' => $nonce], Arr::only( $extension, ['code', 'openid', 'outer_id', 'balance', 'fixed_begintimestamp', 'outer_str'] )); $ext['signature'] = $this->dictionaryOrderSignature($ticket, $timestamp, $cardId, $ext['code'] ?? '', $ext['openid'] ?? '', $nonce); return [ 'cardId' => $cardId, 'cardExt' => json_encode($ext), ]; }
[ "public", "function", "attachExtension", "(", "$", "cardId", ",", "array", "$", "extension", "=", "[", "]", ")", "{", "$", "timestamp", "=", "time", "(", ")", ";", "$", "nonce", "=", "str_random", "(", "6", ")", ";", "$", "ticket", "=", "$", "this"...
生成 js添加到卡包 需要的 card_list 项. @param string $cardId @param array $extension @return array @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException @throws \Psr\SimpleCache\InvalidArgumentException
[ "生成", "js添加到卡包", "需要的", "card_list", "项", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/JssdkClient.php#L65-L82
train
Attaches the extension to the card
[ 30522, 2270, 3853, 29489, 18413, 6132, 3258, 1006, 1002, 4003, 3593, 1010, 9140, 1002, 5331, 1027, 1031, 1033, 1007, 1063, 1002, 2335, 15464, 2361, 1027, 2051, 1006, 1007, 1025, 1002, 2512, 3401, 1027, 2358, 2099, 1035, 6721, 1006, 1020, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/VisitorGeolocator.php
VisitorGeolocator.reattributeVisitLogs
public function reattributeVisitLogs($from, $to, $idSite = null, $iterationStep = 1000, $onLogProcessed = null) { $visitFieldsToSelect = array_merge(array('idvisit', 'location_ip'), array_keys(VisitorGeolocator::$logVisitFieldsToUpdate)); $conditions = array( array('visit_last_action_time', '>=', $from), array('visit_last_action_time', '<', $to) ); if (!empty($idSite)) { $conditions[] = array('idsite', '=', $idSite); } $self = $this; $this->dao->forAllLogs('log_visit', $visitFieldsToSelect, $conditions, $iterationStep, function ($logs) use ($self, $onLogProcessed) { foreach ($logs as $row) { $updatedValues = $self->attributeExistingVisit($row); if (!empty($onLogProcessed)) { $onLogProcessed($row, $updatedValues); } } }); }
php
public function reattributeVisitLogs($from, $to, $idSite = null, $iterationStep = 1000, $onLogProcessed = null) { $visitFieldsToSelect = array_merge(array('idvisit', 'location_ip'), array_keys(VisitorGeolocator::$logVisitFieldsToUpdate)); $conditions = array( array('visit_last_action_time', '>=', $from), array('visit_last_action_time', '<', $to) ); if (!empty($idSite)) { $conditions[] = array('idsite', '=', $idSite); } $self = $this; $this->dao->forAllLogs('log_visit', $visitFieldsToSelect, $conditions, $iterationStep, function ($logs) use ($self, $onLogProcessed) { foreach ($logs as $row) { $updatedValues = $self->attributeExistingVisit($row); if (!empty($onLogProcessed)) { $onLogProcessed($row, $updatedValues); } } }); }
[ "public", "function", "reattributeVisitLogs", "(", "$", "from", ",", "$", "to", ",", "$", "idSite", "=", "null", ",", "$", "iterationStep", "=", "1000", ",", "$", "onLogProcessed", "=", "null", ")", "{", "$", "visitFieldsToSelect", "=", "array_merge", "(",...
Re-geolocate visits within a date range for a specified site (if any). @param string $from A datetime string to treat as the lower bound. Visits newer than this date are processed. @param string $to A datetime string to treat as the upper bound. Visits older than this date are processed. @param int|null $idSite If supplied, only visits for this site are re-attributed. @param int $iterationStep The number of visits to re-attribute at the same time. @param callable|null $onLogProcessed If supplied, this callback is called after every row is processed. The processed visit and the updated values are passed to the callback.
[ "Re", "-", "geolocate", "visits", "within", "a", "date", "range", "for", "a", "specified", "site", "(", "if", "any", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/VisitorGeolocator.php#L246-L269
train
Reattribute all logs that have been updated
[ 30522, 2270, 3853, 2128, 19321, 3089, 8569, 2618, 11365, 4183, 21197, 2015, 1006, 1002, 2013, 1010, 1002, 2000, 1010, 1002, 8909, 28032, 2063, 1027, 19701, 1010, 1002, 27758, 13473, 2361, 1027, 6694, 1010, 1002, 2006, 21197, 21572, 9623, 69...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Http/Resources/Json/PaginatedResourceResponse.php
PaginatedResourceResponse.toResponse
public function toResponse($request) { return tap(response()->json( $this->wrap( $this->resource->resolve($request), array_merge_recursive( $this->paginationInformation($request), $this->resource->with($request), $this->resource->additional ) ), $this->calculateStatus() ), function ($response) use ($request) { $response->original = $this->resource->resource->pluck('resource'); $this->resource->withResponse($request, $response); }); }
php
public function toResponse($request) { return tap(response()->json( $this->wrap( $this->resource->resolve($request), array_merge_recursive( $this->paginationInformation($request), $this->resource->with($request), $this->resource->additional ) ), $this->calculateStatus() ), function ($response) use ($request) { $response->original = $this->resource->resource->pluck('resource'); $this->resource->withResponse($request, $response); }); }
[ "public", "function", "toResponse", "(", "$", "request", ")", "{", "return", "tap", "(", "response", "(", ")", "->", "json", "(", "$", "this", "->", "wrap", "(", "$", "this", "->", "resource", "->", "resolve", "(", "$", "request", ")", ",", "array_me...
Create an HTTP response that represents the object. @param \Illuminate\Http\Request $request @return \Illuminate\Http\JsonResponse
[ "Create", "an", "HTTP", "response", "that", "represents", "the", "object", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php#L15-L32
train
Return a response with the result of the request.
[ 30522, 2270, 3853, 9538, 13102, 5644, 2063, 1006, 1002, 5227, 1007, 1063, 2709, 11112, 1006, 3433, 1006, 1007, 1011, 1028, 1046, 3385, 1006, 1002, 2023, 1011, 1028, 10236, 1006, 1002, 2023, 1011, 1028, 7692, 1011, 1028, 10663, 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...
laravel/framework
src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.compileJsonContains
protected function compileJsonContains($column, $value) { $column = str_replace('->>', '->', $this->wrap($column)); return '('.$column.')::jsonb @> '.$value; }
php
protected function compileJsonContains($column, $value) { $column = str_replace('->>', '->', $this->wrap($column)); return '('.$column.')::jsonb @> '.$value; }
[ "protected", "function", "compileJsonContains", "(", "$", "column", ",", "$", "value", ")", "{", "$", "column", "=", "str_replace", "(", "'->>'", ",", "'->'", ",", "$", "this", "->", "wrap", "(", "$", "column", ")", ")", ";", "return", "'('", ".", "$...
Compile a "JSON contains" statement into SQL. @param string $column @param string $value @return string
[ "Compile", "a", "JSON", "contains", "statement", "into", "SQL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php#L148-L153
train
Compile JSON contains
[ 30522, 5123, 3853, 4012, 22090, 22578, 2239, 8663, 18249, 2015, 1006, 1002, 5930, 1010, 1002, 3643, 1007, 1063, 1002, 5930, 1027, 2358, 2099, 1035, 5672, 1006, 1005, 1011, 1028, 1028, 1005, 1010, 1005, 1011, 1028, 1005, 1010, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/controllers/Updates.php
Updates.install
public function install($tab = null) { if (get('search')) { return Response::make($this->onSearchProducts()); } try { $this->bodyClass = 'compact-container breadcrumb-flush'; $this->pageTitle = 'system::lang.plugins.install_products'; $this->addJs('/modules/system/assets/js/updates/install.js', 'core'); $this->addCss('/modules/system/assets/css/updates/install.css', 'core'); $this->vars['activeTab'] = $tab ?: 'plugins'; $this->vars['installedPlugins'] = $this->getInstalledPlugins(); $this->vars['installedThemes'] = $this->getInstalledThemes(); } catch (Exception $ex) { $this->handleError($ex); } }
php
public function install($tab = null) { if (get('search')) { return Response::make($this->onSearchProducts()); } try { $this->bodyClass = 'compact-container breadcrumb-flush'; $this->pageTitle = 'system::lang.plugins.install_products'; $this->addJs('/modules/system/assets/js/updates/install.js', 'core'); $this->addCss('/modules/system/assets/css/updates/install.css', 'core'); $this->vars['activeTab'] = $tab ?: 'plugins'; $this->vars['installedPlugins'] = $this->getInstalledPlugins(); $this->vars['installedThemes'] = $this->getInstalledThemes(); } catch (Exception $ex) { $this->handleError($ex); } }
[ "public", "function", "install", "(", "$", "tab", "=", "null", ")", "{", "if", "(", "get", "(", "'search'", ")", ")", "{", "return", "Response", "::", "make", "(", "$", "this", "->", "onSearchProducts", "(", ")", ")", ";", "}", "try", "{", "$", "...
Install new plugins / themes
[ "Install", "new", "plugins", "/", "themes" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/controllers/Updates.php#L97-L117
train
Installs all installed plugins and themes
[ 30522, 2270, 3853, 16500, 1006, 1002, 21628, 1027, 19701, 1007, 1063, 2065, 1006, 2131, 1006, 1005, 3945, 1005, 1007, 1007, 1063, 2709, 3433, 1024, 1024, 2191, 1006, 1002, 2023, 1011, 1028, 2006, 17310, 11140, 21572, 8566, 16649, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
AbstractToken.getAttribute
public function getAttribute($name) { if (!\array_key_exists($name, $this->attributes)) { throw new \InvalidArgumentException(sprintf('This token has no "%s" attribute.', $name)); } return $this->attributes[$name]; }
php
public function getAttribute($name) { if (!\array_key_exists($name, $this->attributes)) { throw new \InvalidArgumentException(sprintf('This token has no "%s" attribute.', $name)); } return $this->attributes[$name]; }
[ "public", "function", "getAttribute", "(", "$", "name", ")", "{", "if", "(", "!", "\\", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "attributes", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Th...
Returns an attribute value. @param string $name The attribute name @return mixed The attribute value @throws \InvalidArgumentException When attribute doesn't exist for this token
[ "Returns", "an", "attribute", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php#L258-L265
train
Get the value of an attribute
[ 30522, 2270, 3853, 2131, 19321, 3089, 8569, 2618, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 999, 1032, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 2171, 1010, 1002, 2023, 1011, 1028, 12332, 1007, 1007, 1063, 5466, 2047, 1032, 19528, 2906, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/ThemeManager.php
ThemeManager.setUninstalled
public function setUninstalled($code) { $history = Parameter::get('system::theme.history', []); if (array_key_exists($code, $history)) { unset($history[$code]); } Parameter::set('system::theme.history', $history); }
php
public function setUninstalled($code) { $history = Parameter::get('system::theme.history', []); if (array_key_exists($code, $history)) { unset($history[$code]); } Parameter::set('system::theme.history', $history); }
[ "public", "function", "setUninstalled", "(", "$", "code", ")", "{", "$", "history", "=", "Parameter", "::", "get", "(", "'system::theme.history'", ",", "[", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "code", ",", "$", "history", ")", ")", ...
Flags a theme as being uninstalled. @param string $code Theme code
[ "Flags", "a", "theme", "as", "being", "uninstalled", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ThemeManager.php#L61-L69
train
Uninstall theme code
[ 30522, 2270, 3853, 2275, 19496, 23808, 24164, 2094, 1006, 1002, 3642, 1007, 1063, 1002, 2381, 1027, 16381, 1024, 1024, 2131, 1006, 1005, 2291, 1024, 1024, 4323, 1012, 2381, 1005, 1010, 1031, 1033, 1007, 1025, 2065, 1006, 9140, 1035, 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...
octobercms/october
modules/system/models/EventLog.php
EventLog.add
public static function add($message, $level = 'info', $details = null) { $record = new static; $record->message = $message; $record->level = $level; if ($details !== null) { $record->details = (array) $details; } try { $record->save(); } catch (Exception $ex) {} return $record; }
php
public static function add($message, $level = 'info', $details = null) { $record = new static; $record->message = $message; $record->level = $level; if ($details !== null) { $record->details = (array) $details; } try { $record->save(); } catch (Exception $ex) {} return $record; }
[ "public", "static", "function", "add", "(", "$", "message", ",", "$", "level", "=", "'info'", ",", "$", "details", "=", "null", ")", "{", "$", "record", "=", "new", "static", ";", "$", "record", "->", "message", "=", "$", "message", ";", "$", "reco...
Creates a log record @param string $message Specifies the message text @param string $level Specifies the logging level @param string $details Specifies the error details string @return self
[ "Creates", "a", "log", "record" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/EventLog.php#L48-L64
train
Add a new record to the database
[ 30522, 2270, 10763, 3853, 5587, 1006, 1002, 4471, 1010, 1002, 2504, 1027, 1005, 18558, 1005, 1010, 1002, 4751, 1027, 19701, 1007, 1063, 1002, 2501, 1027, 2047, 10763, 1025, 1002, 2501, 1011, 1028, 4471, 1027, 1002, 4471, 1025, 1002, 2501, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php
Query.getResource
public function getResource($idx = 0) { if (null === $this->results || $idx >= \count($this->results)) { return null; } return $this->results[$idx]; }
php
public function getResource($idx = 0) { if (null === $this->results || $idx >= \count($this->results)) { return null; } return $this->results[$idx]; }
[ "public", "function", "getResource", "(", "$", "idx", "=", "0", ")", "{", "if", "(", "null", "===", "$", "this", "->", "results", "||", "$", "idx", ">=", "\\", "count", "(", "$", "this", "->", "results", ")", ")", "{", "return", "null", ";", "}",...
Returns a LDAP search resource. If this query resulted in multiple searches, only the first page will be returned. @return resource @internal
[ "Returns", "a", "LDAP", "search", "resource", ".", "If", "this", "query", "resulted", "in", "multiple", "searches", "only", "the", "first", "page", "will", "be", "returned", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php#L156-L163
train
Get the resource
[ 30522, 2270, 3853, 2131, 6072, 8162, 3401, 1006, 1002, 8909, 2595, 1027, 1014, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 3463, 1064, 1064, 1002, 8909, 2595, 1028, 1027, 1032, 4175, 1006, 1002, 2023, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Container.php
Container.get
public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1) { return $this->services[$id] ?? $this->services[$id = $this->aliases[$id] ?? $id] ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? [$this, 'make'])($id, $invalidBehavior)); }
php
public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1) { return $this->services[$id] ?? $this->services[$id = $this->aliases[$id] ?? $id] ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? [$this, 'make'])($id, $invalidBehavior)); }
[ "public", "function", "get", "(", "$", "id", ",", "$", "invalidBehavior", "=", "/* self::EXCEPTION_ON_INVALID_REFERENCE */", "1", ")", "{", "return", "$", "this", "->", "services", "[", "$", "id", "]", "??", "$", "this", "->", "services", "[", "$", "id", ...
Gets a service. @param string $id The service identifier @param int $invalidBehavior The behavior when the service does not exist @return object The associated service @throws ServiceCircularReferenceException When a circular reference is detected @throws ServiceNotFoundException When the service is not defined @throws \Exception if an exception has been thrown when the service has been resolved @see Reference
[ "Gets", "a", "service", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Container.php#L221-L226
train
Get a service container
[ 30522, 2270, 3853, 2131, 1006, 1002, 8909, 1010, 1002, 19528, 4783, 3270, 25500, 2099, 1027, 1013, 1008, 2969, 1024, 1024, 6453, 1035, 2006, 1035, 19528, 1035, 4431, 1008, 1013, 1015, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2578, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
GetSetMethodNormalizer.getAttributeValue
protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { $ucfirsted = ucfirst($attribute); $getter = 'get'.$ucfirsted; if (\is_callable([$object, $getter])) { return $object->$getter(); } $isser = 'is'.$ucfirsted; if (\is_callable([$object, $isser])) { return $object->$isser(); } $haser = 'has'.$ucfirsted; if (\is_callable([$object, $haser])) { return $object->$haser(); } }
php
protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { $ucfirsted = ucfirst($attribute); $getter = 'get'.$ucfirsted; if (\is_callable([$object, $getter])) { return $object->$getter(); } $isser = 'is'.$ucfirsted; if (\is_callable([$object, $isser])) { return $object->$isser(); } $haser = 'has'.$ucfirsted; if (\is_callable([$object, $haser])) { return $object->$haser(); } }
[ "protected", "function", "getAttributeValue", "(", "$", "object", ",", "$", "attribute", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "ucfirsted", "=", "ucfirst", "(", "$", "attribute", ")", ";", "$", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php#L124-L142
train
Get the value of an attribute from an object
[ 30522, 5123, 3853, 2131, 19321, 3089, 8569, 2618, 10175, 5657, 1006, 1002, 4874, 1010, 1002, 17961, 1010, 1002, 4289, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 1002, 15384, 8873, 12096, 2098, 1027, 15384, 8873, 1209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Report.php
Report.fetchSubtable
public function fetchSubtable($idSubtable, $paramOverride = array()) { $paramOverride = array('idSubtable' => $idSubtable) + $paramOverride; list($module, $action) = $this->getSubtableApiMethod(); return Request::processRequest($module . '.' . $action, $paramOverride); }
php
public function fetchSubtable($idSubtable, $paramOverride = array()) { $paramOverride = array('idSubtable' => $idSubtable) + $paramOverride; list($module, $action) = $this->getSubtableApiMethod(); return Request::processRequest($module . '.' . $action, $paramOverride); }
[ "public", "function", "fetchSubtable", "(", "$", "idSubtable", ",", "$", "paramOverride", "=", "array", "(", ")", ")", "{", "$", "paramOverride", "=", "array", "(", "'idSubtable'", "=>", "$", "idSubtable", ")", "+", "$", "paramOverride", ";", "list", "(", ...
Fetches a subtable for the report represented by this instance. @param int $idSubtable The subtable ID. @param array $paramOverride Query parameter overrides. @return DataTable @api
[ "Fetches", "a", "subtable", "for", "the", "report", "represented", "by", "this", "instance", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Report.php#L885-L891
train
Fetch the subtable from the request
[ 30522, 2270, 3853, 18584, 6342, 19279, 3085, 1006, 1002, 8909, 6342, 19279, 3085, 1010, 1002, 11498, 5302, 6299, 15637, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 11498, 5302, 6299, 15637, 1027, 9140, 1006, 1005, 8909, 6342, 19279, 3085, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/formwidgets/Repeater.php
Repeater.processGroupMode
protected function processGroupMode() { $palette = []; if (!$group = $this->getConfig('groups', [])) { $this->useGroups = false; return; } if (is_string($group)) { $group = $this->makeConfig($group); } foreach ($group as $code => $config) { $palette[$code] = [ 'code' => $code, 'name' => array_get($config, 'name'), 'icon' => array_get($config, 'icon', 'icon-square-o'), 'description' => array_get($config, 'description'), 'fields' => array_get($config, 'fields') ]; } $this->groupDefinitions = $palette; $this->useGroups = true; }
php
protected function processGroupMode() { $palette = []; if (!$group = $this->getConfig('groups', [])) { $this->useGroups = false; return; } if (is_string($group)) { $group = $this->makeConfig($group); } foreach ($group as $code => $config) { $palette[$code] = [ 'code' => $code, 'name' => array_get($config, 'name'), 'icon' => array_get($config, 'icon', 'icon-square-o'), 'description' => array_get($config, 'description'), 'fields' => array_get($config, 'fields') ]; } $this->groupDefinitions = $palette; $this->useGroups = true; }
[ "protected", "function", "processGroupMode", "(", ")", "{", "$", "palette", "=", "[", "]", ";", "if", "(", "!", "$", "group", "=", "$", "this", "->", "getConfig", "(", "'groups'", ",", "[", "]", ")", ")", "{", "$", "this", "->", "useGroups", "=", ...
Process features related to group mode. @return void
[ "Process", "features", "related", "to", "group", "mode", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/Repeater.php#L359-L384
train
Process Group Mode
[ 30522, 5123, 3853, 2832, 17058, 5302, 3207, 1006, 1007, 1063, 1002, 27396, 1027, 1031, 1033, 1025, 2065, 1006, 999, 1002, 2177, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 8873, 2290, 1006, 1005, 2967, 1005, 1010, 1031, 1033, 1007, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Field/Text.php
Text.json_encode_options
protected function json_encode_options($options) { $data = $this->prepare_options($options); $json = json_encode($data['options']); $json = str_replace($data['toReplace'], $data['original'], $json); return $json; }
php
protected function json_encode_options($options) { $data = $this->prepare_options($options); $json = json_encode($data['options']); $json = str_replace($data['toReplace'], $data['original'], $json); return $json; }
[ "protected", "function", "json_encode_options", "(", "$", "options", ")", "{", "$", "data", "=", "$", "this", "->", "prepare_options", "(", "$", "options", ")", ";", "$", "json", "=", "json_encode", "(", "$", "data", "[", "'options'", "]", ")", ";", "$...
Encode options to Json. @param array $options @return $json
[ "Encode", "options", "to", "Json", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Text.php#L78-L87
train
Encode options into JSON
[ 30522, 5123, 3853, 1046, 3385, 1035, 4372, 16044, 1035, 7047, 1006, 1002, 7047, 1007, 1063, 1002, 2951, 1027, 1002, 2023, 1011, 1028, 7374, 1035, 7047, 1006, 1002, 7047, 1007, 1025, 1002, 1046, 3385, 1027, 1046, 3385, 1035, 4372, 16044, 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/Validate/Callback.php
Zend_Validate_Callback.isValid
public function isValid($value) { $this->_setValue($value); $options = $this->getOptions(); $callback = $this->getCallback(); $args = func_get_args(); $options = array_merge($args, $options); try { if (!call_user_func_array($callback, $options)) { $this->_error(self::INVALID_VALUE); return false; } } catch (Exception $e) { $this->_error(self::INVALID_CALLBACK); return false; } return true; }
php
public function isValid($value) { $this->_setValue($value); $options = $this->getOptions(); $callback = $this->getCallback(); $args = func_get_args(); $options = array_merge($args, $options); try { if (!call_user_func_array($callback, $options)) { $this->_error(self::INVALID_VALUE); return false; } } catch (Exception $e) { $this->_error(self::INVALID_CALLBACK); return false; } return true; }
[ "public", "function", "isValid", "(", "$", "value", ")", "{", "$", "this", "->", "_setValue", "(", "$", "value", ")", ";", "$", "options", "=", "$", "this", "->", "getOptions", "(", ")", ";", "$", "callback", "=", "$", "this", "->", "getCallback", ...
Defined by Zend_Validate_Interface Returns true if and only if the set callback returns for the provided $value @param mixed $value @return boolean
[ "Defined", "by", "Zend_Validate_Interface" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Callback.php#L153-L173
train
Valida o valor de una podstawie
[ 30522, 2270, 3853, 2003, 10175, 3593, 1006, 1002, 3643, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 2275, 10175, 5657, 1006, 1002, 3643, 1007, 1025, 1002, 7047, 1027, 1002, 2023, 1011, 1028, 2131, 7361, 9285, 1006, 1007, 1025, 1002, 2655, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php
ActivationMiddleware.handle
public function handle(Envelope $envelope, StackInterface $stack): Envelope { if (\is_callable($this->activated) ? ($this->activated)($envelope) : $this->activated) { return $this->inner->handle($envelope, $stack); } return $stack->next()->handle($envelope, $stack); }
php
public function handle(Envelope $envelope, StackInterface $stack): Envelope { if (\is_callable($this->activated) ? ($this->activated)($envelope) : $this->activated) { return $this->inner->handle($envelope, $stack); } return $stack->next()->handle($envelope, $stack); }
[ "public", "function", "handle", "(", "Envelope", "$", "envelope", ",", "StackInterface", "$", "stack", ")", ":", "Envelope", "{", "if", "(", "\\", "is_callable", "(", "$", "this", "->", "activated", ")", "?", "(", "$", "this", "->", "activated", ")", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php#L40-L47
train
Handle the message
[ 30522, 2270, 3853, 5047, 1006, 11255, 1002, 11255, 1010, 9991, 18447, 2121, 12172, 1002, 9991, 1007, 1024, 11255, 1063, 2065, 1006, 1032, 2003, 1035, 2655, 3085, 1006, 1002, 2023, 1011, 1028, 8878, 1007, 1029, 1006, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
Deprecation.getPackage
private function getPackage($path) { $path = realpath($path) ?: $path; foreach (self::getVendors() as $vendorRoot) { if (0 === strpos($path, $vendorRoot)) { $relativePath = substr($path, \strlen($vendorRoot) + 1); $vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true); if (false === $vendor) { throw new \RuntimeException(sprintf('Could not find directory separator "%s" in path "%s"', \DIRECTORY_SEPARATOR, $relativePath)); } return rtrim($vendor.'/'.strstr(substr( $relativePath, \strlen($vendor) + 1 ), \DIRECTORY_SEPARATOR, true), '/'); } } throw new \RuntimeException(sprintf('No vendors found for path "%s"', $path)); }
php
private function getPackage($path) { $path = realpath($path) ?: $path; foreach (self::getVendors() as $vendorRoot) { if (0 === strpos($path, $vendorRoot)) { $relativePath = substr($path, \strlen($vendorRoot) + 1); $vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true); if (false === $vendor) { throw new \RuntimeException(sprintf('Could not find directory separator "%s" in path "%s"', \DIRECTORY_SEPARATOR, $relativePath)); } return rtrim($vendor.'/'.strstr(substr( $relativePath, \strlen($vendor) + 1 ), \DIRECTORY_SEPARATOR, true), '/'); } } throw new \RuntimeException(sprintf('No vendors found for path "%s"', $path)); }
[ "private", "function", "getPackage", "(", "$", "path", ")", "{", "$", "path", "=", "realpath", "(", "$", "path", ")", "?", ":", "$", "path", ";", "foreach", "(", "self", "::", "getVendors", "(", ")", "as", "$", "vendorRoot", ")", "{", "if", "(", ...
pathOriginatesFromVendor() should always be called prior to calling this method. @param string $path @return string
[ "pathOriginatesFromVendor", "()", "should", "always", "be", "called", "prior", "to", "calling", "this", "method", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php#L203-L222
train
Get the package path
[ 30522, 2797, 3853, 2131, 23947, 4270, 1006, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 2613, 15069, 1006, 1002, 4130, 1007, 1029, 1024, 1002, 4130, 1025, 18921, 6776, 1006, 2969, 1024, 1024, 2131, 8159, 7983, 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...
laravel/framework
src/Illuminate/Console/GeneratorCommand.php
GeneratorCommand.replaceNamespace
protected function replaceNamespace(&$stub, $name) { $stub = str_replace( ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'], [$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()], $stub ); return $this; }
php
protected function replaceNamespace(&$stub, $name) { $stub = str_replace( ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'], [$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()], $stub ); return $this; }
[ "protected", "function", "replaceNamespace", "(", "&", "$", "stub", ",", "$", "name", ")", "{", "$", "stub", "=", "str_replace", "(", "[", "'DummyNamespace'", ",", "'DummyRootNamespace'", ",", "'NamespacedDummyUserModel'", "]", ",", "[", "$", "this", "->", "...
Replace the namespace for the given stub. @param string $stub @param string $name @return $this
[ "Replace", "the", "namespace", "for", "the", "given", "stub", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/GeneratorCommand.php#L172-L181
train
Replace namespace dummy
[ 30522, 5123, 3853, 5672, 18442, 23058, 1006, 1004, 1002, 24646, 2497, 1010, 1002, 2171, 1007, 1063, 1002, 24646, 2497, 1027, 2358, 2099, 1035, 5672, 1006, 1031, 1005, 24369, 18442, 23058, 1005, 1010, 1005, 24369, 3217, 4140, 18442, 23058, 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/Validator/Validator/RecursiveContextualValidator.php
RecursiveContextualValidator.validateClassNode
private function validateClassNode($object, $cacheKey, ClassMetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) { $context->setNode($object, $object, $metadata, $propertyPath); if (!$context->isObjectInitialized($cacheKey)) { foreach ($this->objectInitializers as $initializer) { $initializer->initialize($object); } $context->markObjectAsInitialized($cacheKey); } foreach ($groups as $key => $group) { // If the "Default" group is replaced by a group sequence, remember // to cascade the "Default" group when traversing the group // sequence $defaultOverridden = false; // Use the object hash for group sequences $groupHash = \is_object($group) ? spl_object_hash($group) : $group; if ($context->isGroupValidated($cacheKey, $groupHash)) { // Skip this group when validating the properties and when // traversing the object unset($groups[$key]); continue; } $context->markGroupAsValidated($cacheKey, $groupHash); // Replace the "Default" group by the group sequence defined // for the class, if applicable. // This is done after checking the cache, so that // spl_object_hash() isn't called for this sequence and // "Default" is used instead in the cache. This is useful // if the getters below return different group sequences in // every call. if (Constraint::DEFAULT_GROUP === $group) { if ($metadata->hasGroupSequence()) { // The group sequence is statically defined for the class $group = $metadata->getGroupSequence(); $defaultOverridden = true; } elseif ($metadata->isGroupSequenceProvider()) { // The group sequence is dynamically obtained from the validated // object /* @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */ $group = $object->getGroupSequence(); $defaultOverridden = true; if (!$group instanceof GroupSequence) { $group = new GroupSequence($group); } } } // If the groups (=[<G1,G2>,G3,G4]) contain a group sequence // (=<G1,G2>), then call validateClassNode() with each entry of the // group sequence and abort if necessary (G1, G2) if ($group instanceof GroupSequence) { $this->stepThroughGroupSequence( $object, $object, $cacheKey, $metadata, $propertyPath, $traversalStrategy, $group, $defaultOverridden ? Constraint::DEFAULT_GROUP : null, $context ); // Skip the group sequence when validating properties, because // stepThroughGroupSequence() already validates the properties unset($groups[$key]); continue; } $this->validateInGroup($object, $cacheKey, $metadata, $group, $context); } // If no more groups should be validated for the property nodes, // we can safely quit if (0 === \count($groups)) { return; } // Validate all properties against their constraints foreach ($metadata->getConstrainedProperties() as $propertyName) { // If constraints are defined both on the getter of a property as // well as on the property itself, then getPropertyMetadata() // returns two metadata objects, not just one foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { if (!$propertyMetadata instanceof PropertyMetadataInterface) { throw new UnsupportedMetadataException(sprintf('The property metadata instances should implement "Symfony\Component\Validator\Mapping\PropertyMetadataInterface", got: "%s".', \is_object($propertyMetadata) ? \get_class($propertyMetadata) : \gettype($propertyMetadata))); } $propertyValue = $propertyMetadata->getPropertyValue($object); $this->validateGenericNode( $propertyValue, $object, $cacheKey.':'.\get_class($object).':'.$propertyName, $propertyMetadata, PropertyPath::append($propertyPath, $propertyName), $groups, $cascadedGroups, TraversalStrategy::IMPLICIT, $context ); } } // If no specific traversal strategy was requested when this method // was called, use the traversal strategy of the class' metadata if ($traversalStrategy & TraversalStrategy::IMPLICIT) { $traversalStrategy = $metadata->getTraversalStrategy(); } // Traverse only if IMPLICIT or TRAVERSE if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { return; } // If IMPLICIT, stop unless we deal with a Traversable if ($traversalStrategy & TraversalStrategy::IMPLICIT && !$object instanceof \Traversable) { return; } // If TRAVERSE, fail if we have no Traversable if (!$object instanceof \Traversable) { throw new ConstraintDefinitionException(sprintf('Traversal was enabled for "%s", but this class does not implement "\Traversable".', \get_class($object))); } $this->validateEachObjectIn( $object, $propertyPath, $groups, $context ); }
php
private function validateClassNode($object, $cacheKey, ClassMetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) { $context->setNode($object, $object, $metadata, $propertyPath); if (!$context->isObjectInitialized($cacheKey)) { foreach ($this->objectInitializers as $initializer) { $initializer->initialize($object); } $context->markObjectAsInitialized($cacheKey); } foreach ($groups as $key => $group) { // If the "Default" group is replaced by a group sequence, remember // to cascade the "Default" group when traversing the group // sequence $defaultOverridden = false; // Use the object hash for group sequences $groupHash = \is_object($group) ? spl_object_hash($group) : $group; if ($context->isGroupValidated($cacheKey, $groupHash)) { // Skip this group when validating the properties and when // traversing the object unset($groups[$key]); continue; } $context->markGroupAsValidated($cacheKey, $groupHash); // Replace the "Default" group by the group sequence defined // for the class, if applicable. // This is done after checking the cache, so that // spl_object_hash() isn't called for this sequence and // "Default" is used instead in the cache. This is useful // if the getters below return different group sequences in // every call. if (Constraint::DEFAULT_GROUP === $group) { if ($metadata->hasGroupSequence()) { // The group sequence is statically defined for the class $group = $metadata->getGroupSequence(); $defaultOverridden = true; } elseif ($metadata->isGroupSequenceProvider()) { // The group sequence is dynamically obtained from the validated // object /* @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */ $group = $object->getGroupSequence(); $defaultOverridden = true; if (!$group instanceof GroupSequence) { $group = new GroupSequence($group); } } } // If the groups (=[<G1,G2>,G3,G4]) contain a group sequence // (=<G1,G2>), then call validateClassNode() with each entry of the // group sequence and abort if necessary (G1, G2) if ($group instanceof GroupSequence) { $this->stepThroughGroupSequence( $object, $object, $cacheKey, $metadata, $propertyPath, $traversalStrategy, $group, $defaultOverridden ? Constraint::DEFAULT_GROUP : null, $context ); // Skip the group sequence when validating properties, because // stepThroughGroupSequence() already validates the properties unset($groups[$key]); continue; } $this->validateInGroup($object, $cacheKey, $metadata, $group, $context); } // If no more groups should be validated for the property nodes, // we can safely quit if (0 === \count($groups)) { return; } // Validate all properties against their constraints foreach ($metadata->getConstrainedProperties() as $propertyName) { // If constraints are defined both on the getter of a property as // well as on the property itself, then getPropertyMetadata() // returns two metadata objects, not just one foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { if (!$propertyMetadata instanceof PropertyMetadataInterface) { throw new UnsupportedMetadataException(sprintf('The property metadata instances should implement "Symfony\Component\Validator\Mapping\PropertyMetadataInterface", got: "%s".', \is_object($propertyMetadata) ? \get_class($propertyMetadata) : \gettype($propertyMetadata))); } $propertyValue = $propertyMetadata->getPropertyValue($object); $this->validateGenericNode( $propertyValue, $object, $cacheKey.':'.\get_class($object).':'.$propertyName, $propertyMetadata, PropertyPath::append($propertyPath, $propertyName), $groups, $cascadedGroups, TraversalStrategy::IMPLICIT, $context ); } } // If no specific traversal strategy was requested when this method // was called, use the traversal strategy of the class' metadata if ($traversalStrategy & TraversalStrategy::IMPLICIT) { $traversalStrategy = $metadata->getTraversalStrategy(); } // Traverse only if IMPLICIT or TRAVERSE if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { return; } // If IMPLICIT, stop unless we deal with a Traversable if ($traversalStrategy & TraversalStrategy::IMPLICIT && !$object instanceof \Traversable) { return; } // If TRAVERSE, fail if we have no Traversable if (!$object instanceof \Traversable) { throw new ConstraintDefinitionException(sprintf('Traversal was enabled for "%s", but this class does not implement "\Traversable".', \get_class($object))); } $this->validateEachObjectIn( $object, $propertyPath, $groups, $context ); }
[ "private", "function", "validateClassNode", "(", "$", "object", ",", "$", "cacheKey", ",", "ClassMetadataInterface", "$", "metadata", "=", "null", ",", "$", "propertyPath", ",", "array", "$", "groups", ",", "$", "cascadedGroups", ",", "$", "traversalStrategy", ...
Validates a class node. A class node is a combination of an object with a {@link ClassMetadataInterface} instance. Each class node (conceptionally) has zero or more succeeding property nodes: (Article:class node) \ ($title:property node) This method validates the passed objects against all constraints defined at class level. It furthermore triggers the validation of each of the class' properties against the constraints for that property. If the selected traversal strategy allows traversal, the object is iterated and each nested object is validated against its own constraints. The object is not traversed if traversal is disabled in the class metadata. If the passed groups contain the group "Default", the validator will check whether the "Default" group has been replaced by a group sequence in the class metadata. If this is the case, the group sequence is validated instead. @param object $object The validated object @param string $cacheKey The key for caching the validated object @param ClassMetadataInterface $metadata The class metadata of the object @param string $propertyPath The property path leading to the object @param (string|GroupSequence)[] $groups The groups in which the object should be validated @param string[]|null $cascadedGroups The groups in which cascaded objects should be validated @param int $traversalStrategy The strategy used for traversing the object @param ExecutionContextInterface $context The current execution context @throws UnsupportedMetadataException If a property metadata does not implement {@link PropertyMetadataInterface} @throws ConstraintDefinitionException If traversal was enabled but the object does not implement {@link \Traversable} @see TraversalStrategy
[ "Validates", "a", "class", "node", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php#L440-L581
train
Validate a class node
[ 30522, 2797, 3853, 9398, 3686, 26266, 3630, 3207, 1006, 1002, 4874, 1010, 1002, 17053, 14839, 1010, 2465, 11368, 8447, 18249, 3334, 12172, 1002, 27425, 1027, 19701, 1010, 1002, 3200, 15069, 1010, 9140, 1002, 2967, 1010, 1002, 16690, 2094, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/AttributeTranslator.php
AttributeTranslator._set_table_row_bgcolor
static protected function _set_table_row_bgcolor(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); $value = self::_get_valid_color($value); foreach ($cell_list as $cell) { self::append_style($cell, "; background-color: $value;"); } return null; }
php
static protected function _set_table_row_bgcolor(\DOMElement $node, $value) { $cell_list = self::get_cell_list($node); $value = self::_get_valid_color($value); foreach ($cell_list as $cell) { self::append_style($cell, "; background-color: $value;"); } return null; }
[ "static", "protected", "function", "_set_table_row_bgcolor", "(", "\\", "DOMElement", "$", "node", ",", "$", "value", ")", "{", "$", "cell_list", "=", "self", "::", "get_cell_list", "(", "$", "node", ")", ";", "$", "value", "=", "self", "::", "_get_valid_c...
@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#L572-L582
train
Set Table Row Background Color
[ 30522, 10763, 5123, 3853, 1035, 2275, 1035, 2795, 1035, 5216, 1035, 1038, 18195, 12898, 2099, 1006, 1032, 8514, 16930, 4765, 1002, 13045, 1010, 1002, 3643, 1007, 1063, 1002, 3526, 1035, 2862, 1027, 2969, 1024, 1024, 2131, 1035, 3526, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/FormRegistry.php
FormRegistry.hasType
public function hasType($name) { if (isset($this->types[$name])) { return true; } try { $this->getType($name); } catch (ExceptionInterface $e) { return false; } return true; }
php
public function hasType($name) { if (isset($this->types[$name])) { return true; } try { $this->getType($name); } catch (ExceptionInterface $e) { return false; } return true; }
[ "public", "function", "hasType", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "types", "[", "$", "name", "]", ")", ")", "{", "return", "true", ";", "}", "try", "{", "$", "this", "->", "getType", "(", "$", "name", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormRegistry.php#L143-L156
train
Check if a type exists
[ 30522, 2270, 3853, 27151, 5051, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 4127, 1031, 1002, 2171, 1033, 1007, 1007, 1063, 2709, 2995, 1025, 1065, 3046, 1063, 1002, 2023, 1011, 1028, 2131, 13874, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Dotenv/Dotenv.php
Dotenv.loadEnv
public function loadEnv(string $path, string $varName = 'APP_ENV', string $defaultEnv = 'dev', array $testEnvs = ['test']): void { if (file_exists($path) || !file_exists($p = "$path.dist")) { $this->load($path); } else { $this->load($p); } if (null === $env = $_SERVER[$varName] ?? $_ENV[$varName] ?? null) { $this->populate([$varName => $env = $defaultEnv]); } if (!\in_array($env, $testEnvs, true) && file_exists($p = "$path.local")) { $this->load($p); $env = $_SERVER[$varName] ?? $_ENV[$varName] ?? $env; } if ('local' === $env) { return; } if (file_exists($p = "$path.$env")) { $this->load($p); } if (file_exists($p = "$path.$env.local")) { $this->load($p); } }
php
public function loadEnv(string $path, string $varName = 'APP_ENV', string $defaultEnv = 'dev', array $testEnvs = ['test']): void { if (file_exists($path) || !file_exists($p = "$path.dist")) { $this->load($path); } else { $this->load($p); } if (null === $env = $_SERVER[$varName] ?? $_ENV[$varName] ?? null) { $this->populate([$varName => $env = $defaultEnv]); } if (!\in_array($env, $testEnvs, true) && file_exists($p = "$path.local")) { $this->load($p); $env = $_SERVER[$varName] ?? $_ENV[$varName] ?? $env; } if ('local' === $env) { return; } if (file_exists($p = "$path.$env")) { $this->load($p); } if (file_exists($p = "$path.$env.local")) { $this->load($p); } }
[ "public", "function", "loadEnv", "(", "string", "$", "path", ",", "string", "$", "varName", "=", "'APP_ENV'", ",", "string", "$", "defaultEnv", "=", "'dev'", ",", "array", "$", "testEnvs", "=", "[", "'test'", "]", ")", ":", "void", "{", "if", "(", "f...
Loads a .env file and the corresponding .env.local, .env.$env and .env.$env.local files if they exist. .env.local is always ignored in test env because tests should produce the same results for everyone. .env.dist is loaded when it exists and .env is not found. @param string $path A file to load @param string $varName The name of the env vars that defines the app env @param string $defaultEnv The app env to use when none is defined @param array $testEnvs A list of app envs for which .env.local should be ignored @throws FormatException when a file has a syntax error @throws PathException when a file does not exist or is not readable
[ "Loads", "a", ".", "env", "file", "and", "the", "corresponding", ".", "env", ".", "local", ".", "env", ".", "$env", "and", ".", "env", ".", "$env", ".", "local", "files", "if", "they", "exist", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Dotenv/Dotenv.php#L82-L110
train
Load environment variables from path. env.
[ 30522, 2270, 3853, 7170, 2368, 2615, 1006, 5164, 1002, 4130, 1010, 5164, 1002, 13075, 18442, 1027, 1005, 10439, 1035, 4372, 2615, 1005, 1010, 5164, 1002, 12398, 2368, 2615, 1027, 1005, 16475, 1005, 1010, 9140, 1002, 3231, 2368, 15088, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Theme.php
Theme.__isset
public function __isset($key) { if ($this->hasCustomData()) { $theme = $this->getCustomData(); return $theme->offsetExists($key); } return false; }
php
public function __isset($key) { if ($this->hasCustomData()) { $theme = $this->getCustomData(); return $theme->offsetExists($key); } return false; }
[ "public", "function", "__isset", "(", "$", "key", ")", "{", "if", "(", "$", "this", "->", "hasCustomData", "(", ")", ")", "{", "$", "theme", "=", "$", "this", "->", "getCustomData", "(", ")", ";", "return", "$", "theme", "->", "offsetExists", "(", ...
Determine if an attribute exists on the object. @param string $key @return void
[ "Determine", "if", "an", "attribute", "exists", "on", "the", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L540-L548
train
Return TRUE if the value of the key exists in the theme
[ 30522, 2270, 3853, 1035, 1035, 26354, 3388, 1006, 1002, 3145, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2038, 7874, 20389, 2850, 2696, 1006, 1007, 1007, 1063, 1002, 4323, 1027, 1002, 2023, 1011, 1028, 2131, 7874, 20389, 2850, 2696, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SegmentEditor/Model.php
Model.getSegmentsToAutoArchive
public function getSegmentsToAutoArchive($idSite = false) { $bind = array(); $whereIdSite = ''; if (!empty($idSite)) { $whereIdSite = 'enable_only_idsite = ? OR '; $bind[] = $idSite; } $sql = $this->buildQuerySortedByName("($whereIdSite enable_only_idsite = 0) AND deleted = 0 AND auto_archive = 1"); $segments = $this->getDb()->fetchAll($sql, $bind); return $segments; }
php
public function getSegmentsToAutoArchive($idSite = false) { $bind = array(); $whereIdSite = ''; if (!empty($idSite)) { $whereIdSite = 'enable_only_idsite = ? OR '; $bind[] = $idSite; } $sql = $this->buildQuerySortedByName("($whereIdSite enable_only_idsite = 0) AND deleted = 0 AND auto_archive = 1"); $segments = $this->getDb()->fetchAll($sql, $bind); return $segments; }
[ "public", "function", "getSegmentsToAutoArchive", "(", "$", "idSite", "=", "false", ")", "{", "$", "bind", "=", "array", "(", ")", ";", "$", "whereIdSite", "=", "''", ";", "if", "(", "!", "empty", "(", "$", "idSite", ")", ")", "{", "$", "whereIdSite"...
Returns all stored segments. @param bool|int $idSite Whether to return stored segments for a specific idSite, or segments that are available for all sites. If supplied, must be a valid site ID. @return array
[ "Returns", "all", "stored", "segments", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/Model.php#L49-L65
train
Get all segments that should be archived
[ 30522, 2270, 3853, 4152, 13910, 8163, 3406, 4887, 3406, 2906, 5428, 3726, 1006, 1002, 8909, 28032, 2063, 1027, 6270, 1007, 1063, 1002, 14187, 1027, 9140, 1006, 1007, 1025, 1002, 2073, 9821, 4221, 1027, 1005, 1005, 1025, 2065, 1006, 999, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
ConsumeMessagesCommand.configure
protected function configure(): void { $defaultReceiverName = 1 === \count($this->receiverNames) ? current($this->receiverNames) : null; $this ->setDefinition([ new InputArgument('receivers', InputArgument::IS_ARRAY, 'Names of the receivers/transports to consume in order of priority', $defaultReceiverName ? [$defaultReceiverName] : []), new InputOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Limit the number of received messages'), new InputOption('memory-limit', 'm', InputOption::VALUE_REQUIRED, 'The memory limit the worker can consume'), new InputOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'The time limit in seconds the worker can run'), new InputOption('sleep', null, InputOption::VALUE_REQUIRED, 'Seconds to sleep before asking for new messages after no messages were found', 1), new InputOption('bus', 'b', InputOption::VALUE_REQUIRED, 'Name of the bus to which received messages should be dispatched (if not passed, bus is determined automatically.'), ]) ->setDescription('Consumes messages') ->setHelp(<<<'EOF' The <info>%command.name%</info> command consumes messages and dispatches them to the message bus. <info>php %command.full_name% <receiver-name></info> To receive from multiple transports, pass each name: <info>php %command.full_name% receiver1 receiver2</info> Use the --limit option to limit the number of messages received: <info>php %command.full_name% <receiver-name> --limit=10</info> Use the --memory-limit option to stop the worker if it exceeds a given memory usage limit. You can use shorthand byte values [K, M or G]: <info>php %command.full_name% <receiver-name> --memory-limit=128M</info> Use the --time-limit option to stop the worker when the given time limit (in seconds) is reached: <info>php %command.full_name% <receiver-name> --time-limit=3600</info> Use the --bus option to specify the message bus to dispatch received messages to instead of trying to determine it automatically. This is required if the messages didn't originate from Messenger: <info>php %command.full_name% <receiver-name> --bus=event_bus</info> EOF ) ; }
php
protected function configure(): void { $defaultReceiverName = 1 === \count($this->receiverNames) ? current($this->receiverNames) : null; $this ->setDefinition([ new InputArgument('receivers', InputArgument::IS_ARRAY, 'Names of the receivers/transports to consume in order of priority', $defaultReceiverName ? [$defaultReceiverName] : []), new InputOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Limit the number of received messages'), new InputOption('memory-limit', 'm', InputOption::VALUE_REQUIRED, 'The memory limit the worker can consume'), new InputOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'The time limit in seconds the worker can run'), new InputOption('sleep', null, InputOption::VALUE_REQUIRED, 'Seconds to sleep before asking for new messages after no messages were found', 1), new InputOption('bus', 'b', InputOption::VALUE_REQUIRED, 'Name of the bus to which received messages should be dispatched (if not passed, bus is determined automatically.'), ]) ->setDescription('Consumes messages') ->setHelp(<<<'EOF' The <info>%command.name%</info> command consumes messages and dispatches them to the message bus. <info>php %command.full_name% <receiver-name></info> To receive from multiple transports, pass each name: <info>php %command.full_name% receiver1 receiver2</info> Use the --limit option to limit the number of messages received: <info>php %command.full_name% <receiver-name> --limit=10</info> Use the --memory-limit option to stop the worker if it exceeds a given memory usage limit. You can use shorthand byte values [K, M or G]: <info>php %command.full_name% <receiver-name> --memory-limit=128M</info> Use the --time-limit option to stop the worker when the given time limit (in seconds) is reached: <info>php %command.full_name% <receiver-name> --time-limit=3600</info> Use the --bus option to specify the message bus to dispatch received messages to instead of trying to determine it automatically. This is required if the messages didn't originate from Messenger: <info>php %command.full_name% <receiver-name> --bus=event_bus</info> EOF ) ; }
[ "protected", "function", "configure", "(", ")", ":", "void", "{", "$", "defaultReceiverName", "=", "1", "===", "\\", "count", "(", "$", "this", "->", "receiverNames", ")", "?", "current", "(", "$", "this", "->", "receiverNames", ")", ":", "null", ";", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php#L78-L121
train
Configures the command line options
[ 30522, 5123, 3853, 9530, 8873, 27390, 2063, 1006, 1007, 1024, 11675, 1063, 1002, 12398, 2890, 3401, 16402, 18442, 1027, 1015, 1027, 1027, 1027, 1032, 4175, 1006, 1002, 2023, 1011, 1028, 8393, 18442, 2015, 1007, 1029, 2783, 1006, 1002, 2023,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/thrift
lib/php/lib/Server/TSimpleServer.php
TSimpleServer.serve
public function serve() { $this->transport_->listen(); while (!$this->stop_) { try { $transport = $this->transport_->accept(); if ($transport != null) { $inputTransport = $this->inputTransportFactory_->getTransport($transport); $outputTransport = $this->outputTransportFactory_->getTransport($transport); $inputProtocol = $this->inputProtocolFactory_->getProtocol($inputTransport); $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport); while ($this->processor_->process($inputProtocol, $outputProtocol)) { } } } catch (TTransportException $e) { } } }
php
public function serve() { $this->transport_->listen(); while (!$this->stop_) { try { $transport = $this->transport_->accept(); if ($transport != null) { $inputTransport = $this->inputTransportFactory_->getTransport($transport); $outputTransport = $this->outputTransportFactory_->getTransport($transport); $inputProtocol = $this->inputProtocolFactory_->getProtocol($inputTransport); $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport); while ($this->processor_->process($inputProtocol, $outputProtocol)) { } } } catch (TTransportException $e) { } } }
[ "public", "function", "serve", "(", ")", "{", "$", "this", "->", "transport_", "->", "listen", "(", ")", ";", "while", "(", "!", "$", "this", "->", "stop_", ")", "{", "try", "{", "$", "transport", "=", "$", "this", "->", "transport_", "->", "accept...
Listens for new client using the supplied transport. It handles TTransportExceptions to avoid timeouts etc killing it @return void
[ "Listens", "for", "new", "client", "using", "the", "supplied", "transport", ".", "It", "handles", "TTransportExceptions", "to", "avoid", "timeouts", "etc", "killing", "it" ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Server/TSimpleServer.php#L28-L47
train
Serves the transport and processes the incoming messages.
[ 30522, 2270, 3853, 3710, 1006, 1007, 1063, 1002, 2023, 30524, 1002, 2023, 1011, 1028, 2644, 1035, 1007, 1063, 3046, 1063, 1002, 3665, 1027, 1002, 2023, 1011, 1028, 3665, 1035, 1011, 1028, 5138, 1006, 1007, 1025, 2065, 1006, 1002, 3665, 99...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Controllers/AssetController.php
AssetController.js
public function js() { $renderer = $this->debugbar->getJavascriptRenderer(); $content = $renderer->dumpAssetsToString('js'); $response = new Response( $content, 200, [ 'Content-Type' => 'text/javascript', ] ); return $this->cacheResponse($response); }
php
public function js() { $renderer = $this->debugbar->getJavascriptRenderer(); $content = $renderer->dumpAssetsToString('js'); $response = new Response( $content, 200, [ 'Content-Type' => 'text/javascript', ] ); return $this->cacheResponse($response); }
[ "public", "function", "js", "(", ")", "{", "$", "renderer", "=", "$", "this", "->", "debugbar", "->", "getJavascriptRenderer", "(", ")", ";", "$", "content", "=", "$", "renderer", "->", "dumpAssetsToString", "(", "'js'", ")", ";", "$", "response", "=", ...
Return the javascript for the Debugbar @return \Symfony\Component\HttpFoundation\Response
[ "Return", "the", "javascript", "for", "the", "Debugbar" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/Controllers/AssetController.php#L12-L25
train
Returns the javascript content of the page
[ 30522, 2270, 3853, 1046, 2015, 1006, 1007, 1063, 1002, 17552, 2121, 1027, 1002, 2023, 1011, 1028, 2139, 8569, 18259, 2906, 1011, 1028, 2131, 3900, 12044, 23235, 7389, 4063, 2121, 1006, 1007, 1025, 1002, 4180, 1027, 1002, 17552, 2121, 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...
symfony/symfony
src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
ArrayAdapter.getItem
public function getItem($key) { if (!$isHit = $this->hasItem($key)) { $this->values[$key] = $value = null; } else { $value = $this->storeSerialized ? $this->unfreeze($key, $isHit) : $this->values[$key]; } $f = $this->createCacheItem; return $f($key, $value, $isHit); }
php
public function getItem($key) { if (!$isHit = $this->hasItem($key)) { $this->values[$key] = $value = null; } else { $value = $this->storeSerialized ? $this->unfreeze($key, $isHit) : $this->values[$key]; } $f = $this->createCacheItem; return $f($key, $value, $isHit); }
[ "public", "function", "getItem", "(", "$", "key", ")", "{", "if", "(", "!", "$", "isHit", "=", "$", "this", "->", "hasItem", "(", "$", "key", ")", ")", "{", "$", "this", "->", "values", "[", "$", "key", "]", "=", "$", "value", "=", "null", ";...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php#L71-L81
train
Get an item from the cache
[ 30522, 2270, 3853, 2131, 4221, 2213, 1006, 1002, 3145, 1007, 1063, 2065, 1006, 999, 1002, 2003, 16584, 1027, 1002, 2023, 1011, 1028, 2038, 4221, 2213, 1006, 1002, 3145, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 5300, 1031, 1002, 3145, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.newQueryForRestoration
public function newQueryForRestoration($ids) { return is_array($ids) ? $this->newQueryWithoutScopes()->whereIn($this->getQualifiedKeyName(), $ids) : $this->newQueryWithoutScopes()->whereKey($ids); }
php
public function newQueryForRestoration($ids) { return is_array($ids) ? $this->newQueryWithoutScopes()->whereIn($this->getQualifiedKeyName(), $ids) : $this->newQueryWithoutScopes()->whereKey($ids); }
[ "public", "function", "newQueryForRestoration", "(", "$", "ids", ")", "{", "return", "is_array", "(", "$", "ids", ")", "?", "$", "this", "->", "newQueryWithoutScopes", "(", ")", "->", "whereIn", "(", "$", "this", "->", "getQualifiedKeyName", "(", ")", ",",...
Get a new query to restore one or more models by their queueable IDs. @param array|int $ids @return \Illuminate\Database\Eloquent\Builder
[ "Get", "a", "new", "query", "to", "restore", "one", "or", "more", "models", "by", "their", "queueable", "IDs", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L1022-L1027
train
Returns a new query for restoration of records
[ 30522, 2270, 3853, 2047, 4226, 2854, 29278, 28533, 21223, 1006, 1002, 8909, 2015, 1007, 1063, 2709, 2003, 1035, 9140, 1006, 1002, 8909, 2015, 1007, 1029, 1002, 2023, 1011, 1028, 2047, 4226, 2854, 24415, 12166, 16186, 2015, 1006, 1007, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php
LogoutUrlGenerator.registerListener
public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null) { $this->listeners[$key] = [$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager, $context]; }
php
public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null) { $this->listeners[$key] = [$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager, $context]; }
[ "public", "function", "registerListener", "(", "$", "key", ",", "$", "logoutPath", ",", "$", "csrfTokenId", ",", "$", "csrfParameter", ",", "CsrfTokenManagerInterface", "$", "csrfTokenManager", "=", "null", ",", "string", "$", "context", "=", "null", ")", "{",...
Registers a firewall's LogoutListener, allowing its URL to be generated. @param string $key The firewall key @param string $logoutPath The path that starts the logout process @param string $csrfTokenId The ID of the CSRF token @param string $csrfParameter The CSRF token parameter name @param CsrfTokenManagerInterface|null $csrfTokenManager A CsrfTokenManagerInterface instance @param string|null $context The listener context
[ "Registers", "a", "firewall", "s", "LogoutListener", "allowing", "its", "URL", "to", "be", "generated", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php#L51-L54
train
Register a Logout Listener
[ 30522, 2270, 3853, 4236, 9863, 24454, 1006, 1002, 3145, 1010, 1002, 8154, 4904, 15069, 1010, 1002, 20116, 12881, 18715, 18595, 2094, 1010, 1002, 20116, 12881, 28689, 22828, 1010, 20116, 12881, 18715, 2368, 24805, 4590, 18447, 2121, 12172, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
Php.getLocation
public function getLocation($info) { $ip = $this->getIpFromInfo($info); if (empty($ip)) { return false; } $result = []; $reader = $this->getGeoIpInstance('loc'); if ($reader) { try { switch ($reader->metadata()->databaseType) { case 'GeoLite2-Country': case 'GeoIP2-Country': $lookupResult = $reader->country($ip); $this->setCountryResults($lookupResult, $result); break; case 'GeoIP2-Enterprise': case 'GeoLite2-City': case 'GeoIP2-City': case 'GeoIP2-City-Africa': case 'GeoIP2-City-Asia-Pacific': case 'GeoIP2-City-Europe': case 'GeoIP2-City-North-America': case 'GeoIP2-City-South-America': if ($reader->metadata()->databaseType === 'GeoIP2-Enterprise') { $lookupResult = $reader->enterprise($ip); } else { $lookupResult = $reader->city($ip); } $this->setCountryResults($lookupResult, $result); $this->setCityResults($lookupResult, $result); break; default: // unknown database type log warning Log::warning("Found unrecognized database type: %s", $reader->metadata()->databaseType); break; } } catch (AddressNotFoundException $e) { // ignore - do nothing } } // NOTE: ISP & ORG require commercial dbs to test. $ispGeoIp = $this->getGeoIpInstance($key = 'isp'); if ($ispGeoIp) { try { switch ($ispGeoIp->metadata()->databaseType) { case 'GeoIP2-ISP': $lookupResult = $ispGeoIp->isp($ip); $result[self::ISP_KEY] = $lookupResult->isp; $result[self::ORG_KEY] = $lookupResult->organization; break; case 'GeoLite2-ASN': $lookupResult = $ispGeoIp->asn($ip); $result[self::ISP_KEY] = $lookupResult->autonomousSystemOrganization; $result[self::ORG_KEY] = $lookupResult->autonomousSystemOrganization; break; } } catch (AddressNotFoundException $e) { // ignore - do nothing } } if (empty($result)) { return false; } $this->completeLocationResult($result); return $result; }
php
public function getLocation($info) { $ip = $this->getIpFromInfo($info); if (empty($ip)) { return false; } $result = []; $reader = $this->getGeoIpInstance('loc'); if ($reader) { try { switch ($reader->metadata()->databaseType) { case 'GeoLite2-Country': case 'GeoIP2-Country': $lookupResult = $reader->country($ip); $this->setCountryResults($lookupResult, $result); break; case 'GeoIP2-Enterprise': case 'GeoLite2-City': case 'GeoIP2-City': case 'GeoIP2-City-Africa': case 'GeoIP2-City-Asia-Pacific': case 'GeoIP2-City-Europe': case 'GeoIP2-City-North-America': case 'GeoIP2-City-South-America': if ($reader->metadata()->databaseType === 'GeoIP2-Enterprise') { $lookupResult = $reader->enterprise($ip); } else { $lookupResult = $reader->city($ip); } $this->setCountryResults($lookupResult, $result); $this->setCityResults($lookupResult, $result); break; default: // unknown database type log warning Log::warning("Found unrecognized database type: %s", $reader->metadata()->databaseType); break; } } catch (AddressNotFoundException $e) { // ignore - do nothing } } // NOTE: ISP & ORG require commercial dbs to test. $ispGeoIp = $this->getGeoIpInstance($key = 'isp'); if ($ispGeoIp) { try { switch ($ispGeoIp->metadata()->databaseType) { case 'GeoIP2-ISP': $lookupResult = $ispGeoIp->isp($ip); $result[self::ISP_KEY] = $lookupResult->isp; $result[self::ORG_KEY] = $lookupResult->organization; break; case 'GeoLite2-ASN': $lookupResult = $ispGeoIp->asn($ip); $result[self::ISP_KEY] = $lookupResult->autonomousSystemOrganization; $result[self::ORG_KEY] = $lookupResult->autonomousSystemOrganization; break; } } catch (AddressNotFoundException $e) { // ignore - do nothing } } if (empty($result)) { return false; } $this->completeLocationResult($result); return $result; }
[ "public", "function", "getLocation", "(", "$", "info", ")", "{", "$", "ip", "=", "$", "this", "->", "getIpFromInfo", "(", "$", "info", ")", ";", "if", "(", "empty", "(", "$", "ip", ")", ")", "{", "return", "false", ";", "}", "$", "result", "=", ...
Uses a GeoIP 2 database to get a visitor's location based on their IP address. This function will return different results based on the data used. If a city database is used, it may return the country code, region code, city name, area code, latitude, longitude and postal code of the visitor. Alternatively, if used with a country database, only the country code will be returned. @param array $info Must have an 'ip' field. @return array|false
[ "Uses", "a", "GeoIP", "2", "database", "to", "get", "a", "visitor", "s", "location", "based", "on", "their", "IP", "address", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php#L87-L157
train
Returns the location from the geocoding information
[ 30522, 2270, 3853, 2131, 4135, 10719, 1006, 1002, 18558, 1007, 1063, 1002, 12997, 1027, 1002, 2023, 1011, 1028, 2131, 11514, 19699, 20936, 2078, 14876, 1006, 1002, 18558, 1007, 1025, 2065, 1006, 4064, 1006, 1002, 12997, 1007, 1007, 1063, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Process/Process.php
Process.run
public function run(callable $callback = null, array $env = []): int { $this->start($callback, $env); return $this->wait(); }
php
public function run(callable $callback = null, array $env = []): int { $this->start($callback, $env); return $this->wait(); }
[ "public", "function", "run", "(", "callable", "$", "callback", "=", "null", ",", "array", "$", "env", "=", "[", "]", ")", ":", "int", "{", "$", "this", "->", "start", "(", "$", "callback", ",", "$", "env", ")", ";", "return", "$", "this", "->", ...
Runs the process. The callback receives the type of output (out or err) and some bytes from the output in real-time. It allows to have feedback from the independent process during execution. The STDOUT and STDERR are also available after the process is finished via the getOutput() and getErrorOutput() methods. @param callable|null $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR @param array $env An array of additional env vars to set when running the process @return int The exit status code @throws RuntimeException When process can't be launched @throws RuntimeException When process stopped after receiving signal @throws LogicException In case a callback is provided and output has been disabled @final
[ "Runs", "the", "process", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L231-L236
train
Starts the execution of the main class.
[ 30522, 2270, 3853, 2448, 1006, 2655, 3085, 1002, 2655, 5963, 1027, 19701, 1010, 9140, 1002, 4372, 2615, 1027, 1031, 1033, 1007, 1024, 20014, 1063, 1002, 2023, 1011, 1028, 2707, 1006, 1002, 2655, 5963, 1010, 1002, 4372, 2615, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Installation/Controller.php
Controller.saveLanguage
public function saveLanguage() { if (DbHelper::isInstalled()) { $this->checkTokenInUrl(); } $language = $this->getParam('language'); LanguagesManager::setLanguageForSession($language); Url::redirectToReferrer(); }
php
public function saveLanguage() { if (DbHelper::isInstalled()) { $this->checkTokenInUrl(); } $language = $this->getParam('language'); LanguagesManager::setLanguageForSession($language); Url::redirectToReferrer(); }
[ "public", "function", "saveLanguage", "(", ")", "{", "if", "(", "DbHelper", "::", "isInstalled", "(", ")", ")", "{", "$", "this", "->", "checkTokenInUrl", "(", ")", ";", "}", "$", "language", "=", "$", "this", "->", "getParam", "(", "'language'", ")", ...
Save language selection in session-store
[ "Save", "language", "selection", "in", "session", "-", "store" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/Controller.php#L477-L485
train
Save language to session
[ 30522, 2270, 3853, 3828, 25023, 6692, 3351, 1006, 1007, 1063, 2065, 1006, 16962, 16001, 4842, 1024, 1024, 2003, 7076, 9080, 3709, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 4638, 18715, 18595, 11231, 12190, 1006, 1007, 1025, 1065, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Data/Validation.php
Validation.typeDatetime
public static function typeDatetime($value, array $params, array $field) { if ($value instanceof \DateTime) { return true; } if (!\is_string($value)) { return false; } if (!isset($params['format'])) { return false !== strtotime($value); } $dateFromFormat = \DateTime::createFromFormat($params['format'], $value); return $dateFromFormat && $value === date($params['format'], $dateFromFormat->getTimestamp()); }
php
public static function typeDatetime($value, array $params, array $field) { if ($value instanceof \DateTime) { return true; } if (!\is_string($value)) { return false; } if (!isset($params['format'])) { return false !== strtotime($value); } $dateFromFormat = \DateTime::createFromFormat($params['format'], $value); return $dateFromFormat && $value === date($params['format'], $dateFromFormat->getTimestamp()); }
[ "public", "static", "function", "typeDatetime", "(", "$", "value", ",", "array", "$", "params", ",", "array", "$", "field", ")", "{", "if", "(", "$", "value", "instanceof", "\\", "DateTime", ")", "{", "return", "true", ";", "}", "if", "(", "!", "\\",...
HTML5 input: datetime @param mixed $value Value to be validated. @param array $params Validation parameters. @param array $field Blueprint for the field. @return bool True if validation succeeded.
[ "HTML5", "input", ":", "datetime" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L447-L462
train
Type if value is a \ DateTime
[ 30522, 2270, 10763, 3853, 21189, 3686, 7292, 1006, 1002, 3643, 1010, 9140, 1002, 11498, 5244, 1010, 9140, 1002, 2492, 1007, 1063, 2065, 1006, 1002, 3643, 6013, 11253, 1032, 3058, 7292, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.lastModified
public function lastModified($var = null) { if ($var !== null) { $this->last_modified = $var; } if (!isset($this->last_modified)) { $this->last_modified = (bool)Grav::instance()['config']->get('system.pages.last_modified'); } return $this->last_modified; }
php
public function lastModified($var = null) { if ($var !== null) { $this->last_modified = $var; } if (!isset($this->last_modified)) { $this->last_modified = (bool)Grav::instance()['config']->get('system.pages.last_modified'); } return $this->last_modified; }
[ "public", "function", "lastModified", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "last_modified", "=", "$", "var", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "last_mo...
Gets and sets the option to show the last_modified header for the page. @param bool $var show last_modified header @return bool show last_modified header
[ "Gets", "and", "sets", "the", "option", "to", "show", "the", "last_modified", "header", "for", "the", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2072-L2082
train
Return TRUE if page was last modified
[ 30522, 2270, 3853, 2197, 5302, 4305, 10451, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2197, 1035, 6310, 1027, 1002, 13075, 1025, 1065, 2065, 1006, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/FactoryBuilder.php
FactoryBuilder.raw
public function raw(array $attributes = []) { if ($this->amount === null) { return $this->getRawAttributes($attributes); } if ($this->amount < 1) { return []; } return array_map(function () use ($attributes) { return $this->getRawAttributes($attributes); }, range(1, $this->amount)); }
php
public function raw(array $attributes = []) { if ($this->amount === null) { return $this->getRawAttributes($attributes); } if ($this->amount < 1) { return []; } return array_map(function () use ($attributes) { return $this->getRawAttributes($attributes); }, range(1, $this->amount)); }
[ "public", "function", "raw", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "amount", "===", "null", ")", "{", "return", "$", "this", "->", "getRawAttributes", "(", "$", "attributes", ")", ";", "}", "if", "(...
Create an array of raw attribute arrays. @param array $attributes @return mixed
[ "Create", "an", "array", "of", "raw", "attribute", "arrays", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/FactoryBuilder.php#L243-L256
train
Return raw attributes
[ 30522, 2270, 3853, 6315, 1006, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3815, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 2527, 24281, 18886, 8569, 4570, 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...
dompdf/dompdf
src/Frame/FrameTree.php
FrameTree._build_tree_r
protected function _build_tree_r(DOMNode $node) { $frame = new Frame($node); $id = $frame->get_id(); $this->_registry[$id] = $frame; if (!$node->hasChildNodes()) { return $frame; } // Store the children in an array so that the tree can be modified $children = array(); $length = $node->childNodes->length; for ($i = 0; $i < $length; $i++) { $children[] = $node->childNodes->item($i); } $index = 0; // INFO: We don't advance $index if a node is removed to avoid skipping nodes while ($index < count($children)) { $child = $children[$index]; $nodeName = strtolower($child->nodeName); // Skip non-displaying nodes if (in_array($nodeName, self::$HIDDEN_TAGS)) { if ($nodeName !== "head" && $nodeName !== "style") { $this->_remove_node($node, $children, $index); } else { $index++; } continue; } // Skip empty text nodes if ($nodeName === "#text" && $child->nodeValue === "") { $this->_remove_node($node, $children, $index); continue; } // Skip empty image nodes if ($nodeName === "img" && $child->getAttribute("src") === "") { $this->_remove_node($node, $children, $index); continue; } if (is_object($child)) { $frame->append_child($this->_build_tree_r($child), false); } $index++; } return $frame; }
php
protected function _build_tree_r(DOMNode $node) { $frame = new Frame($node); $id = $frame->get_id(); $this->_registry[$id] = $frame; if (!$node->hasChildNodes()) { return $frame; } // Store the children in an array so that the tree can be modified $children = array(); $length = $node->childNodes->length; for ($i = 0; $i < $length; $i++) { $children[] = $node->childNodes->item($i); } $index = 0; // INFO: We don't advance $index if a node is removed to avoid skipping nodes while ($index < count($children)) { $child = $children[$index]; $nodeName = strtolower($child->nodeName); // Skip non-displaying nodes if (in_array($nodeName, self::$HIDDEN_TAGS)) { if ($nodeName !== "head" && $nodeName !== "style") { $this->_remove_node($node, $children, $index); } else { $index++; } continue; } // Skip empty text nodes if ($nodeName === "#text" && $child->nodeValue === "") { $this->_remove_node($node, $children, $index); continue; } // Skip empty image nodes if ($nodeName === "img" && $child->getAttribute("src") === "") { $this->_remove_node($node, $children, $index); continue; } if (is_object($child)) { $frame->append_child($this->_build_tree_r($child), false); } $index++; } return $frame; }
[ "protected", "function", "_build_tree_r", "(", "DOMNode", "$", "node", ")", "{", "$", "frame", "=", "new", "Frame", "(", "$", "node", ")", ";", "$", "id", "=", "$", "frame", "->", "get_id", "(", ")", ";", "$", "this", "->", "_registry", "[", "$", ...
Recursively adds {@link Frame} objects to the tree Recursively build a tree of Frame objects based on a dom tree. No layout information is calculated at this time, although the tree may be adjusted (i.e. nodes and frames for generated content and images may be created). @param DOMNode $node the current DOMNode being considered @return Frame
[ "Recursively", "adds", "{", "@link", "Frame", "}", "objects", "to", "the", "tree" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame/FrameTree.php#L231-L280
train
Build tree r
[ 30522, 5123, 3853, 1035, 3857, 1035, 3392, 1035, 1054, 1006, 14383, 3630, 3207, 1002, 13045, 1007, 1063, 1002, 4853, 1027, 2047, 4853, 1006, 1002, 13045, 1007, 1025, 1002, 8909, 1027, 1002, 4853, 1011, 1028, 2131, 1035, 8909, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Middleware.php
Middleware.retry
public static function retry(callable $decider, callable $delay = null) { return function (callable $handler) use ($decider, $delay) { return new RetryMiddleware($decider, $handler, $delay); }; }
php
public static function retry(callable $decider, callable $delay = null) { return function (callable $handler) use ($decider, $delay) { return new RetryMiddleware($decider, $handler, $delay); }; }
[ "public", "static", "function", "retry", "(", "callable", "$", "decider", ",", "callable", "$", "delay", "=", "null", ")", "{", "return", "function", "(", "callable", "$", "handler", ")", "use", "(", "$", "decider", ",", "$", "delay", ")", "{", "return...
Middleware that retries requests based on the boolean result of invoking the provided "decider" function. If no delay function is provided, a simple implementation of exponential backoff will be utilized. @param callable $decider Function that accepts the number of retries, a request, [response], and [exception] and returns true if the request is to be retried. @param callable $delay Function that accepts the number of retries and returns the number of milliseconds to delay. @return callable Returns a function that accepts the next handler.
[ "Middleware", "that", "retries", "requests", "based", "on", "the", "boolean", "result", "of", "invoking", "the", "provided", "decider", "function", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Middleware.php#L169-L174
train
Creates a middleware that will retry the request
[ 30522, 2270, 10763, 3853, 2128, 11129, 1006, 2655, 3085, 1002, 5630, 2099, 1010, 2655, 3085, 1002, 8536, 1027, 19701, 1007, 1063, 2709, 3853, 1006, 2655, 3085, 1002, 28213, 1007, 2224, 1006, 1002, 5630, 2099, 1010, 1002, 8536, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Constraints/NotCompromisedPasswordValidator.php
NotCompromisedPasswordValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof NotCompromisedPassword) { throw new UnexpectedTypeException($constraint, NotCompromisedPassword::class); } if ($this->disabled) { return; } if (null !== $value && !is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $value = (string) $value; if ('' === $value) { return; } if ('UTF-8' !== $this->charset) { $value = mb_convert_encoding($value, 'UTF-8', $this->charset); } $hash = strtoupper(sha1($value)); $hashPrefix = substr($hash, 0, 5); $url = sprintf(self::RANGE_API, $hashPrefix); try { $result = $this->httpClient->request('GET', $url)->getContent(); } catch (ExceptionInterface $e) { if ($constraint->skipOnError) { return; } throw $e; } foreach (explode("\r\n", $result) as $line) { list($hashSuffix, $count) = explode(':', $line); if ($hashPrefix.$hashSuffix === $hash && $constraint->threshold <= (int) $count) { $this->context->buildViolation($constraint->message) ->setCode(NotCompromisedPassword::COMPROMISED_PASSWORD_ERROR) ->addViolation(); return; } } }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof NotCompromisedPassword) { throw new UnexpectedTypeException($constraint, NotCompromisedPassword::class); } if ($this->disabled) { return; } if (null !== $value && !is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $value = (string) $value; if ('' === $value) { return; } if ('UTF-8' !== $this->charset) { $value = mb_convert_encoding($value, 'UTF-8', $this->charset); } $hash = strtoupper(sha1($value)); $hashPrefix = substr($hash, 0, 5); $url = sprintf(self::RANGE_API, $hashPrefix); try { $result = $this->httpClient->request('GET', $url)->getContent(); } catch (ExceptionInterface $e) { if ($constraint->skipOnError) { return; } throw $e; } foreach (explode("\r\n", $result) as $line) { list($hashSuffix, $count) = explode(':', $line); if ($hashPrefix.$hashSuffix === $hash && $constraint->threshold <= (int) $count) { $this->context->buildViolation($constraint->message) ->setCode(NotCompromisedPassword::COMPROMISED_PASSWORD_ERROR) ->addViolation(); return; } } }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "NotCompromisedPassword", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "N...
{@inheritdoc} @throws ExceptionInterface
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/NotCompromisedPasswordValidator.php#L54-L102
train
Checks if the value is a valid range of characters
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 2025, 9006, 21572, 28732, 18927, 12054, 18351, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 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...
dompdf/dompdf
src/Helpers.php
Helpers.rle8_decode
public static function rle8_decode($str, $width) { $lineWidth = $width + (3 - ($width - 1) % 4); $out = ''; $cnt = strlen($str); for ($i = 0; $i < $cnt; $i++) { $o = ord($str[$i]); switch ($o) { case 0: # ESCAPE $i++; switch (ord($str[$i])) { case 0: # NEW LINE $padCnt = $lineWidth - strlen($out) % $lineWidth; if ($padCnt < $lineWidth) { $out .= str_repeat(chr(0), $padCnt); # pad line } break; case 1: # END OF FILE $padCnt = $lineWidth - strlen($out) % $lineWidth; if ($padCnt < $lineWidth) { $out .= str_repeat(chr(0), $padCnt); # pad line } break 3; case 2: # DELTA $i += 2; break; default: # ABSOLUTE MODE $num = ord($str[$i]); for ($j = 0; $j < $num; $j++) { $out .= $str[++$i]; } if ($num % 2) { $i++; } } break; default: $out .= str_repeat($str[++$i], $o); } } return $out; }
php
public static function rle8_decode($str, $width) { $lineWidth = $width + (3 - ($width - 1) % 4); $out = ''; $cnt = strlen($str); for ($i = 0; $i < $cnt; $i++) { $o = ord($str[$i]); switch ($o) { case 0: # ESCAPE $i++; switch (ord($str[$i])) { case 0: # NEW LINE $padCnt = $lineWidth - strlen($out) % $lineWidth; if ($padCnt < $lineWidth) { $out .= str_repeat(chr(0), $padCnt); # pad line } break; case 1: # END OF FILE $padCnt = $lineWidth - strlen($out) % $lineWidth; if ($padCnt < $lineWidth) { $out .= str_repeat(chr(0), $padCnt); # pad line } break 3; case 2: # DELTA $i += 2; break; default: # ABSOLUTE MODE $num = ord($str[$i]); for ($j = 0; $j < $num; $j++) { $out .= $str[++$i]; } if ($num % 2) { $i++; } } break; default: $out .= str_repeat($str[++$i], $o); } } return $out; }
[ "public", "static", "function", "rle8_decode", "(", "$", "str", ",", "$", "width", ")", "{", "$", "lineWidth", "=", "$", "width", "+", "(", "3", "-", "(", "$", "width", "-", "1", ")", "%", "4", ")", ";", "$", "out", "=", "''", ";", "$", "cnt"...
Decoder for RLE8 compression in windows bitmaps http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp @param string $str Data to decode @param integer $width Image width @return string
[ "Decoder", "for", "RLE8", "compression", "in", "windows", "bitmaps", "http", ":", "//", "msdn", ".", "microsoft", ".", "com", "/", "library", "/", "default", ".", "asp?url", "=", "/", "library", "/", "en", "-", "us", "/", "gdi", "/", "bitmaps_6x0u", "....
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Helpers.php#L252-L294
train
Decode the string to the correct width
[ 30522, 2270, 10763, 3853, 1054, 2571, 2620, 1035, 21933, 3207, 1006, 1002, 2358, 2099, 1010, 1002, 9381, 1007, 1063, 1002, 2240, 9148, 11927, 2232, 1027, 1002, 9381, 1009, 1006, 1017, 1011, 1006, 1002, 9381, 1011, 1015, 1007, 1003, 1018, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/behaviors/FormController.php
FormController.preview
public function preview($recordId = null, $context = null) { try { $this->context = strlen($context) ? $context : $this->getConfig('preview[context]', self::CONTEXT_PREVIEW); $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang( "{$this->context}[title]", 'backend::lang.form.preview_title' ); $model = $this->controller->formFindModelObject($recordId); $this->initForm($model); } catch (Exception $ex) { $this->controller->handleError($ex); } }
php
public function preview($recordId = null, $context = null) { try { $this->context = strlen($context) ? $context : $this->getConfig('preview[context]', self::CONTEXT_PREVIEW); $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang( "{$this->context}[title]", 'backend::lang.form.preview_title' ); $model = $this->controller->formFindModelObject($recordId); $this->initForm($model); } catch (Exception $ex) { $this->controller->handleError($ex); } }
[ "public", "function", "preview", "(", "$", "recordId", "=", "null", ",", "$", "context", "=", "null", ")", "{", "try", "{", "$", "this", "->", "context", "=", "strlen", "(", "$", "context", ")", "?", "$", "context", ":", "$", "this", "->", "getConf...
Controller "preview" action used for viewing existing model records. This action takes a record identifier (primary key of the model) to locate the record used for sourcing the existing preview data. @param int $recordId Record identifier @param string $context Form context @return void
[ "Controller", "preview", "action", "used", "for", "viewing", "existing", "model", "records", ".", "This", "action", "takes", "a", "record", "identifier", "(", "primary", "key", "of", "the", "model", ")", "to", "locate", "the", "record", "used", "for", "sourc...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/FormController.php#L367-L382
train
preview form action
[ 30522, 2270, 3853, 19236, 1006, 1002, 2501, 3593, 1027, 19701, 1010, 1002, 6123, 1027, 19701, 1007, 1063, 3046, 1063, 1002, 2023, 1011, 1028, 6123, 1027, 2358, 20927, 2078, 1006, 1002, 6123, 1007, 1029, 1002, 6123, 1024, 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...
matomo-org/matomo
libs/Zend/Cache/Backend/Static.php
Zend_Cache_Backend_Static._createDirectoriesFor
protected function _createDirectoriesFor($path) { if (!is_dir($path)) { $oldUmask = umask(0); if ( !@mkdir($path, $this->_octdec($this->_options['cache_directory_umask']), true)) { $lastErr = error_get_last(); umask($oldUmask); Zend_Cache::throwException("Can't create directory: {$lastErr['message']}"); } umask($oldUmask); } }
php
protected function _createDirectoriesFor($path) { if (!is_dir($path)) { $oldUmask = umask(0); if ( !@mkdir($path, $this->_octdec($this->_options['cache_directory_umask']), true)) { $lastErr = error_get_last(); umask($oldUmask); Zend_Cache::throwException("Can't create directory: {$lastErr['message']}"); } umask($oldUmask); } }
[ "protected", "function", "_createDirectoriesFor", "(", "$", "path", ")", "{", "if", "(", "!", "is_dir", "(", "$", "path", ")", ")", "{", "$", "oldUmask", "=", "umask", "(", "0", ")", ";", "if", "(", "!", "@", "mkdir", "(", "$", "path", ",", "$", ...
Recursively create the directories needed to write the static file
[ "Recursively", "create", "the", "directories", "needed", "to", "write", "the", "static", "file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Static.php#L262-L273
train
Create directories for the given path
[ 30522, 5123, 3853, 1035, 2580, 7442, 16761, 3111, 29278, 1006, 1002, 4130, 1007, 1063, 2065, 1006, 999, 2003, 1035, 16101, 1006, 1002, 4130, 1007, 1007, 1063, 1002, 2214, 12248, 6711, 1027, 8529, 19895, 1006, 1014, 1007, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreConsole/Commands/CoreArchiver.php
CoreArchiver.configureArchiveCommand
public static function configureArchiveCommand(ConsoleCommand $command) { $command->setName('core:archive'); $command->setDescription("Runs the CLI archiver. It is an important tool for general maintenance and to keep Piwik very fast."); $command->setHelp("* It is recommended to run the script without any option. * This script should be executed every hour via crontab, or as a daemon. * You can also run it via http:// by specifying the Super User &token_auth=XYZ as a parameter ('Web Cron'), but it is recommended to run it via command line/CLI instead. * If you have any suggestion about this script, please let the team know at feedback@matomo.org * Enjoy!"); $command->addOption('url', null, InputOption::VALUE_REQUIRED, "Forces the value of this option to be used as the URL to Piwik. \nIf your system does not support" . " archiving with CLI processes, you may need to set this in order for the archiving HTTP requests to use" . " the desired URLs."); $command->addOption('force-all-websites', null, InputOption::VALUE_NONE, "If specified, the script will trigger archiving on all websites.\nUse with --force-all-periods=[seconds] " . "to also process those websites that had visits in the last [seconds] seconds.\nLaunching several processes" . " with this option will make them share the list of sites to process."); $command->addOption('force-all-periods', null, InputOption::VALUE_OPTIONAL, "Limits archiving to websites with some traffic in the last [seconds] seconds. \nFor example " . "--force-all-periods=86400 will archive websites that had visits in the last 24 hours. \nIf [seconds] is " . "not specified, all websites with visits in the last " . CronArchive::ARCHIVE_SITES_WITH_TRAFFIC_SINCE . " seconds (" . round(CronArchive::ARCHIVE_SITES_WITH_TRAFFIC_SINCE / 86400) . " days) will be archived."); $command->addOption('force-timeout-for-periods', null, InputOption::VALUE_OPTIONAL, "The current week/ current month/ current year will be processed at most every [seconds].\nIf not " . "specified, defaults to " . CronArchive::SECONDS_DELAY_BETWEEN_PERIOD_ARCHIVES . "."); $command->addOption('skip-idsites', null, InputOption::VALUE_OPTIONAL, 'If specified, archiving will be skipped for these websites (in case these website ids would have been archived).'); $command->addOption('skip-all-segments', null, InputOption::VALUE_NONE, 'If specified, all segments will be skipped during archiving.'); $command->addOption('force-idsites', null, InputOption::VALUE_OPTIONAL, 'If specified, archiving will be processed only for these Sites Ids (comma separated)'); $command->addOption('force-periods', null, InputOption::VALUE_OPTIONAL, "If specified, archiving will be processed only for these Periods (comma separated eg. day,week,month,year,range)"); $command->addOption('force-date-last-n', null, InputOption::VALUE_REQUIRED, "This script calls the API with period=lastN. You can force the N in lastN by specifying this value."); $command->addOption('force-date-range', null, InputOption::VALUE_OPTIONAL, "If specified, archiving will be processed only for periods included in this date range. Format: YYYY-MM-DD,YYYY-MM-DD"); $command->addOption('force-idsegments', null, InputOption::VALUE_REQUIRED, 'If specified, only these segments will be processed (if the segment should be applied to a site in the first place).' . "\nSpecify stored segment IDs, not the segments themselves, eg, 1,2,3. " . "\nNote: if identical segments exist w/ different IDs, they will both be skipped, even if you only supply one ID."); $command->addOption('concurrent-requests-per-website', null, InputOption::VALUE_OPTIONAL, "When processing a website and its segments, number of requests to process in parallel", CronArchive::MAX_CONCURRENT_API_REQUESTS); $command->addOption('concurrent-archivers', null, InputOption::VALUE_OPTIONAL, "The number of max archivers to run in parallel. Depending on how you start the archiver as a cronjob, you may need to double the amount of archivers allowed if the same process appears twice in the `ps ex` output.", false); $command->addOption('disable-scheduled-tasks', null, InputOption::VALUE_NONE, "Skips executing Scheduled tasks (sending scheduled reports, db optimization, etc.)."); $command->addOption('accept-invalid-ssl-certificate', null, InputOption::VALUE_NONE, "It is _NOT_ recommended to use this argument. Instead, you should use a valid SSL certificate!\nIt can be " . "useful if you specified --url=https://... or if you are using Piwik with force_ssl=1"); $command->addOption('php-cli-options', null, InputOption::VALUE_OPTIONAL, 'Forwards the PHP configuration options to the PHP CLI command. For example "-d memory_limit=8G". Note: These options are only applied if the archiver actually uses CLI and not HTTP.', $default = ''); }
php
public static function configureArchiveCommand(ConsoleCommand $command) { $command->setName('core:archive'); $command->setDescription("Runs the CLI archiver. It is an important tool for general maintenance and to keep Piwik very fast."); $command->setHelp("* It is recommended to run the script without any option. * This script should be executed every hour via crontab, or as a daemon. * You can also run it via http:// by specifying the Super User &token_auth=XYZ as a parameter ('Web Cron'), but it is recommended to run it via command line/CLI instead. * If you have any suggestion about this script, please let the team know at feedback@matomo.org * Enjoy!"); $command->addOption('url', null, InputOption::VALUE_REQUIRED, "Forces the value of this option to be used as the URL to Piwik. \nIf your system does not support" . " archiving with CLI processes, you may need to set this in order for the archiving HTTP requests to use" . " the desired URLs."); $command->addOption('force-all-websites', null, InputOption::VALUE_NONE, "If specified, the script will trigger archiving on all websites.\nUse with --force-all-periods=[seconds] " . "to also process those websites that had visits in the last [seconds] seconds.\nLaunching several processes" . " with this option will make them share the list of sites to process."); $command->addOption('force-all-periods', null, InputOption::VALUE_OPTIONAL, "Limits archiving to websites with some traffic in the last [seconds] seconds. \nFor example " . "--force-all-periods=86400 will archive websites that had visits in the last 24 hours. \nIf [seconds] is " . "not specified, all websites with visits in the last " . CronArchive::ARCHIVE_SITES_WITH_TRAFFIC_SINCE . " seconds (" . round(CronArchive::ARCHIVE_SITES_WITH_TRAFFIC_SINCE / 86400) . " days) will be archived."); $command->addOption('force-timeout-for-periods', null, InputOption::VALUE_OPTIONAL, "The current week/ current month/ current year will be processed at most every [seconds].\nIf not " . "specified, defaults to " . CronArchive::SECONDS_DELAY_BETWEEN_PERIOD_ARCHIVES . "."); $command->addOption('skip-idsites', null, InputOption::VALUE_OPTIONAL, 'If specified, archiving will be skipped for these websites (in case these website ids would have been archived).'); $command->addOption('skip-all-segments', null, InputOption::VALUE_NONE, 'If specified, all segments will be skipped during archiving.'); $command->addOption('force-idsites', null, InputOption::VALUE_OPTIONAL, 'If specified, archiving will be processed only for these Sites Ids (comma separated)'); $command->addOption('force-periods', null, InputOption::VALUE_OPTIONAL, "If specified, archiving will be processed only for these Periods (comma separated eg. day,week,month,year,range)"); $command->addOption('force-date-last-n', null, InputOption::VALUE_REQUIRED, "This script calls the API with period=lastN. You can force the N in lastN by specifying this value."); $command->addOption('force-date-range', null, InputOption::VALUE_OPTIONAL, "If specified, archiving will be processed only for periods included in this date range. Format: YYYY-MM-DD,YYYY-MM-DD"); $command->addOption('force-idsegments', null, InputOption::VALUE_REQUIRED, 'If specified, only these segments will be processed (if the segment should be applied to a site in the first place).' . "\nSpecify stored segment IDs, not the segments themselves, eg, 1,2,3. " . "\nNote: if identical segments exist w/ different IDs, they will both be skipped, even if you only supply one ID."); $command->addOption('concurrent-requests-per-website', null, InputOption::VALUE_OPTIONAL, "When processing a website and its segments, number of requests to process in parallel", CronArchive::MAX_CONCURRENT_API_REQUESTS); $command->addOption('concurrent-archivers', null, InputOption::VALUE_OPTIONAL, "The number of max archivers to run in parallel. Depending on how you start the archiver as a cronjob, you may need to double the amount of archivers allowed if the same process appears twice in the `ps ex` output.", false); $command->addOption('disable-scheduled-tasks', null, InputOption::VALUE_NONE, "Skips executing Scheduled tasks (sending scheduled reports, db optimization, etc.)."); $command->addOption('accept-invalid-ssl-certificate', null, InputOption::VALUE_NONE, "It is _NOT_ recommended to use this argument. Instead, you should use a valid SSL certificate!\nIt can be " . "useful if you specified --url=https://... or if you are using Piwik with force_ssl=1"); $command->addOption('php-cli-options', null, InputOption::VALUE_OPTIONAL, 'Forwards the PHP configuration options to the PHP CLI command. For example "-d memory_limit=8G". Note: These options are only applied if the archiver actually uses CLI and not HTTP.', $default = ''); }
[ "public", "static", "function", "configureArchiveCommand", "(", "ConsoleCommand", "$", "command", ")", "{", "$", "command", "->", "setName", "(", "'core:archive'", ")", ";", "$", "command", "->", "setDescription", "(", "\"Runs the CLI archiver. It is an important tool f...
This is reused by another console command
[ "This", "is", "reused", "by", "another", "console", "command" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreConsole/Commands/CoreArchiver.php#L72-L124
train
Configure the archiver command
[ 30522, 2270, 10763, 3853, 9530, 8873, 27390, 14644, 5428, 3726, 9006, 2386, 2094, 1006, 10122, 9006, 2386, 2094, 1002, 3094, 1007, 1063, 1002, 3094, 1011, 1028, 2275, 18442, 1006, 1005, 4563, 1024, 8756, 1005, 1007, 1025, 1002, 3094, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Plugin/API.php
API.getInstance
public static function getInstance() { $class = get_called_class(); if (!isset(self::$instances[$class])) { $container = StaticContainer::getContainer(); $refl = new \ReflectionClass($class); if (!$refl->getConstructor() || $refl->getConstructor()->isPublic()) { self::$instances[$class] = $container->get($class); } else { /** @var LoggerInterface $logger */ $logger = $container->get('Psr\Log\LoggerInterface'); // BC with API defining a protected constructor $logger->notice('The API class {class} defines a protected constructor which is deprecated, make the constructor public instead', array('class' => $class)); self::$instances[$class] = new $class; } } return self::$instances[$class]; }
php
public static function getInstance() { $class = get_called_class(); if (!isset(self::$instances[$class])) { $container = StaticContainer::getContainer(); $refl = new \ReflectionClass($class); if (!$refl->getConstructor() || $refl->getConstructor()->isPublic()) { self::$instances[$class] = $container->get($class); } else { /** @var LoggerInterface $logger */ $logger = $container->get('Psr\Log\LoggerInterface'); // BC with API defining a protected constructor $logger->notice('The API class {class} defines a protected constructor which is deprecated, make the constructor public instead', array('class' => $class)); self::$instances[$class] = new $class; } } return self::$instances[$class]; }
[ "public", "static", "function", "getInstance", "(", ")", "{", "$", "class", "=", "get_called_class", "(", ")", ";", "if", "(", "!", "isset", "(", "self", "::", "$", "instances", "[", "$", "class", "]", ")", ")", "{", "$", "container", "=", "StaticCon...
Returns the singleton instance for the derived class. If the singleton instance has not been created, this method will create it. @return static
[ "Returns", "the", "singleton", "instance", "for", "the", "derived", "class", ".", "If", "the", "singleton", "instance", "has", "not", "been", "created", "this", "method", "will", "create", "it", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/API.php#L53-L75
train
Get the instance of the class
[ 30522, 2270, 10763, 3853, 2131, 7076, 26897, 1006, 1007, 1063, 1002, 2465, 1027, 2131, 1035, 2170, 1035, 2465, 1006, 1007, 1025, 2065, 1006, 999, 26354, 3388, 1006, 2969, 1024, 1024, 1002, 12107, 1031, 1002, 2465, 1033, 1007, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Updates/2.14.2.php
Updates_2_14_2.getMigrations
public function getMigrations(Updater $updater) { $visitMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(VisitDimension::INSTALLER_PREFIX, 'log_visit'); $actionMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(ActionDimension::INSTALLER_PREFIX, 'log_link_visit_action'); $conversionMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(ConversionDimension::INSTALLER_PREFIX, 'log_conversion'); $migrations = array(); foreach ($visitMigrations as $migration) { $migrations[] = $migration; } foreach ($actionMigrations as $migration) { $migrations[] = $migration; } foreach ($conversionMigrations as $migration) { $migrations[] = $migration; } return $migrations; }
php
public function getMigrations(Updater $updater) { $visitMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(VisitDimension::INSTALLER_PREFIX, 'log_visit'); $actionMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(ActionDimension::INSTALLER_PREFIX, 'log_link_visit_action'); $conversionMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(ConversionDimension::INSTALLER_PREFIX, 'log_conversion'); $migrations = array(); foreach ($visitMigrations as $migration) { $migrations[] = $migration; } foreach ($actionMigrations as $migration) { $migrations[] = $migration; } foreach ($conversionMigrations as $migration) { $migrations[] = $migration; } return $migrations; }
[ "public", "function", "getMigrations", "(", "Updater", "$", "updater", ")", "{", "$", "visitMigrations", "=", "$", "this", "->", "getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns", "(", "VisitDimension", "::", "INSTALLER_PREFIX", ",", "'log_visit'", ")", ...
Removes option entries for columns that are marked as installed but are actually no longer installed due to a bug in previous versions where the option entries were not correctly removed. @param Updater $updater @return array
[ "Removes", "option", "entries", "for", "columns", "that", "are", "marked", "as", "installed", "but", "are", "actually", "no", "longer", "installed", "due", "to", "a", "bug", "in", "previous", "versions", "where", "the", "option", "entries", "were", "not", "c...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updates/2.14.2.php#L45-L66
train
Remove option entries from the table that are not currently installed columns
[ 30522, 2270, 3853, 2131, 4328, 29397, 2015, 1006, 10651, 2099, 1002, 10651, 2099, 1007, 1063, 1002, 3942, 4328, 29397, 2015, 1027, 1002, 2023, 1011, 1028, 2131, 4328, 29397, 3367, 12707, 28578, 21818, 7361, 3508, 4765, 5134, 11253, 17048, 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/VarDumper/Dumper/AbstractDumper.php
AbstractDumper.dumpLine
protected function dumpLine($depth) { ($this->lineDumper)($this->line, $depth, $this->indentPad); $this->line = ''; }
php
protected function dumpLine($depth) { ($this->lineDumper)($this->line, $depth, $this->indentPad); $this->line = ''; }
[ "protected", "function", "dumpLine", "(", "$", "depth", ")", "{", "(", "$", "this", "->", "lineDumper", ")", "(", "$", "this", "->", "line", ",", "$", "depth", ",", "$", "this", "->", "indentPad", ")", ";", "$", "this", "->", "line", "=", "''", "...
Dumps the current line. @param int $depth The recursive depth in the dumped structure for the line being dumped, or -1 to signal the end-of-dump to the line dumper callable
[ "Dumps", "the", "current", "line", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php#L165-L169
train
Dump the current line into the page
[ 30522, 5123, 3853, 15653, 4179, 1006, 1002, 5995, 1007, 1063, 1006, 1002, 2023, 1011, 1028, 7732, 24237, 2121, 1007, 1006, 1002, 2023, 1011, 1028, 2240, 1010, 1002, 5995, 1010, 1002, 2023, 1011, 1028, 27427, 4765, 15455, 1007, 1025, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/models/MailTemplate.php
MailTemplate.syncAll
public static function syncAll() { MailLayout::createLayouts(); MailPartial::createPartials(); $templates = MailManager::instance()->listRegisteredTemplates(); $dbTemplates = self::lists('is_custom', 'code'); $newTemplates = array_diff_key($templates, $dbTemplates); /* * Clean up non-customized templates */ foreach ($dbTemplates as $code => $isCustom) { if ($isCustom) { continue; } if (!array_key_exists($code, $templates)) { self::whereCode($code)->delete(); } } /* * Create new templates */ foreach ($newTemplates as $code) { $sections = self::getTemplateSections($code); $layoutCode = array_get($sections, 'settings.layout', 'default'); $description = array_get($sections, 'settings.description'); $template = self::make(); $template->code = $code; $template->description = $description; $template->is_custom = 0; $template->layout_id = MailLayout::getIdFromCode($layoutCode); $template->forceSave(); } }
php
public static function syncAll() { MailLayout::createLayouts(); MailPartial::createPartials(); $templates = MailManager::instance()->listRegisteredTemplates(); $dbTemplates = self::lists('is_custom', 'code'); $newTemplates = array_diff_key($templates, $dbTemplates); /* * Clean up non-customized templates */ foreach ($dbTemplates as $code => $isCustom) { if ($isCustom) { continue; } if (!array_key_exists($code, $templates)) { self::whereCode($code)->delete(); } } /* * Create new templates */ foreach ($newTemplates as $code) { $sections = self::getTemplateSections($code); $layoutCode = array_get($sections, 'settings.layout', 'default'); $description = array_get($sections, 'settings.description'); $template = self::make(); $template->code = $code; $template->description = $description; $template->is_custom = 0; $template->layout_id = MailLayout::getIdFromCode($layoutCode); $template->forceSave(); } }
[ "public", "static", "function", "syncAll", "(", ")", "{", "MailLayout", "::", "createLayouts", "(", ")", ";", "MailPartial", "::", "createPartials", "(", ")", ";", "$", "templates", "=", "MailManager", "::", "instance", "(", ")", "->", "listRegisteredTemplates...
Syncronise all file templates to the database. @return void
[ "Syncronise", "all", "file", "templates", "to", "the", "database", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/MailTemplate.php#L81-L118
train
Synchronize all mail templates
[ 30522, 2270, 10763, 3853, 26351, 8095, 1006, 1007, 1063, 5653, 8485, 5833, 1024, 1024, 3443, 8485, 12166, 1006, 1007, 1025, 5653, 19362, 20925, 1024, 1024, 3443, 19362, 20925, 2015, 1006, 1007, 1025, 1002, 23561, 2015, 1027, 5653, 24805, 45...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Http/Concerns/InteractsWithFlashData.php
InteractsWithFlashData.flashOnly
public function flashOnly($keys) { $this->session()->flashInput( $this->only(is_array($keys) ? $keys : func_get_args()) ); }
php
public function flashOnly($keys) { $this->session()->flashInput( $this->only(is_array($keys) ? $keys : func_get_args()) ); }
[ "public", "function", "flashOnly", "(", "$", "keys", ")", "{", "$", "this", "->", "session", "(", ")", "->", "flashInput", "(", "$", "this", "->", "only", "(", "is_array", "(", "$", "keys", ")", "?", "$", "keys", ":", "func_get_args", "(", ")", ")"...
Flash only some of the input to the session. @param array|mixed $keys @return void
[ "Flash", "only", "some", "of", "the", "input", "to", "the", "session", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Concerns/InteractsWithFlashData.php#L35-L40
train
Flash only the values of the given keys in the session.
[ 30522, 2270, 3853, 5956, 2239, 2135, 1006, 1002, 6309, 1007, 1063, 1002, 2023, 1011, 1028, 5219, 1006, 1007, 1011, 1028, 5956, 2378, 18780, 1006, 1002, 2023, 1011, 1028, 2069, 1006, 2003, 1035, 9140, 1006, 1002, 6309, 1007, 1029, 1002, 63...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Lock/Store/PdoStore.php
PdoStore.delete
public function delete(Key $key) { $sql = "DELETE FROM $this->table WHERE $this->idCol = :id AND $this->tokenCol = :token"; $stmt = $this->getConnection()->prepare($sql); $stmt->bindValue(':id', $this->getHashedKey($key)); $stmt->bindValue(':token', $this->getUniqueToken($key)); $stmt->execute(); }
php
public function delete(Key $key) { $sql = "DELETE FROM $this->table WHERE $this->idCol = :id AND $this->tokenCol = :token"; $stmt = $this->getConnection()->prepare($sql); $stmt->bindValue(':id', $this->getHashedKey($key)); $stmt->bindValue(':token', $this->getUniqueToken($key)); $stmt->execute(); }
[ "public", "function", "delete", "(", "Key", "$", "key", ")", "{", "$", "sql", "=", "\"DELETE FROM $this->table WHERE $this->idCol = :id AND $this->tokenCol = :token\"", ";", "$", "stmt", "=", "$", "this", "->", "getConnection", "(", ")", "->", "prepare", "(", "$",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/PdoStore.php#L189-L197
train
Delete a key from the cache
[ 30522, 2270, 3853, 3972, 12870, 1006, 3145, 1002, 3145, 1007, 1063, 1002, 29296, 1027, 1000, 3972, 12870, 2013, 1002, 2023, 1011, 1028, 2795, 2073, 1002, 2023, 1011, 1028, 8909, 25778, 1027, 1024, 8909, 1998, 1002, 2023, 1011, 1028, 19204, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Assets.php
Assets.add
public function add($asset) { $args = \func_get_args(); // More than one asset if (\is_array($asset)) { foreach ($asset as $a) { array_shift($args); $args = array_merge([$a], $args); \call_user_func_array([$this, 'add'], $args); } } elseif (isset($this->collections[$asset])) { array_shift($args); $args = array_merge([$this->collections[$asset]], $args); \call_user_func_array([$this, 'add'], $args); } else { // Get extension $extension = pathinfo(parse_url($asset, PHP_URL_PATH), PATHINFO_EXTENSION); // JavaScript or CSS if (\strlen($extension) > 0) { $extension = strtolower($extension); if ($extension === 'css') { \call_user_func_array([$this, 'addCss'], $args); } elseif ($extension === 'js') { \call_user_func_array([$this, 'addJs'], $args); } } } return $this; }
php
public function add($asset) { $args = \func_get_args(); // More than one asset if (\is_array($asset)) { foreach ($asset as $a) { array_shift($args); $args = array_merge([$a], $args); \call_user_func_array([$this, 'add'], $args); } } elseif (isset($this->collections[$asset])) { array_shift($args); $args = array_merge([$this->collections[$asset]], $args); \call_user_func_array([$this, 'add'], $args); } else { // Get extension $extension = pathinfo(parse_url($asset, PHP_URL_PATH), PATHINFO_EXTENSION); // JavaScript or CSS if (\strlen($extension) > 0) { $extension = strtolower($extension); if ($extension === 'css') { \call_user_func_array([$this, 'addCss'], $args); } elseif ($extension === 'js') { \call_user_func_array([$this, 'addJs'], $args); } } } return $this; }
[ "public", "function", "add", "(", "$", "asset", ")", "{", "$", "args", "=", "\\", "func_get_args", "(", ")", ";", "// More than one asset", "if", "(", "\\", "is_array", "(", "$", "asset", ")", ")", "{", "foreach", "(", "$", "asset", "as", "$", "a", ...
Add an asset or a collection of assets. It automatically detects the asset type (JavaScript, CSS or collection). You may add more than one asset passing an array as argument. @param array|string $asset @return $this
[ "Add", "an", "asset", "or", "a", "collection", "of", "assets", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets.php#L125-L156
train
Add asset to the collection
[ 30522, 2270, 3853, 5587, 1006, 1002, 11412, 1007, 1063, 1002, 12098, 5620, 1027, 1032, 4569, 2278, 1035, 2131, 1035, 12098, 5620, 1006, 1007, 1025, 1013, 1013, 2062, 2084, 2028, 11412, 2065, 1006, 1032, 2003, 1035, 9140, 1006, 1002, 11412, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.fillJsonAttribute
public function fillJsonAttribute($key, $value) { [$key, $path] = explode('->', $key, 2); $this->attributes[$key] = $this->asJson($this->getArrayAttributeWithValue( $path, $key, $value )); return $this; }
php
public function fillJsonAttribute($key, $value) { [$key, $path] = explode('->', $key, 2); $this->attributes[$key] = $this->asJson($this->getArrayAttributeWithValue( $path, $key, $value )); return $this; }
[ "public", "function", "fillJsonAttribute", "(", "$", "key", ",", "$", "value", ")", "{", "[", "$", "key", ",", "$", "path", "]", "=", "explode", "(", "'->'", ",", "$", "key", ",", "2", ")", ";", "$", "this", "->", "attributes", "[", "$", "key", ...
Set a given JSON attribute on the model. @param string $key @param mixed $value @return $this
[ "Set", "a", "given", "JSON", "attribute", "on", "the", "model", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L633-L642
train
Fill the json attribute with the value of the attribute
[ 30522, 2270, 3853, 6039, 22578, 7856, 4779, 3089, 8569, 2618, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 1031, 1002, 3145, 1010, 1002, 4130, 1033, 1027, 15044, 1006, 1005, 1011, 1028, 1005, 1010, 1002, 3145, 1010, 1016, 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
libs/HTML/QuickForm2/Controller.php
HTML_QuickForm2_Controller.handle
public function handle(HTML_QuickForm2_Controller_Page $page, $actionName) { if (!isset($this->handlers[$actionName]) && in_array($actionName, array('next', 'back', 'submit', 'display', 'jump')) ) { $className = 'HTML_QuickForm2_Controller_Action_' . ucfirst($actionName); if (!class_exists($className)) { HTML_QuickForm2_Loader::loadClass($className); } $this->addHandler($actionName, new $className()); } if (isset($this->handlers[$actionName])) { return $this->handlers[$actionName]->perform($page, $actionName); } else { throw new HTML_QuickForm2_NotFoundException( "Unhandled action '{$actionName}' for page '{$page->getForm()->getId()}'" ); } }
php
public function handle(HTML_QuickForm2_Controller_Page $page, $actionName) { if (!isset($this->handlers[$actionName]) && in_array($actionName, array('next', 'back', 'submit', 'display', 'jump')) ) { $className = 'HTML_QuickForm2_Controller_Action_' . ucfirst($actionName); if (!class_exists($className)) { HTML_QuickForm2_Loader::loadClass($className); } $this->addHandler($actionName, new $className()); } if (isset($this->handlers[$actionName])) { return $this->handlers[$actionName]->perform($page, $actionName); } else { throw new HTML_QuickForm2_NotFoundException( "Unhandled action '{$actionName}' for page '{$page->getForm()->getId()}'" ); } }
[ "public", "function", "handle", "(", "HTML_QuickForm2_Controller_Page", "$", "page", ",", "$", "actionName", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "handlers", "[", "$", "actionName", "]", ")", "&&", "in_array", "(", "$", "actionName", ...
Handles an action This will be called if the page itself does not have a handler for a specific action. The method also loads and uses default handlers for common actions, if specific ones were not added. @param HTML_QuickForm2_Controller_Page form page @param string action name @throws HTML_QuickForm2_NotFoundException if handler for an action is missing
[ "Handles", "an", "action" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller.php#L292-L310
train
Handles an action
[ 30522, 2270, 3853, 5047, 1006, 16129, 1035, 4248, 14192, 2475, 1035, 11486, 1035, 30524, 1035, 9140, 1006, 1002, 2895, 18442, 1010, 9140, 1006, 1005, 2279, 1005, 1010, 1005, 2067, 1005, 1010, 1005, 12040, 1005, 1010, 1005, 4653, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php
MockFileSessionStorage.regenerate
public function regenerate($destroy = false, $lifetime = null) { if (!$this->started) { $this->start(); } if ($destroy) { $this->destroy(); } return parent::regenerate($destroy, $lifetime); }
php
public function regenerate($destroy = false, $lifetime = null) { if (!$this->started) { $this->start(); } if ($destroy) { $this->destroy(); } return parent::regenerate($destroy, $lifetime); }
[ "public", "function", "regenerate", "(", "$", "destroy", "=", "false", ",", "$", "lifetime", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "started", ")", "{", "$", "this", "->", "start", "(", ")", ";", "}", "if", "(", "$", "destroy",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php#L72-L83
train
Regenerates the current session
[ 30522, 2270, 3853, 19723, 24454, 3686, 1006, 1002, 6033, 1027, 6270, 1010, 1002, 6480, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2318, 1007, 1063, 1002, 2023, 1011, 1028, 2707, 1006, 1007, 1025, 1065, 2065, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Profiler.php
Profiler.aggregateXhprofRuns
public static function aggregateXhprofRuns($runIds, $profilerNamespace, $saveToRunId) { $xhprofRuns = new XHProfRuns_Default(); $aggregatedData = array(); foreach ($runIds as $runId) { $xhprofRunData = $xhprofRuns->get_run($runId, $profilerNamespace, $description); foreach ($xhprofRunData as $key => $data) { if (empty($aggregatedData[$key])) { $aggregatedData[$key] = $data; } else { // don't aggregate main() metrics since only the super run has the correct metrics for the entire run if ($key == "main()") { continue; } $aggregatedData[$key]["ct"] += $data["ct"]; // call count $aggregatedData[$key]["wt"] += $data["wt"]; // incl. wall time $aggregatedData[$key]["cpu"] += $data["cpu"]; // cpu time $aggregatedData[$key]["mu"] += $data["mu"]; // memory usage $aggregatedData[$key]["pmu"] = max($aggregatedData[$key]["pmu"], $data["pmu"]); // peak mem usage } } } $xhprofRuns->save_run($aggregatedData, $profilerNamespace, $saveToRunId); }
php
public static function aggregateXhprofRuns($runIds, $profilerNamespace, $saveToRunId) { $xhprofRuns = new XHProfRuns_Default(); $aggregatedData = array(); foreach ($runIds as $runId) { $xhprofRunData = $xhprofRuns->get_run($runId, $profilerNamespace, $description); foreach ($xhprofRunData as $key => $data) { if (empty($aggregatedData[$key])) { $aggregatedData[$key] = $data; } else { // don't aggregate main() metrics since only the super run has the correct metrics for the entire run if ($key == "main()") { continue; } $aggregatedData[$key]["ct"] += $data["ct"]; // call count $aggregatedData[$key]["wt"] += $data["wt"]; // incl. wall time $aggregatedData[$key]["cpu"] += $data["cpu"]; // cpu time $aggregatedData[$key]["mu"] += $data["mu"]; // memory usage $aggregatedData[$key]["pmu"] = max($aggregatedData[$key]["pmu"], $data["pmu"]); // peak mem usage } } } $xhprofRuns->save_run($aggregatedData, $profilerNamespace, $saveToRunId); }
[ "public", "static", "function", "aggregateXhprofRuns", "(", "$", "runIds", ",", "$", "profilerNamespace", ",", "$", "saveToRunId", ")", "{", "$", "xhprofRuns", "=", "new", "XHProfRuns_Default", "(", ")", ";", "$", "aggregatedData", "=", "array", "(", ")", ";...
Aggregates xhprof runs w/o normalizing (xhprof_aggregate_runs will always average data which does not fit Piwik's use case).
[ "Aggregates", "xhprof", "runs", "w", "/", "o", "normalizing", "(", "xhprof_aggregate_runs", "will", "always", "average", "data", "which", "does", "not", "fit", "Piwik", "s", "use", "case", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Profiler.php#L311-L339
train
Aggregate XHProf run metrics to the main run metrics
[ 30522, 2270, 10763, 3853, 9572, 2595, 22269, 3217, 19699, 4609, 2015, 1006, 1002, 2448, 9821, 1010, 1002, 6337, 12789, 7834, 15327, 1010, 1002, 3828, 4263, 19496, 2094, 1007, 1063, 1002, 1060, 22269, 3217, 19699, 4609, 2015, 1027, 2047, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/MailServiceProvider.php
MailServiceProvider.setGlobalAddress
protected function setGlobalAddress($mailer, array $config, $type) { $address = Arr::get($config, $type); if (is_array($address) && isset($address['address'])) { $mailer->{'always'.Str::studly($type)}($address['address'], $address['name']); } }
php
protected function setGlobalAddress($mailer, array $config, $type) { $address = Arr::get($config, $type); if (is_array($address) && isset($address['address'])) { $mailer->{'always'.Str::studly($type)}($address['address'], $address['name']); } }
[ "protected", "function", "setGlobalAddress", "(", "$", "mailer", ",", "array", "$", "config", ",", "$", "type", ")", "{", "$", "address", "=", "Arr", "::", "get", "(", "$", "config", ",", "$", "type", ")", ";", "if", "(", "is_array", "(", "$", "add...
Set a global address on the mailer by type. @param \Illuminate\Mail\Mailer $mailer @param array $config @param string $type @return void
[ "Set", "a", "global", "address", "on", "the", "mailer", "by", "type", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/MailServiceProvider.php#L68-L75
train
Set global address for the given message.
[ 30522, 5123, 3853, 2275, 23296, 16429, 7911, 14141, 8303, 1006, 1002, 5653, 2121, 1010, 9140, 1002, 9530, 8873, 2290, 1010, 1002, 2828, 1007, 1063, 1002, 4769, 1027, 12098, 2099, 1024, 1024, 2131, 1006, 1002, 9530, 8873, 2290, 1010, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.title
public function title($var = null) { if ($var !== null) { $this->title = $var; } if (empty($this->title)) { $this->title = ucfirst($this->slug()); } return $this->title; }
php
public function title($var = null) { if ($var !== null) { $this->title = $var; } if (empty($this->title)) { $this->title = ucfirst($this->slug()); } return $this->title; }
[ "public", "function", "title", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "title", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "title", ")", ")", "{", ...
Gets and sets the title for this Page. If no title is set, it will use the slug() to get a name @param string $var the title of the Page @return string the title of the Page
[ "Gets", "and", "sets", "the", "title", "for", "this", "Page", ".", "If", "no", "title", "is", "set", "it", "will", "use", "the", "slug", "()", "to", "get", "a", "name" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1499-L1509
train
Get the title of the page
[ 30522, 2270, 3853, 2516, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2516, 1027, 1002, 13075, 1025, 1065, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Matcher/UrlMatcher.php
UrlMatcher.matchCollection
protected function matchCollection($pathinfo, RouteCollection $routes) { // HEAD and GET are equivalent as per RFC if ('HEAD' === $method = $this->context->getMethod()) { $method = 'GET'; } $supportsTrailingSlash = 'GET' === $method && $this instanceof RedirectableUrlMatcherInterface; $trimmedPathinfo = rtrim($pathinfo, '/') ?: '/'; foreach ($routes as $name => $route) { $compiledRoute = $route->compile(); $staticPrefix = rtrim($compiledRoute->getStaticPrefix(), '/'); $requiredMethods = $route->getMethods(); // check the static prefix of the URL first. Only use the more expensive preg_match when it matches if ('' !== $staticPrefix && 0 !== strpos($trimmedPathinfo, $staticPrefix)) { continue; } $regex = $compiledRoute->getRegex(); $pos = strrpos($regex, '$'); $hasTrailingSlash = '/' === $regex[$pos - 1]; $regex = substr_replace($regex, '/?$', $pos - $hasTrailingSlash, 1 + $hasTrailingSlash); if (!preg_match($regex, $pathinfo, $matches)) { continue; } $hasTrailingVar = $trimmedPathinfo !== $pathinfo && preg_match('#\{\w+\}/?$#', $route->getPath()); if ($hasTrailingVar && ($hasTrailingSlash || (null === $m = $matches[\count($compiledRoute->getPathVariables())] ?? null) || '/' !== ($m[-1] ?? '/')) && preg_match($regex, $trimmedPathinfo, $m)) { if ($hasTrailingSlash) { $matches = $m; } else { $hasTrailingVar = false; } } $hostMatches = []; if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { continue; } $status = $this->handleRouteRequirements($pathinfo, $name, $route); if (self::REQUIREMENT_MISMATCH === $status[0]) { continue; } if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) { if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) { return $this->allow = $this->allowSchemes = []; } continue; } $hasRequiredScheme = !$route->getSchemes() || $route->hasScheme($this->context->getScheme()); if ($requiredMethods) { if (!\in_array($method, $requiredMethods)) { if ($hasRequiredScheme) { $this->allow = array_merge($this->allow, $requiredMethods); } continue; } } if (!$hasRequiredScheme) { $this->allowSchemes = array_merge($this->allowSchemes, $route->getSchemes()); continue; } return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : [])); } return []; }
php
protected function matchCollection($pathinfo, RouteCollection $routes) { // HEAD and GET are equivalent as per RFC if ('HEAD' === $method = $this->context->getMethod()) { $method = 'GET'; } $supportsTrailingSlash = 'GET' === $method && $this instanceof RedirectableUrlMatcherInterface; $trimmedPathinfo = rtrim($pathinfo, '/') ?: '/'; foreach ($routes as $name => $route) { $compiledRoute = $route->compile(); $staticPrefix = rtrim($compiledRoute->getStaticPrefix(), '/'); $requiredMethods = $route->getMethods(); // check the static prefix of the URL first. Only use the more expensive preg_match when it matches if ('' !== $staticPrefix && 0 !== strpos($trimmedPathinfo, $staticPrefix)) { continue; } $regex = $compiledRoute->getRegex(); $pos = strrpos($regex, '$'); $hasTrailingSlash = '/' === $regex[$pos - 1]; $regex = substr_replace($regex, '/?$', $pos - $hasTrailingSlash, 1 + $hasTrailingSlash); if (!preg_match($regex, $pathinfo, $matches)) { continue; } $hasTrailingVar = $trimmedPathinfo !== $pathinfo && preg_match('#\{\w+\}/?$#', $route->getPath()); if ($hasTrailingVar && ($hasTrailingSlash || (null === $m = $matches[\count($compiledRoute->getPathVariables())] ?? null) || '/' !== ($m[-1] ?? '/')) && preg_match($regex, $trimmedPathinfo, $m)) { if ($hasTrailingSlash) { $matches = $m; } else { $hasTrailingVar = false; } } $hostMatches = []; if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { continue; } $status = $this->handleRouteRequirements($pathinfo, $name, $route); if (self::REQUIREMENT_MISMATCH === $status[0]) { continue; } if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) { if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) { return $this->allow = $this->allowSchemes = []; } continue; } $hasRequiredScheme = !$route->getSchemes() || $route->hasScheme($this->context->getScheme()); if ($requiredMethods) { if (!\in_array($method, $requiredMethods)) { if ($hasRequiredScheme) { $this->allow = array_merge($this->allow, $requiredMethods); } continue; } } if (!$hasRequiredScheme) { $this->allowSchemes = array_merge($this->allowSchemes, $route->getSchemes()); continue; } return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : [])); } return []; }
[ "protected", "function", "matchCollection", "(", "$", "pathinfo", ",", "RouteCollection", "$", "routes", ")", "{", "// HEAD and GET are equivalent as per RFC", "if", "(", "'HEAD'", "===", "$", "method", "=", "$", "this", "->", "context", "->", "getMethod", "(", ...
Tries to match a URL with a set of routes. @param string $pathinfo The path info to be parsed @param RouteCollection $routes The set of routes @return array An array of parameters @throws NoConfigurationException If no routing configuration could be found @throws ResourceNotFoundException If the resource could not be found @throws MethodNotAllowedException If the resource was found but the request method is not allowed
[ "Tries", "to", "match", "a", "URL", "with", "a", "set", "of", "routes", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/UrlMatcher.php#L132-L210
train
Matches the given pathinfo with the routes
[ 30522, 5123, 3853, 2674, 26895, 18491, 1006, 1002, 4130, 2378, 14876, 1010, 2799, 26895, 18491, 1002, 5847, 1007, 1063, 1013, 1013, 2132, 1998, 2131, 2024, 5662, 2004, 2566, 14645, 2065, 1006, 1005, 2132, 1005, 1027, 1027, 1027, 1002, 4118,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
MySqlGrammar.modifyNullable
protected function modifyNullable(Blueprint $blueprint, Fluent $column) { if (is_null($column->virtualAs) && is_null($column->storedAs)) { return $column->nullable ? ' null' : ' not null'; } }
php
protected function modifyNullable(Blueprint $blueprint, Fluent $column) { if (is_null($column->virtualAs) && is_null($column->storedAs)) { return $column->nullable ? ' null' : ' not null'; } }
[ "protected", "function", "modifyNullable", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "column", ")", "{", "if", "(", "is_null", "(", "$", "column", "->", "virtualAs", ")", "&&", "is_null", "(", "$", "column", "->", "storedAs", ")", ")", "{",...
Get the SQL for a nullable column modifier. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $column @return string|null
[ "Get", "the", "SQL", "for", "a", "nullable", "column", "modifier", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L940-L945
train
Modify the nullable modifier for a column.
[ 30522, 5123, 3853, 19933, 11231, 4571, 3468, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 5930, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 5930, 1011, 1028, 7484, 3022, 1007, 1004, 1004, 2003, 1035, 19701, 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...
overtrue/wechat
src/OfficialAccount/ShakeAround/StatsClient.php
StatsClient.pageSummary
public function pageSummary(int $pageId, int $beginTime, int $endTime) { $params = [ 'page_id' => $pageId, 'begin_date' => $beginTime, 'end_date' => $endTime, ]; return $this->httpPostJson('shakearound/statistics/page', $params); }
php
public function pageSummary(int $pageId, int $beginTime, int $endTime) { $params = [ 'page_id' => $pageId, 'begin_date' => $beginTime, 'end_date' => $endTime, ]; return $this->httpPostJson('shakearound/statistics/page', $params); }
[ "public", "function", "pageSummary", "(", "int", "$", "pageId", ",", "int", "$", "beginTime", ",", "int", "$", "endTime", ")", "{", "$", "params", "=", "[", "'page_id'", "=>", "$", "pageId", ",", "'begin_date'", "=>", "$", "beginTime", ",", "'end_date'",...
Fetch statistics data by pageId. @param int $pageId @param int $beginTime (Unix timestamp) @param int $endTime (Unix timestamp) @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Fetch", "statistics", "data", "by", "pageId", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/ShakeAround/StatsClient.php#L70-L79
train
Get Page Summary
[ 30522, 2270, 3853, 5530, 2819, 7849, 2100, 1006, 20014, 1002, 3931, 3593, 1010, 20014, 1002, 4088, 7292, 1010, 20014, 1002, 2203, 7292, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 3931, 1035, 8909, 1005, 1027, 1028, 1002, 3931, 3593, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Translation/Translator.php
Translator.getLine
protected function getLine($namespace, $group, $locale, $item, array $replace) { $this->load($namespace, $group, $locale); $line = Arr::get($this->loaded[$namespace][$group][$locale], $item); if (is_string($line)) { return $this->makeReplacements($line, $replace); } elseif (is_array($line) && count($line) > 0) { foreach ($line as $key => $value) { $line[$key] = $this->makeReplacements($value, $replace); } return $line; } }
php
protected function getLine($namespace, $group, $locale, $item, array $replace) { $this->load($namespace, $group, $locale); $line = Arr::get($this->loaded[$namespace][$group][$locale], $item); if (is_string($line)) { return $this->makeReplacements($line, $replace); } elseif (is_array($line) && count($line) > 0) { foreach ($line as $key => $value) { $line[$key] = $this->makeReplacements($value, $replace); } return $line; } }
[ "protected", "function", "getLine", "(", "$", "namespace", ",", "$", "group", ",", "$", "locale", ",", "$", "item", ",", "array", "$", "replace", ")", "{", "$", "this", "->", "load", "(", "$", "namespace", ",", "$", "group", ",", "$", "locale", ")"...
Retrieve a language line out the loaded array. @param string $namespace @param string $group @param string $locale @param string $item @param array $replace @return string|array|null
[ "Retrieve", "a", "language", "line", "out", "the", "loaded", "array", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Translation/Translator.php#L234-L249
train
Get Line from loaded array
[ 30522, 5123, 3853, 2131, 4179, 1006, 1002, 3415, 15327, 1010, 1002, 2177, 1010, 1002, 2334, 2063, 1010, 1002, 8875, 1010, 9140, 1002, 5672, 1007, 1063, 1002, 2023, 1011, 1028, 7170, 1006, 1002, 3415, 15327, 1010, 1002, 2177, 1010, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Scheduler/Scheduler.php
Scheduler.getAllJobs
public function getAllJobs() { list($background, $foreground) = $this->loadSavedJobs()->getQueuedJobs(true); return array_merge($background, $foreground); }
php
public function getAllJobs() { list($background, $foreground) = $this->loadSavedJobs()->getQueuedJobs(true); return array_merge($background, $foreground); }
[ "public", "function", "getAllJobs", "(", ")", "{", "list", "(", "$", "background", ",", "$", "foreground", ")", "=", "$", "this", "->", "loadSavedJobs", "(", ")", "->", "getQueuedJobs", "(", "true", ")", ";", "return", "array_merge", "(", "$", "backgroun...
Get all jobs if they are disabled or not as one array @return array
[ "Get", "all", "jobs", "if", "they", "are", "disabled", "or", "not", "as", "one", "array" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Scheduler.php#L111-L116
train
Get all queued jobs
[ 30522, 2270, 3853, 2131, 8095, 5558, 5910, 1006, 1007, 1063, 2862, 1006, 1002, 4281, 1010, 1002, 18921, 16365, 1007, 1027, 1002, 2023, 1011, 1028, 15665, 10696, 2094, 5558, 5910, 1006, 1007, 1011, 1028, 2131, 4226, 5657, 2094, 5558, 5910, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
CollectionType.finishView
public function finishView(FormView $view, FormInterface $form, array $options) { if ($form->getConfig()->hasAttribute('prototype') && $view->vars['prototype']->vars['multipart']) { $view->vars['multipart'] = true; } }
php
public function finishView(FormView $view, FormInterface $form, array $options) { if ($form->getConfig()->hasAttribute('prototype') && $view->vars['prototype']->vars['multipart']) { $view->vars['multipart'] = true; } }
[ "public", "function", "finishView", "(", "FormView", "$", "view", ",", "FormInterface", "$", "form", ",", "array", "$", "options", ")", "{", "if", "(", "$", "form", "->", "getConfig", "(", ")", "->", "hasAttribute", "(", "'prototype'", ")", "&&", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php#L73-L78
train
Finishes the form view.
[ 30522, 2270, 3853, 3926, 8584, 1006, 2433, 8584, 1002, 3193, 1010, 2433, 18447, 2121, 12172, 1002, 2433, 1010, 9140, 1002, 7047, 1007, 1063, 2065, 1006, 1002, 2433, 1011, 1028, 2131, 8663, 8873, 2290, 1006, 1007, 1011, 1028, 2038, 19321, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Console/Scheduling/Event.php
Event.sendOutputTo
public function sendOutputTo($location, $append = false) { $this->output = $location; $this->shouldAppendOutput = $append; return $this; }
php
public function sendOutputTo($location, $append = false) { $this->output = $location; $this->shouldAppendOutput = $append; return $this; }
[ "public", "function", "sendOutputTo", "(", "$", "location", ",", "$", "append", "=", "false", ")", "{", "$", "this", "->", "output", "=", "$", "location", ";", "$", "this", "->", "shouldAppendOutput", "=", "$", "append", ";", "return", "$", "this", ";"...
Send the output of the command to a given location. @param string $location @param bool $append @return $this
[ "Send", "the", "output", "of", "the", "command", "to", "a", "given", "location", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Event.php#L367-L374
train
Send the output to the specified location.
[ 30522, 2270, 3853, 4604, 5833, 18780, 3406, 1006, 1002, 3295, 1010, 1002, 10439, 10497, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 6434, 1027, 1002, 3295, 1025, 1002, 2023, 1011, 1028, 2323, 29098, 10497, 5833, 18780, 1027, 1002, 10439...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getRangeString
public function getRangeString() { $dateStart = $this->getDateStart(); $dateEnd = $this->getDateEnd(); return $dateStart->toString("Y-m-d") . "," . $dateEnd->toString("Y-m-d"); }
php
public function getRangeString() { $dateStart = $this->getDateStart(); $dateEnd = $this->getDateEnd(); return $dateStart->toString("Y-m-d") . "," . $dateEnd->toString("Y-m-d"); }
[ "public", "function", "getRangeString", "(", ")", "{", "$", "dateStart", "=", "$", "this", "->", "getDateStart", "(", ")", ";", "$", "dateEnd", "=", "$", "this", "->", "getDateEnd", "(", ")", ";", "return", "$", "dateStart", "->", "toString", "(", "\"Y...
Returns the date range string comprising two dates @return string eg, `'2012-01-01,2012-01-31'`.
[ "Returns", "the", "date", "range", "string", "comprising", "two", "dates" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L538-L544
train
Get range string
[ 30522, 2270, 3853, 2131, 24388, 4355, 4892, 1006, 1007, 1063, 1002, 5246, 7559, 2102, 1027, 1002, 2023, 1011, 1028, 2131, 27122, 7559, 2102, 1006, 1007, 1025, 1002, 3058, 10497, 1027, 1002, 2023, 1011, 1028, 2131, 13701, 10497, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend.php
Zend_Cache_Backend.setDirectives
public function setDirectives($directives) { if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array'); while (list($name, $value) = each($directives)) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name : $name"); } $name = strtolower($name); if (array_key_exists($name, $this->_directives)) { $this->_directives[$name] = $value; } } $this->_loggerSanity(); }
php
public function setDirectives($directives) { if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array'); while (list($name, $value) = each($directives)) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name : $name"); } $name = strtolower($name); if (array_key_exists($name, $this->_directives)) { $this->_directives[$name] = $value; } } $this->_loggerSanity(); }
[ "public", "function", "setDirectives", "(", "$", "directives", ")", "{", "if", "(", "!", "is_array", "(", "$", "directives", ")", ")", "Zend_Cache", "::", "throwException", "(", "'Directives parameter must be an array'", ")", ";", "while", "(", "list", "(", "$...
Set the frontend directives @param array $directives Assoc of directives @throws Zend_Cache_Exception @return void
[ "Set", "the", "frontend", "directives" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend.php#L78-L93
train
Set the list of cache directive names to be used in the cache file
[ 30522, 2270, 3853, 2275, 4305, 2890, 15277, 2015, 1006, 1002, 16449, 2015, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 16449, 2015, 1007, 1007, 16729, 2094, 1035, 17053, 1024, 1024, 5466, 10288, 24422, 1006, 1005, 16449, 2015...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/Grammar.php
Grammar.compileUnionAggregate
protected function compileUnionAggregate(Builder $query) { $sql = $this->compileAggregate($query, $query->aggregate); $query->aggregate = null; return $sql.' from ('.$this->compileSelect($query).') as '.$this->wrapTable('temp_table'); }
php
protected function compileUnionAggregate(Builder $query) { $sql = $this->compileAggregate($query, $query->aggregate); $query->aggregate = null; return $sql.' from ('.$this->compileSelect($query).') as '.$this->wrapTable('temp_table'); }
[ "protected", "function", "compileUnionAggregate", "(", "Builder", "$", "query", ")", "{", "$", "sql", "=", "$", "this", "->", "compileAggregate", "(", "$", "query", ",", "$", "query", "->", "aggregate", ")", ";", "$", "query", "->", "aggregate", "=", "nu...
Compile a union aggregate query into SQL. @param \Illuminate\Database\Query\Builder $query @return string
[ "Compile", "a", "union", "aggregate", "query", "into", "SQL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L823-L830
train
Compiles a union aggregate query into SQL
[ 30522, 5123, 3853, 4012, 22090, 19496, 7856, 13871, 2890, 5867, 1006, 12508, 1002, 23032, 1007, 1063, 1002, 29296, 1027, 1002, 2023, 1011, 1028, 4012, 22090, 8490, 17603, 5867, 1006, 1002, 23032, 1010, 1002, 23032, 1011, 1028, 9572, 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...
laravel/framework
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
ValidatesAttributes.validateDigitsBetween
public function validateDigitsBetween($attribute, $value, $parameters) { $this->requireParameterCount(2, $parameters, 'digits_between'); $length = strlen((string) $value); return ! preg_match('/[^0-9]/', $value) && $length >= $parameters[0] && $length <= $parameters[1]; }
php
public function validateDigitsBetween($attribute, $value, $parameters) { $this->requireParameterCount(2, $parameters, 'digits_between'); $length = strlen((string) $value); return ! preg_match('/[^0-9]/', $value) && $length >= $parameters[0] && $length <= $parameters[1]; }
[ "public", "function", "validateDigitsBetween", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "$", "this", "->", "requireParameterCount", "(", "2", ",", "$", "parameters", ",", "'digits_between'", ")", ";", "$", "length", "=", ...
Validate that an attribute is between a given number of digits. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "Validate", "that", "an", "attribute", "is", "between", "a", "given", "number", "of", "digits", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L478-L486
train
Validate that a value is a digit between 2
[ 30522, 2270, 3853, 9398, 4383, 8004, 12762, 20915, 28394, 2078, 1006, 1002, 17961, 1010, 1002, 3643, 1010, 1002, 11709, 1007, 1063, 1002, 2023, 1011, 1028, 5478, 28689, 22828, 3597, 16671, 1006, 1016, 1010, 1002, 11709, 1010, 1005, 16648, 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...
walkor/Workerman
Connection/TcpConnection.php
TcpConnection.destroy
public function destroy() { // Avoid repeated calls. if ($this->_status === self::STATUS_CLOSED) { return; } // Remove event listener. Worker::$globalEvent->del($this->_socket, EventInterface::EV_READ); Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE); // Close socket. set_error_handler(function(){}); fclose($this->_socket); restore_error_handler(); $this->_status = self::STATUS_CLOSED; // Try to emit onClose callback. if ($this->onClose) { try { call_user_func($this->onClose, $this); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } // Try to emit protocol::onClose if ($this->protocol && method_exists($this->protocol, 'onClose')) { try { call_user_func(array($this->protocol, 'onClose'), $this); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } $this->_sendBuffer = $this->_recvBuffer = ''; if ($this->_status === self::STATUS_CLOSED) { // Cleaning up the callback to avoid memory leaks. $this->onMessage = $this->onClose = $this->onError = $this->onBufferFull = $this->onBufferDrain = null; // Remove from worker->connections. if ($this->worker) { unset($this->worker->connections[$this->_id]); } unset(static::$connections[$this->_id]); } }
php
public function destroy() { // Avoid repeated calls. if ($this->_status === self::STATUS_CLOSED) { return; } // Remove event listener. Worker::$globalEvent->del($this->_socket, EventInterface::EV_READ); Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE); // Close socket. set_error_handler(function(){}); fclose($this->_socket); restore_error_handler(); $this->_status = self::STATUS_CLOSED; // Try to emit onClose callback. if ($this->onClose) { try { call_user_func($this->onClose, $this); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } // Try to emit protocol::onClose if ($this->protocol && method_exists($this->protocol, 'onClose')) { try { call_user_func(array($this->protocol, 'onClose'), $this); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } $this->_sendBuffer = $this->_recvBuffer = ''; if ($this->_status === self::STATUS_CLOSED) { // Cleaning up the callback to avoid memory leaks. $this->onMessage = $this->onClose = $this->onError = $this->onBufferFull = $this->onBufferDrain = null; // Remove from worker->connections. if ($this->worker) { unset($this->worker->connections[$this->_id]); } unset(static::$connections[$this->_id]); } }
[ "public", "function", "destroy", "(", ")", "{", "// Avoid repeated calls.", "if", "(", "$", "this", "->", "_status", "===", "self", "::", "STATUS_CLOSED", ")", "{", "return", ";", "}", "// Remove event listener.", "Worker", "::", "$", "globalEvent", "->", "del...
Destroy connection. @return void
[ "Destroy", "connection", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Connection/TcpConnection.php#L926-L976
train
Destroy the connection
[ 30522, 2270, 3853, 6033, 1006, 1007, 1063, 1013, 1013, 4468, 5567, 4455, 1012, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 3570, 1027, 1027, 1027, 2969, 1024, 1024, 3570, 1035, 2701, 1007, 1063, 2709, 1025, 1065, 1013, 1013, 6366, 2724, 193...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/thrift
lib/php/lib/Protocol/TJSONProtocol.php
TJSONProtocol.writeMessageBegin
public function writeMessageBegin($name, $type, $seqid) { $this->writeJSONArrayStart(); $this->writeJSONInteger(self::VERSION); $this->writeJSONString($name); $this->writeJSONInteger($type); $this->writeJSONInteger($seqid); }
php
public function writeMessageBegin($name, $type, $seqid) { $this->writeJSONArrayStart(); $this->writeJSONInteger(self::VERSION); $this->writeJSONString($name); $this->writeJSONInteger($type); $this->writeJSONInteger($seqid); }
[ "public", "function", "writeMessageBegin", "(", "$", "name", ",", "$", "type", ",", "$", "seqid", ")", "{", "$", "this", "->", "writeJSONArrayStart", "(", ")", ";", "$", "this", "->", "writeJSONInteger", "(", "self", "::", "VERSION", ")", ";", "$", "th...
Writes the message header @param string $name Function name @param int $type message type TMessageType::CALL or TMessageType::REPLY @param int $seqid The sequence id of this message
[ "Writes", "the", "message", "header" ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Protocol/TJSONProtocol.php#L529-L536
train
Write the message begin
[ 30522, 2270, 3853, 4339, 7834, 3736, 3351, 4783, 11528, 1006, 1002, 2171, 1010, 1002, 2828, 1010, 1002, 7367, 14702, 2094, 1007, 1063, 1002, 2023, 1011, 1028, 4339, 22578, 7856, 11335, 27268, 8445, 1006, 1007, 1025, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Updates/3.0.0-b4.php
Updates_3_0_0_b4.getUserPasswordMigrations
private function getUserPasswordMigrations($queries) { $db = Db::get(); $userTable = Common::prefixTable($this->userTable); $users = $db->fetchAll( 'SELECT `login`, `password` FROM `' . $userTable . '` WHERE LENGTH(`password`) = 32' ); foreach ($users as $user) { $queries[] = $this->migration->db->boundSql( 'UPDATE `' . $userTable . '`' . ' SET `password` = ?' . ' WHERE `login` = ?', [ password_hash($user['password'], PASSWORD_BCRYPT), $user['login'], ] ); } return $queries; }
php
private function getUserPasswordMigrations($queries) { $db = Db::get(); $userTable = Common::prefixTable($this->userTable); $users = $db->fetchAll( 'SELECT `login`, `password` FROM `' . $userTable . '` WHERE LENGTH(`password`) = 32' ); foreach ($users as $user) { $queries[] = $this->migration->db->boundSql( 'UPDATE `' . $userTable . '`' . ' SET `password` = ?' . ' WHERE `login` = ?', [ password_hash($user['password'], PASSWORD_BCRYPT), $user['login'], ] ); } return $queries; }
[ "private", "function", "getUserPasswordMigrations", "(", "$", "queries", ")", "{", "$", "db", "=", "Db", "::", "get", "(", ")", ";", "$", "userTable", "=", "Common", "::", "prefixTable", "(", "$", "this", "->", "userTable", ")", ";", "$", "users", "=",...
Returns migrations to hash existing password with bcrypt. @param Migration[] $queries @return Migration[]
[ "Returns", "migrations", "to", "hash", "existing", "password", "with", "bcrypt", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updates/3.0.0-b4.php#L76-L98
train
Returns the list of queries to update the user s password
[ 30522, 2797, 3853, 2131, 20330, 15194, 18351, 4328, 29397, 2015, 1006, 1002, 10861, 5134, 1007, 1063, 1002, 16962, 1027, 16962, 1024, 1024, 2131, 1006, 1007, 1025, 1002, 5310, 10880, 1027, 2691, 1024, 1024, 17576, 10880, 1006, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/EventGenerateCommand.php
EventGenerateCommand.makeEventAndListeners
protected function makeEventAndListeners($event, $listeners) { if (! Str::contains($event, '\\')) { return; } $this->callSilent('make:event', ['name' => $event]); $this->makeListeners($event, $listeners); }
php
protected function makeEventAndListeners($event, $listeners) { if (! Str::contains($event, '\\')) { return; } $this->callSilent('make:event', ['name' => $event]); $this->makeListeners($event, $listeners); }
[ "protected", "function", "makeEventAndListeners", "(", "$", "event", ",", "$", "listeners", ")", "{", "if", "(", "!", "Str", "::", "contains", "(", "$", "event", ",", "'\\\\'", ")", ")", "{", "return", ";", "}", "$", "this", "->", "callSilent", "(", ...
Make the event and listeners for the given event. @param string $event @param array $listeners @return void
[ "Make", "the", "event", "and", "listeners", "for", "the", "given", "event", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/EventGenerateCommand.php#L50-L59
train
Make event and listeners
[ 30522, 5123, 3853, 2191, 18697, 12380, 4859, 9863, 24454, 2015, 1006, 1002, 2724, 1010, 1002, 13810, 1007, 1063, 2065, 1006, 999, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 2724, 1010, 1005, 1032, 1032, 1005, 1007, 1007, 1063, 2709, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php
CallbackChoiceLoader.loadChoiceList
public function loadChoiceList($value = null) { if (null !== $this->choiceList) { return $this->choiceList; } return $this->choiceList = new ArrayChoiceList(($this->callback)(), $value); }
php
public function loadChoiceList($value = null) { if (null !== $this->choiceList) { return $this->choiceList; } return $this->choiceList = new ArrayChoiceList(($this->callback)(), $value); }
[ "public", "function", "loadChoiceList", "(", "$", "value", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "choiceList", ")", "{", "return", "$", "this", "->", "choiceList", ";", "}", "return", "$", "this", "->", "choiceList", "=", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php#L43-L50
train
Load the choice list
[ 30522, 2270, 3853, 7170, 9905, 6610, 9863, 1006, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 3601, 9863, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 3601, 9863, 1025, 1065, 2709, 1002, 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...
laravel/framework
src/Illuminate/Foundation/Console/RouteListCommand.php
RouteListCommand.getColumns
protected function getColumns() { $availableColumns = array_map('strtolower', $this->headers); if ($this->option('compact')) { return array_intersect($availableColumns, $this->compactColumns); } if ($columns = $this->option('columns')) { return array_intersect($availableColumns, $columns); } return $availableColumns; }
php
protected function getColumns() { $availableColumns = array_map('strtolower', $this->headers); if ($this->option('compact')) { return array_intersect($availableColumns, $this->compactColumns); } if ($columns = $this->option('columns')) { return array_intersect($availableColumns, $columns); } return $availableColumns; }
[ "protected", "function", "getColumns", "(", ")", "{", "$", "availableColumns", "=", "array_map", "(", "'strtolower'", ",", "$", "this", "->", "headers", ")", ";", "if", "(", "$", "this", "->", "option", "(", "'compact'", ")", ")", "{", "return", "array_i...
Get the column names to show (lowercase table headers). @return array
[ "Get", "the", "column", "names", "to", "show", "(", "lowercase", "table", "headers", ")", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/RouteListCommand.php#L204-L217
train
Get columns from the header
[ 30522, 5123, 3853, 2131, 25778, 2819, 3619, 1006, 1007, 1063, 1002, 2800, 25778, 2819, 3619, 1027, 9140, 1035, 4949, 1006, 1005, 2358, 5339, 12898, 13777, 1005, 1010, 1002, 2023, 1011, 1028, 20346, 2015, 1007, 1025, 2065, 1006, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Controller.php
Controller.renderPage
public function renderPage() { $contents = $this->pageContents; /** * @event cms.page.render * Provides an oportunity to manipulate the page's rendered contents * * Example usage: * * Event::listen('cms.page.render', function ((\Cms\Classes\Controller) $controller, (string) $pageContents) { * return 'My custom contents'; * }); * * Or * * $CmsController->bindEvent('page.render', function ((string) $pageContents) { * return 'My custom contents'; * }); * */ if ($event = $this->fireSystemEvent('cms.page.render', [$contents])) { return $event; } return $contents; }
php
public function renderPage() { $contents = $this->pageContents; /** * @event cms.page.render * Provides an oportunity to manipulate the page's rendered contents * * Example usage: * * Event::listen('cms.page.render', function ((\Cms\Classes\Controller) $controller, (string) $pageContents) { * return 'My custom contents'; * }); * * Or * * $CmsController->bindEvent('page.render', function ((string) $pageContents) { * return 'My custom contents'; * }); * */ if ($event = $this->fireSystemEvent('cms.page.render', [$contents])) { return $event; } return $contents; }
[ "public", "function", "renderPage", "(", ")", "{", "$", "contents", "=", "$", "this", "->", "pageContents", ";", "/**\n * @event cms.page.render\n * Provides an oportunity to manipulate the page's rendered contents\n *\n * Example usage:\n *\n ...
Renders a requested page. The framework uses this method internally.
[ "Renders", "a", "requested", "page", ".", "The", "framework", "uses", "this", "method", "internally", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L896-L922
train
Returns the page contents
[ 30522, 2270, 3853, 17552, 13704, 1006, 1007, 1063, 1002, 8417, 1027, 1002, 2023, 1011, 1028, 3931, 8663, 6528, 3215, 1025, 1013, 1008, 1008, 1008, 1030, 2724, 4642, 2015, 1012, 3931, 1012, 17552, 1008, 3640, 2019, 6728, 11589, 19496, 3723, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Dompdf.php
Dompdf.loadHtml
public function loadHtml($str, $encoding = 'UTF-8') { $this->saveLocale(); // FIXME: Determine character encoding, switch to UTF8, update meta tag. Need better http/file stream encoding detection, currently relies on text or meta tag. $known_encodings = mb_list_encodings(); mb_detect_order('auto'); if (($file_encoding = mb_detect_encoding($str, null, true)) === false) { $file_encoding = "auto"; } if (in_array(strtoupper($file_encoding), array('UTF-8','UTF8')) === false) { $str = mb_convert_encoding($str, 'UTF-8', $file_encoding); } $metatags = array( '@<meta\s+http-equiv="Content-Type"\s+content="(?:[\w/]+)(?:;\s*?charset=([^\s"]+))?@i', '@<meta\s+content="(?:[\w/]+)(?:;\s*?charset=([^\s"]+))"?\s+http-equiv="Content-Type"@i', '@<meta [^>]*charset\s*=\s*["\']?\s*([^"\' ]+)@i', ); foreach ($metatags as $metatag) { if (preg_match($metatag, $str, $matches)) { if (isset($matches[1]) && in_array($matches[1], $known_encodings)) { $document_encoding = $matches[1]; break; } } } if (isset($document_encoding) && in_array(strtoupper($document_encoding), array('UTF-8','UTF8')) === false) { $str = preg_replace('/charset=([^\s"]+)/i', 'charset=UTF-8', $str); } elseif (isset($document_encoding) === false && strpos($str, '<head>') !== false) { $str = str_replace('<head>', '<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">', $str); } elseif (isset($document_encoding) === false) { $str = '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">' . $str; } //FIXME: since we're not using this just yet $encoding = 'UTF-8'; // remove BOM mark from UTF-8, it's treated as document text by DOMDocument // FIXME: roll this into the encoding detection using UTF-8/16/32 BOM (http://us2.php.net/manual/en/function.mb-detect-encoding.php#91051)? if (substr($str, 0, 3) == chr(0xEF) . chr(0xBB) . chr(0xBF)) { $str = substr($str, 3); } // Store parsing warnings as messages set_error_handler(array("\\Dompdf\\Helpers", "record_warnings")); // @todo Take the quirksmode into account // http://hsivonen.iki.fi/doctype/ // https://developer.mozilla.org/en/mozilla's_quirks_mode $quirksmode = false; if ($this->options->isHtml5ParserEnabled() && class_exists("HTML5_Tokenizer")) { $tokenizer = new HTML5_Tokenizer($str); $tokenizer->parse(); $doc = $tokenizer->save(); // Remove #text children nodes in nodes that shouldn't have $tag_names = array("html", "table", "tbody", "thead", "tfoot", "tr"); foreach ($tag_names as $tag_name) { $nodes = $doc->getElementsByTagName($tag_name); foreach ($nodes as $node) { self::removeTextNodes($node); } } $quirksmode = ($tokenizer->getTree()->getQuirksMode() > HTML5_TreeBuilder::NO_QUIRKS); } else { // loadHTML assumes ISO-8859-1 unless otherwise specified on the HTML document header. // http://devzone.zend.com/1538/php-dom-xml-extension-encoding-processing/ (see #4) // http://stackoverflow.com/a/11310258/264628 $doc = new DOMDocument("1.0", $encoding); $doc->preserveWhiteSpace = true; $doc->loadHTML($str); $doc->encoding = $encoding; // Remove #text children nodes in nodes that shouldn't have $tag_names = array("html", "table", "tbody", "thead", "tfoot", "tr"); foreach ($tag_names as $tag_name) { $nodes = $doc->getElementsByTagName($tag_name); foreach ($nodes as $node) { self::removeTextNodes($node); } } // If some text is before the doctype, we are in quirksmode if (preg_match("/^(.+)<!doctype/i", ltrim($str), $matches)) { $quirksmode = true; } // If no doctype is provided, we are in quirksmode elseif (!preg_match("/^<!doctype/i", ltrim($str), $matches)) { $quirksmode = true; } else { // HTML5 <!DOCTYPE html> if (!$doc->doctype->publicId && !$doc->doctype->systemId) { $quirksmode = false; } // not XHTML if (!preg_match("/xhtml/i", $doc->doctype->publicId)) { $quirksmode = true; } } } $this->dom = $doc; $this->quirksmode = $quirksmode; $this->tree = new FrameTree($this->dom); restore_error_handler(); $this->restoreLocale(); }
php
public function loadHtml($str, $encoding = 'UTF-8') { $this->saveLocale(); // FIXME: Determine character encoding, switch to UTF8, update meta tag. Need better http/file stream encoding detection, currently relies on text or meta tag. $known_encodings = mb_list_encodings(); mb_detect_order('auto'); if (($file_encoding = mb_detect_encoding($str, null, true)) === false) { $file_encoding = "auto"; } if (in_array(strtoupper($file_encoding), array('UTF-8','UTF8')) === false) { $str = mb_convert_encoding($str, 'UTF-8', $file_encoding); } $metatags = array( '@<meta\s+http-equiv="Content-Type"\s+content="(?:[\w/]+)(?:;\s*?charset=([^\s"]+))?@i', '@<meta\s+content="(?:[\w/]+)(?:;\s*?charset=([^\s"]+))"?\s+http-equiv="Content-Type"@i', '@<meta [^>]*charset\s*=\s*["\']?\s*([^"\' ]+)@i', ); foreach ($metatags as $metatag) { if (preg_match($metatag, $str, $matches)) { if (isset($matches[1]) && in_array($matches[1], $known_encodings)) { $document_encoding = $matches[1]; break; } } } if (isset($document_encoding) && in_array(strtoupper($document_encoding), array('UTF-8','UTF8')) === false) { $str = preg_replace('/charset=([^\s"]+)/i', 'charset=UTF-8', $str); } elseif (isset($document_encoding) === false && strpos($str, '<head>') !== false) { $str = str_replace('<head>', '<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">', $str); } elseif (isset($document_encoding) === false) { $str = '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">' . $str; } //FIXME: since we're not using this just yet $encoding = 'UTF-8'; // remove BOM mark from UTF-8, it's treated as document text by DOMDocument // FIXME: roll this into the encoding detection using UTF-8/16/32 BOM (http://us2.php.net/manual/en/function.mb-detect-encoding.php#91051)? if (substr($str, 0, 3) == chr(0xEF) . chr(0xBB) . chr(0xBF)) { $str = substr($str, 3); } // Store parsing warnings as messages set_error_handler(array("\\Dompdf\\Helpers", "record_warnings")); // @todo Take the quirksmode into account // http://hsivonen.iki.fi/doctype/ // https://developer.mozilla.org/en/mozilla's_quirks_mode $quirksmode = false; if ($this->options->isHtml5ParserEnabled() && class_exists("HTML5_Tokenizer")) { $tokenizer = new HTML5_Tokenizer($str); $tokenizer->parse(); $doc = $tokenizer->save(); // Remove #text children nodes in nodes that shouldn't have $tag_names = array("html", "table", "tbody", "thead", "tfoot", "tr"); foreach ($tag_names as $tag_name) { $nodes = $doc->getElementsByTagName($tag_name); foreach ($nodes as $node) { self::removeTextNodes($node); } } $quirksmode = ($tokenizer->getTree()->getQuirksMode() > HTML5_TreeBuilder::NO_QUIRKS); } else { // loadHTML assumes ISO-8859-1 unless otherwise specified on the HTML document header. // http://devzone.zend.com/1538/php-dom-xml-extension-encoding-processing/ (see #4) // http://stackoverflow.com/a/11310258/264628 $doc = new DOMDocument("1.0", $encoding); $doc->preserveWhiteSpace = true; $doc->loadHTML($str); $doc->encoding = $encoding; // Remove #text children nodes in nodes that shouldn't have $tag_names = array("html", "table", "tbody", "thead", "tfoot", "tr"); foreach ($tag_names as $tag_name) { $nodes = $doc->getElementsByTagName($tag_name); foreach ($nodes as $node) { self::removeTextNodes($node); } } // If some text is before the doctype, we are in quirksmode if (preg_match("/^(.+)<!doctype/i", ltrim($str), $matches)) { $quirksmode = true; } // If no doctype is provided, we are in quirksmode elseif (!preg_match("/^<!doctype/i", ltrim($str), $matches)) { $quirksmode = true; } else { // HTML5 <!DOCTYPE html> if (!$doc->doctype->publicId && !$doc->doctype->systemId) { $quirksmode = false; } // not XHTML if (!preg_match("/xhtml/i", $doc->doctype->publicId)) { $quirksmode = true; } } } $this->dom = $doc; $this->quirksmode = $quirksmode; $this->tree = new FrameTree($this->dom); restore_error_handler(); $this->restoreLocale(); }
[ "public", "function", "loadHtml", "(", "$", "str", ",", "$", "encoding", "=", "'UTF-8'", ")", "{", "$", "this", "->", "saveLocale", "(", ")", ";", "// FIXME: Determine character encoding, switch to UTF8, update meta tag. Need better http/file stream encoding detection, curren...
Loads an HTML string Parse errors are stored in the global array _dompdf_warnings. @todo use the $encoding variable @param string $str HTML text to load @param string $encoding Not used yet
[ "Loads", "an", "HTML", "string", "Parse", "errors", "are", "stored", "in", "the", "global", "array", "_dompdf_warnings", ".", "@todo", "use", "the", "$encoding", "variable" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Dompdf.php#L422-L535
train
Load HTML from string
[ 30522, 2270, 3853, 7170, 11039, 19968, 1006, 1002, 2358, 2099, 1010, 1002, 17181, 1027, 1005, 21183, 2546, 1011, 1022, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 3828, 4135, 9289, 2063, 1006, 1007, 1025, 1013, 1013, 8081, 4168, 1024, 5646, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/BeautifyTimeRangeLabels.php
BeautifyTimeRangeLabels.getSingleUnitLabel
public function getSingleUnitLabel($oldLabel, $lowerBound) { if ($lowerBound < 60) { return sprintf($this->labelSecondsPlural, $lowerBound, $lowerBound); } elseif ($lowerBound == 60) { return $this->labelSingular; } else { return sprintf($this->labelPlural, ceil($lowerBound / 60)); } }
php
public function getSingleUnitLabel($oldLabel, $lowerBound) { if ($lowerBound < 60) { return sprintf($this->labelSecondsPlural, $lowerBound, $lowerBound); } elseif ($lowerBound == 60) { return $this->labelSingular; } else { return sprintf($this->labelPlural, ceil($lowerBound / 60)); } }
[ "public", "function", "getSingleUnitLabel", "(", "$", "oldLabel", ",", "$", "lowerBound", ")", "{", "if", "(", "$", "lowerBound", "<", "60", ")", "{", "return", "sprintf", "(", "$", "this", "->", "labelSecondsPlural", ",", "$", "lowerBound", ",", "$", "l...
Beautifies and returns a range label whose range spans over one unit, ie 1-1, 2-2 or 3-3. If the lower bound of the range is less than 60 the pretty range label will be in seconds. Otherwise, it will be in minutes. @param string $oldLabel The original label value. @param int $lowerBound The lower bound of the range. @return string The pretty range label.
[ "Beautifies", "and", "returns", "a", "range", "label", "whose", "range", "spans", "over", "one", "unit", "ie", "1", "-", "1", "2", "-", "2", "or", "3", "-", "3", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/BeautifyTimeRangeLabels.php#L69-L78
train
Returns the plural form of the unit
[ 30522, 2270, 3853, 4152, 2075, 2571, 19496, 19646, 16336, 2140, 1006, 1002, 2214, 20470, 2884, 1010, 1002, 2896, 15494, 1007, 1063, 2065, 1006, 1002, 2896, 15494, 1026, 3438, 1007, 1063, 2709, 9043, 2546, 1006, 1002, 2023, 1011, 1028, 10873...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Cookie/SetCookie.php
SetCookie.matchesPath
public function matchesPath($requestPath) { $cookiePath = $this->getPath(); // Match on exact matches or when path is the default empty "/" if ($cookiePath === '/' || $cookiePath == $requestPath) { return true; } // Ensure that the cookie-path is a prefix of the request path. if (0 !== strpos($requestPath, $cookiePath)) { return false; } // Match if the last character of the cookie-path is "/" if (substr($cookiePath, -1, 1) === '/') { return true; } // Match if the first character not included in cookie path is "/" return substr($requestPath, strlen($cookiePath), 1) === '/'; }
php
public function matchesPath($requestPath) { $cookiePath = $this->getPath(); // Match on exact matches or when path is the default empty "/" if ($cookiePath === '/' || $cookiePath == $requestPath) { return true; } // Ensure that the cookie-path is a prefix of the request path. if (0 !== strpos($requestPath, $cookiePath)) { return false; } // Match if the last character of the cookie-path is "/" if (substr($cookiePath, -1, 1) === '/') { return true; } // Match if the first character not included in cookie path is "/" return substr($requestPath, strlen($cookiePath), 1) === '/'; }
[ "public", "function", "matchesPath", "(", "$", "requestPath", ")", "{", "$", "cookiePath", "=", "$", "this", "->", "getPath", "(", ")", ";", "// Match on exact matches or when path is the default empty \"/\"", "if", "(", "$", "cookiePath", "===", "'/'", "||", "$",...
Check if the cookie matches a path value. A request-path path-matches a given cookie-path if at least one of the following conditions holds: - The cookie-path and the request-path are identical. - The cookie-path is a prefix of the request-path, and the last character of the cookie-path is %x2F ("/"). - The cookie-path is a prefix of the request-path, and the first character of the request-path that is not included in the cookie- path is a %x2F ("/") character. @param string $requestPath Path to check against @return bool
[ "Check", "if", "the", "cookie", "matches", "a", "path", "value", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/SetCookie.php#L304-L325
train
Matches the request path against the cookie - path
[ 30522, 2270, 3853, 3503, 15069, 1006, 1002, 5227, 15069, 1007, 1063, 1002, 17387, 15069, 1027, 1002, 2023, 1011, 1028, 2131, 15069, 1006, 1007, 1025, 1013, 1013, 2674, 2006, 6635, 3503, 2030, 2043, 4130, 2003, 1996, 12398, 4064, 1000, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter/AbstractFilter.php
AbstractFilter.variables
protected function variables() { return array_merge([ 'id' => $this->id, 'name' => $this->formatName($this->column), 'label' => $this->label, 'value' => $this->value ?: $this->defaultValue, 'presenter' => $this->presenter(), ], $this->presenter()->variables()); }
php
protected function variables() { return array_merge([ 'id' => $this->id, 'name' => $this->formatName($this->column), 'label' => $this->label, 'value' => $this->value ?: $this->defaultValue, 'presenter' => $this->presenter(), ], $this->presenter()->variables()); }
[ "protected", "function", "variables", "(", ")", "{", "return", "array_merge", "(", "[", "'id'", "=>", "$", "this", "->", "id", ",", "'name'", "=>", "$", "this", "->", "formatName", "(", "$", "this", "->", "column", ")", ",", "'label'", "=>", "$", "th...
Variables for filter view. @return array
[ "Variables", "for", "filter", "view", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L466-L475
train
Return the variables of the field
[ 30522, 5123, 3853, 10857, 1006, 1007, 1063, 2709, 9140, 1035, 13590, 1006, 1031, 1005, 8909, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 8909, 1010, 1005, 2171, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 4289, 18442, 1006, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Container/Container.php
Container.bind
public function bind($abstract, $concrete = null, $shared = false) { $this->dropStaleInstances($abstract); // If no concrete type was given, we will simply set the concrete type to the // abstract type. After that, the concrete type to be registered as shared // without being forced to state their classes in both of the parameters. if (is_null($concrete)) { $concrete = $abstract; } // If the factory is not a Closure, it means it is just a class name which is // bound into this container to the abstract type and we will just wrap it // up inside its own Closure to give us more convenience when extending. if (! $concrete instanceof Closure) { $concrete = $this->getClosure($abstract, $concrete); } $this->bindings[$abstract] = compact('concrete', 'shared'); // If the abstract type was already resolved in this container we'll fire the // rebound listener so that any objects which have already gotten resolved // can have their copy of the object updated via the listener callbacks. if ($this->resolved($abstract)) { $this->rebound($abstract); } }
php
public function bind($abstract, $concrete = null, $shared = false) { $this->dropStaleInstances($abstract); // If no concrete type was given, we will simply set the concrete type to the // abstract type. After that, the concrete type to be registered as shared // without being forced to state their classes in both of the parameters. if (is_null($concrete)) { $concrete = $abstract; } // If the factory is not a Closure, it means it is just a class name which is // bound into this container to the abstract type and we will just wrap it // up inside its own Closure to give us more convenience when extending. if (! $concrete instanceof Closure) { $concrete = $this->getClosure($abstract, $concrete); } $this->bindings[$abstract] = compact('concrete', 'shared'); // If the abstract type was already resolved in this container we'll fire the // rebound listener so that any objects which have already gotten resolved // can have their copy of the object updated via the listener callbacks. if ($this->resolved($abstract)) { $this->rebound($abstract); } }
[ "public", "function", "bind", "(", "$", "abstract", ",", "$", "concrete", "=", "null", ",", "$", "shared", "=", "false", ")", "{", "$", "this", "->", "dropStaleInstances", "(", "$", "abstract", ")", ";", "// If no concrete type was given, we will simply set the ...
Register a binding with the container. @param string $abstract @param \Closure|string|null $concrete @param bool $shared @return void
[ "Register", "a", "binding", "with", "the", "container", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L222-L248
train
Binds an abstract type to the container
[ 30522, 2270, 3853, 14187, 1006, 1002, 10061, 1010, 1002, 5509, 1027, 19701, 1010, 1002, 4207, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 9010, 22059, 7076, 26897, 2015, 1006, 1002, 10061, 1007, 1025, 1013, 1013, 2065, 2053, 5509, 2828,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Db.php
Db.factory
public static function factory($configDb) { /** * Triggered before a connection to the database is established by the Tracker. * * This event can be used to change the database connection settings used by the Tracker. * * @param array $dbInfos Reference to an array containing database connection info, * including: * * - **host**: The host name or IP address to the MySQL database. * - **username**: The username to use when connecting to the * database. * - **password**: The password to use when connecting to the * database. * - **dbname**: The name of the Piwik MySQL database. * - **port**: The MySQL database port to use. * - **adapter**: either `'PDO\MYSQL'` or `'MYSQLI'` * - **type**: The MySQL engine to use, for instance 'InnoDB' */ Piwik::postEvent('Tracker.getDatabaseConfig', array(&$configDb)); switch ($configDb['adapter']) { case 'PDO\MYSQL': case 'PDO_MYSQL': // old format pre Piwik 2 require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Pdo/Mysql.php'; return new Mysql($configDb); case 'MYSQLI': require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Mysqli.php'; return new Mysqli($configDb); } throw new Exception('Unsupported database adapter ' . $configDb['adapter']); }
php
public static function factory($configDb) { /** * Triggered before a connection to the database is established by the Tracker. * * This event can be used to change the database connection settings used by the Tracker. * * @param array $dbInfos Reference to an array containing database connection info, * including: * * - **host**: The host name or IP address to the MySQL database. * - **username**: The username to use when connecting to the * database. * - **password**: The password to use when connecting to the * database. * - **dbname**: The name of the Piwik MySQL database. * - **port**: The MySQL database port to use. * - **adapter**: either `'PDO\MYSQL'` or `'MYSQLI'` * - **type**: The MySQL engine to use, for instance 'InnoDB' */ Piwik::postEvent('Tracker.getDatabaseConfig', array(&$configDb)); switch ($configDb['adapter']) { case 'PDO\MYSQL': case 'PDO_MYSQL': // old format pre Piwik 2 require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Pdo/Mysql.php'; return new Mysql($configDb); case 'MYSQLI': require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Mysqli.php'; return new Mysqli($configDb); } throw new Exception('Unsupported database adapter ' . $configDb['adapter']); }
[ "public", "static", "function", "factory", "(", "$", "configDb", ")", "{", "/**\n * Triggered before a connection to the database is established by the Tracker.\n *\n * This event can be used to change the database connection settings used by the Tracker.\n *\n ...
Factory to create database objects @param array $configDb Database configuration @throws Exception @return \Piwik\Tracker\Db\Mysqli|\Piwik\Tracker\Db\Pdo\Mysql
[ "Factory", "to", "create", "database", "objects" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db.php#L242-L276
train
Factory method to create a new database connection
[ 30522, 2270, 10763, 3853, 4713, 1006, 1002, 9530, 8873, 2290, 18939, 1007, 1063, 1013, 1008, 1008, 1008, 13330, 2077, 1037, 4434, 2000, 1996, 7809, 2003, 2511, 2011, 1996, 27080, 1012, 1008, 1008, 2023, 2724, 2064, 2022, 2109, 2000, 2689, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HttpCache.php
HttpCache.store
protected function store(Request $request, Response $response) { try { $this->store->write($request, $response); $this->record($request, 'store'); $response->headers->set('Age', $response->getAge()); } catch (\Exception $e) { $this->record($request, 'store-failed'); if ($this->options['debug']) { throw $e; } } // now that the response is cached, release the lock $this->store->unlock($request); }
php
protected function store(Request $request, Response $response) { try { $this->store->write($request, $response); $this->record($request, 'store'); $response->headers->set('Age', $response->getAge()); } catch (\Exception $e) { $this->record($request, 'store-failed'); if ($this->options['debug']) { throw $e; } } // now that the response is cached, release the lock $this->store->unlock($request); }
[ "protected", "function", "store", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "try", "{", "$", "this", "->", "store", "->", "write", "(", "$", "request", ",", "$", "response", ")", ";", "$", "this", "->", "record", "("...
Writes the Response to the cache. @throws \Exception
[ "Writes", "the", "Response", "to", "the", "cache", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L583-L601
train
Store the response in the cache
[ 30522, 5123, 3853, 3573, 1006, 5227, 1002, 5227, 1010, 3433, 1002, 3433, 1007, 1063, 3046, 1063, 1002, 2023, 1011, 1028, 3573, 1011, 1028, 4339, 1006, 1002, 5227, 1010, 1002, 3433, 1007, 1025, 1002, 2023, 1011, 1028, 2501, 1006, 1002, 522...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...