repo
stringclasses
21 values
path
stringlengths
10
105
func_name
stringlengths
6
64
original_string
stringlengths
105
15.6k
language
stringclasses
1 value
code
stringlengths
105
15.6k
code_tokens
listlengths
29
2.15k
docstring
stringlengths
11
2.85k
docstring_tokens
listlengths
1
290
sha
stringclasses
21 values
url
stringlengths
100
194
partition
stringclasses
1 value
summary
stringlengths
8
319
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
laravel/framework
src/Illuminate/Support/Collection.php
Collection.pluck
public function pluck($value, $key = null) { return new static(Arr::pluck($this->items, $value, $key)); }
php
public function pluck($value, $key = null) { return new static(Arr::pluck($this->items, $value, $key)); }
[ "public", "function", "pluck", "(", "$", "value", ",", "$", "key", "=", "null", ")", "{", "return", "new", "static", "(", "Arr", "::", "pluck", "(", "$", "this", "->", "items", ",", "$", "value", ",", "$", "key", ")", ")", ";", "}" ]
Get the values of a given key. @param string|array $value @param string|null $key @return static
[ "Get", "the", "values", "of", "a", "given", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1105-L1108
train
Pluck value from the items
[ 30522, 2270, 3853, 20228, 12722, 1006, 1002, 3643, 1010, 1002, 3145, 1027, 19701, 1007, 1063, 2709, 2047, 10763, 1006, 12098, 2099, 1024, 1024, 20228, 12722, 1006, 1002, 2023, 1011, 1028, 5167, 1010, 1002, 3643, 1010, 1002, 3145, 1007, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
SqlServerGrammar.parseUpdateTable
protected function parseUpdateTable($table) { $table = $alias = $this->wrapTable($table); if (stripos($table, '] as [') !== false) { $alias = '['.explode('] as [', $table)[1]; } return [$table, $alias]; }
php
protected function parseUpdateTable($table) { $table = $alias = $this->wrapTable($table); if (stripos($table, '] as [') !== false) { $alias = '['.explode('] as [', $table)[1]; } return [$table, $alias]; }
[ "protected", "function", "parseUpdateTable", "(", "$", "table", ")", "{", "$", "table", "=", "$", "alias", "=", "$", "this", "->", "wrapTable", "(", "$", "table", ")", ";", "if", "(", "stripos", "(", "$", "table", ",", "'] as ['", ")", "!==", "false"...
Get the table and alias for the given table. @param string $table @return array
[ "Get", "the", "table", "and", "alias", "for", "the", "given", "table", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php#L388-L397
train
Parse the update table into an array
[ 30522, 5123, 3853, 11968, 3366, 6279, 13701, 10880, 1006, 1002, 2795, 1007, 1063, 1002, 2795, 1027, 1002, 14593, 1027, 1002, 2023, 1011, 1028, 10236, 10880, 1006, 1002, 2795, 1007, 1025, 2065, 1006, 6167, 2891, 1006, 1002, 2795, 1010, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Common.php
Common.isPhpCliMode
public static function isPhpCliMode() { if (is_bool(self::$isCliMode)) { return self::$isCliMode; } if(PHP_SAPI == 'cli'){ return true; } if(self::isPhpCgiType() && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))){ return true; } return false; }
php
public static function isPhpCliMode() { if (is_bool(self::$isCliMode)) { return self::$isCliMode; } if(PHP_SAPI == 'cli'){ return true; } if(self::isPhpCgiType() && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))){ return true; } return false; }
[ "public", "static", "function", "isPhpCliMode", "(", ")", "{", "if", "(", "is_bool", "(", "self", "::", "$", "isCliMode", ")", ")", "{", "return", "self", "::", "$", "isCliMode", ";", "}", "if", "(", "PHP_SAPI", "==", "'cli'", ")", "{", "return", "tr...
Returns true if PHP was invoked from command-line interface (shell) @since added in 0.4.4 @return bool true if PHP invoked as a CGI or from CLI
[ "Returns", "true", "if", "PHP", "was", "invoked", "from", "command", "-", "line", "interface", "(", "shell", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L128-L143
train
Return true if PHP is in CLI mode
[ 30522, 2270, 10763, 3853, 2003, 8458, 15042, 17960, 10244, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 22017, 2140, 1006, 2969, 1024, 1024, 1002, 2003, 20464, 16339, 3207, 1007, 1007, 1063, 2709, 2969, 1024, 1024, 1002, 2003, 20464, 16339, 32...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Validator.php
Validator.attributesThatHaveMessages
protected function attributesThatHaveMessages() { return collect($this->messages()->toArray())->map(function ($message, $key) { return explode('.', $key)[0]; })->unique()->flip()->all(); }
php
protected function attributesThatHaveMessages() { return collect($this->messages()->toArray())->map(function ($message, $key) { return explode('.', $key)[0]; })->unique()->flip()->all(); }
[ "protected", "function", "attributesThatHaveMessages", "(", ")", "{", "return", "collect", "(", "$", "this", "->", "messages", "(", ")", "->", "toArray", "(", ")", ")", "->", "map", "(", "function", "(", "$", "message", ",", "$", "key", ")", "{", "retu...
Generate an array of all attributes that have messages. @return array
[ "Generate", "an", "array", "of", "all", "attributes", "that", "have", "messages", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L668-L673
train
Returns all attributes that have messages
[ 30522, 5123, 3853, 12332, 8322, 8322, 3726, 7834, 3736, 8449, 1006, 1007, 1063, 2709, 8145, 1006, 1002, 2023, 1011, 1028, 7696, 1006, 1007, 1011, 1028, 2000, 2906, 9447, 1006, 1007, 1007, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 4471, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.date2timestamp
public static function date2timestamp($date, $format = null) { $config = Grav::instance()['config']; $dateformat = $format ?: $config->get('system.pages.dateformat.default'); // try to use DateTime and default format if ($dateformat) { $datetime = \DateTime::createFromFormat($dateformat, $date); } else { $datetime = new \DateTime($date); } // fallback to strtotime() if DateTime approach failed if ($datetime !== false) { return $datetime->getTimestamp(); } return strtotime($date); }
php
public static function date2timestamp($date, $format = null) { $config = Grav::instance()['config']; $dateformat = $format ?: $config->get('system.pages.dateformat.default'); // try to use DateTime and default format if ($dateformat) { $datetime = \DateTime::createFromFormat($dateformat, $date); } else { $datetime = new \DateTime($date); } // fallback to strtotime() if DateTime approach failed if ($datetime !== false) { return $datetime->getTimestamp(); } return strtotime($date); }
[ "public", "static", "function", "date2timestamp", "(", "$", "date", ",", "$", "format", "=", "null", ")", "{", "$", "config", "=", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", ";", "$", "dateformat", "=", "$", "format", "?", ":", "$", ...
Get the timestamp of a date @param string $date a String expressed in the system.pages.dateformat.default format, with fallback to a strtotime argument @param string $format a date format to use if possible @return int the timestamp
[ "Get", "the", "timestamp", "of", "a", "date" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1004-L1022
train
Convert a date to timestamp
[ 30522, 2270, 10763, 3853, 3058, 2475, 7292, 9153, 8737, 1006, 1002, 3058, 1010, 1002, 4289, 1027, 19701, 1007, 1063, 1002, 9530, 8873, 2290, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 9530, 8873, 2290, 1005, 1033, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Mime/Header/DateHeader.php
DateHeader.setDateTime
public function setDateTime(\DateTimeInterface $dateTime) { if ($dateTime instanceof \DateTime) { $immutable = new \DateTimeImmutable('@'.$dateTime->getTimestamp()); $dateTime = $immutable->setTimezone($dateTime->getTimezone()); } $this->dateTime = $dateTime; }
php
public function setDateTime(\DateTimeInterface $dateTime) { if ($dateTime instanceof \DateTime) { $immutable = new \DateTimeImmutable('@'.$dateTime->getTimestamp()); $dateTime = $immutable->setTimezone($dateTime->getTimezone()); } $this->dateTime = $dateTime; }
[ "public", "function", "setDateTime", "(", "\\", "DateTimeInterface", "$", "dateTime", ")", "{", "if", "(", "$", "dateTime", "instanceof", "\\", "DateTime", ")", "{", "$", "immutable", "=", "new", "\\", "DateTimeImmutable", "(", "'@'", ".", "$", "dateTime", ...
Set the date-time of the Date in this Header. If a DateTime instance is provided, it is converted to DateTimeImmutable.
[ "Set", "the", "date", "-", "time", "of", "the", "Date", "in", "this", "Header", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Header/DateHeader.php#L58-L65
train
Set \ DateTime \ DateTimeImmutable instance
[ 30522, 2270, 3853, 2275, 13701, 7292, 1006, 1032, 3058, 7292, 18447, 2121, 12172, 1002, 3058, 7292, 1007, 1063, 2065, 1006, 1002, 3058, 7292, 6013, 11253, 1032, 3058, 7292, 1007, 1063, 1002, 10047, 28120, 3085, 1027, 2047, 1032, 3058, 7292,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Transport/Abstract.php
Zend_Mail_Transport_Abstract.send
public function send(Zend_Mail $mail) { $this->_isMultipart = false; $this->_mail = $mail; $this->_parts = $mail->getParts(); $mime = $mail->getMime(); // Build body content $this->_buildBody(); // Determine number of parts and boundary $count = count($this->_parts); $boundary = null; if ($count < 1) { /** * @see Zend_Mail_Transport_Exception */ // require_once 'Zend/Mail/Transport/Exception.php'; throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent'); } if ($count > 1) { // Multipart message; create new MIME object and boundary $mime = new Zend_Mime($this->_mail->getMimeBoundary()); $boundary = $mime->boundary(); } elseif ($this->_isMultipart) { // multipart/alternative -- grab boundary $boundary = $this->_parts[0]->boundary; } // Determine recipients, and prepare headers $this->recipients = implode(',', $mail->getRecipients()); $this->_prepareHeaders($this->_getHeaders($boundary)); // Create message body // This is done so that the same Zend_Mail object can be used in // multiple transports $message = new Zend_Mime_Message(); $message->setParts($this->_parts); $message->setMime($mime); $this->body = $message->generateMessage($this->EOL); // Send to transport! $this->_sendMail(); }
php
public function send(Zend_Mail $mail) { $this->_isMultipart = false; $this->_mail = $mail; $this->_parts = $mail->getParts(); $mime = $mail->getMime(); // Build body content $this->_buildBody(); // Determine number of parts and boundary $count = count($this->_parts); $boundary = null; if ($count < 1) { /** * @see Zend_Mail_Transport_Exception */ // require_once 'Zend/Mail/Transport/Exception.php'; throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent'); } if ($count > 1) { // Multipart message; create new MIME object and boundary $mime = new Zend_Mime($this->_mail->getMimeBoundary()); $boundary = $mime->boundary(); } elseif ($this->_isMultipart) { // multipart/alternative -- grab boundary $boundary = $this->_parts[0]->boundary; } // Determine recipients, and prepare headers $this->recipients = implode(',', $mail->getRecipients()); $this->_prepareHeaders($this->_getHeaders($boundary)); // Create message body // This is done so that the same Zend_Mail object can be used in // multiple transports $message = new Zend_Mime_Message(); $message->setParts($this->_parts); $message->setMime($mime); $this->body = $message->generateMessage($this->EOL); // Send to transport! $this->_sendMail(); }
[ "public", "function", "send", "(", "Zend_Mail", "$", "mail", ")", "{", "$", "this", "->", "_isMultipart", "=", "false", ";", "$", "this", "->", "_mail", "=", "$", "mail", ";", "$", "this", "->", "_parts", "=", "$", "mail", "->", "getParts", "(", ")...
Send a mail using this transport @param Zend_Mail $mail @access public @return void @throws Zend_Mail_Transport_Exception if mail is empty
[ "Send", "a", "mail", "using", "this", "transport" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Transport/Abstract.php#L305-L349
train
Send a Zend_Mail object to the transport
[ 30522, 2270, 3853, 4604, 1006, 16729, 2094, 1035, 5653, 1002, 5653, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 2003, 12274, 7096, 11514, 8445, 1027, 6270, 1025, 1002, 2023, 1011, 1028, 1035, 5653, 1027, 1002, 5653, 1025, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
NumberToLocalizedStringTransformer.round
private function round($number) { if (null !== $this->scale && null !== $this->roundingMode) { // shift number to maintain the correct scale during rounding $roundingCoef = pow(10, $this->scale); // string representation to avoid rounding errors, similar to bcmul() $number = (string) ($number * $roundingCoef); switch ($this->roundingMode) { case self::ROUND_CEILING: $number = ceil($number); break; case self::ROUND_FLOOR: $number = floor($number); break; case self::ROUND_UP: $number = $number > 0 ? ceil($number) : floor($number); break; case self::ROUND_DOWN: $number = $number > 0 ? floor($number) : ceil($number); break; case self::ROUND_HALF_EVEN: $number = round($number, 0, PHP_ROUND_HALF_EVEN); break; case self::ROUND_HALF_UP: $number = round($number, 0, PHP_ROUND_HALF_UP); break; case self::ROUND_HALF_DOWN: $number = round($number, 0, PHP_ROUND_HALF_DOWN); break; } $number /= $roundingCoef; } return $number; }
php
private function round($number) { if (null !== $this->scale && null !== $this->roundingMode) { // shift number to maintain the correct scale during rounding $roundingCoef = pow(10, $this->scale); // string representation to avoid rounding errors, similar to bcmul() $number = (string) ($number * $roundingCoef); switch ($this->roundingMode) { case self::ROUND_CEILING: $number = ceil($number); break; case self::ROUND_FLOOR: $number = floor($number); break; case self::ROUND_UP: $number = $number > 0 ? ceil($number) : floor($number); break; case self::ROUND_DOWN: $number = $number > 0 ? floor($number) : ceil($number); break; case self::ROUND_HALF_EVEN: $number = round($number, 0, PHP_ROUND_HALF_EVEN); break; case self::ROUND_HALF_UP: $number = round($number, 0, PHP_ROUND_HALF_UP); break; case self::ROUND_HALF_DOWN: $number = round($number, 0, PHP_ROUND_HALF_DOWN); break; } $number /= $roundingCoef; } return $number; }
[ "private", "function", "round", "(", "$", "number", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "scale", "&&", "null", "!==", "$", "this", "->", "roundingMode", ")", "{", "// shift number to maintain the correct scale during rounding", "$", "roundingC...
Rounds a number according to the configured scale and rounding mode. @param int|float $number A number @return int|float The rounded number
[ "Rounds", "a", "number", "according", "to", "the", "configured", "scale", "and", "rounding", "mode", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php#L250-L286
train
Rounds the number according to the scale and rounding mode
[ 30522, 2797, 3853, 2461, 1006, 1002, 2193, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 4094, 1004, 1004, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 26939, 5302, 3207, 1007, 1063, 1013, 1013, 5670, 2193, 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...
octobercms/october
modules/backend/classes/Controller.php
Controller.execPageAction
protected function execPageAction($actionName, $parameters) { $result = null; if (!$this->actionExists($actionName)) { if (Config::get('app.debug', false)) { throw new SystemException(sprintf( "Action %s is not found in the controller %s", $actionName, get_class($this) )); } else { Response::make(View::make('backend::404'), 404); } } // Execute the action $result = call_user_func_array([$this, $actionName], $parameters); // Expecting \Response and \RedirectResponse if ($result instanceof \Symfony\Component\HttpFoundation\Response) { return $result; } // No page title if (!$this->pageTitle) { $this->pageTitle = 'backend::lang.page.untitled'; } // Load the view if (!$this->suppressView && $result === null) { return $this->makeView($actionName); } return $this->makeViewContent($result); }
php
protected function execPageAction($actionName, $parameters) { $result = null; if (!$this->actionExists($actionName)) { if (Config::get('app.debug', false)) { throw new SystemException(sprintf( "Action %s is not found in the controller %s", $actionName, get_class($this) )); } else { Response::make(View::make('backend::404'), 404); } } // Execute the action $result = call_user_func_array([$this, $actionName], $parameters); // Expecting \Response and \RedirectResponse if ($result instanceof \Symfony\Component\HttpFoundation\Response) { return $result; } // No page title if (!$this->pageTitle) { $this->pageTitle = 'backend::lang.page.untitled'; } // Load the view if (!$this->suppressView && $result === null) { return $this->makeView($actionName); } return $this->makeViewContent($result); }
[ "protected", "function", "execPageAction", "(", "$", "actionName", ",", "$", "parameters", ")", "{", "$", "result", "=", "null", ";", "if", "(", "!", "$", "this", "->", "actionExists", "(", "$", "actionName", ")", ")", "{", "if", "(", "Config", "::", ...
This method is used internally. Invokes the controller action and loads the corresponding view. @param string $actionName Specifies a action name to execute. @param array $parameters A list of the action parameters.
[ "This", "method", "is", "used", "internally", ".", "Invokes", "the", "controller", "action", "and", "loads", "the", "corresponding", "view", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/Controller.php#L337-L372
train
Execute the action
[ 30522, 5123, 3853, 4654, 8586, 13704, 18908, 3258, 1006, 1002, 2895, 18442, 1010, 1002, 11709, 1007, 1063, 1002, 2765, 1027, 19701, 1025, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2895, 10288, 5130, 1006, 1002, 2895, 18442, 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/ArchiveProcessor/PluginsArchiver.php
PluginsArchiver.callAggregateAllPlugins
public function callAggregateAllPlugins($visits, $visitsConverted, $forceArchivingWithoutVisits = false) { Log::debug("PluginsArchiver::%s: Initializing archiving process for all plugins [visits = %s, visits converted = %s]", __FUNCTION__, $visits, $visitsConverted); /** @var Logger $performanceLogger */ $performanceLogger = StaticContainer::get(Logger::class); $this->archiveProcessor->setNumberOfVisits($visits, $visitsConverted); $archivers = static::getPluginArchivers(); foreach ($archivers as $pluginName => $archiverClass) { // We clean up below all tables created during this function call (and recursive calls) $latestUsedTableId = Manager::getInstance()->getMostRecentTableId(); /** @var Archiver $archiver */ $archiver = $this->makeNewArchiverObject($archiverClass, $pluginName); if (!$archiver->isEnabled()) { Log::debug("PluginsArchiver::%s: Skipping archiving for plugin '%s' (disabled).", __FUNCTION__, $pluginName); continue; } if (!$forceArchivingWithoutVisits && !$visits && !$archiver->shouldRunEvenWhenNoVisits()) { Log::debug("PluginsArchiver::%s: Skipping archiving for plugin '%s' (no visits).", __FUNCTION__, $pluginName); continue; } if ($this->shouldProcessReportsForPlugin($pluginName)) { $this->logAggregator->setQueryOriginHint($pluginName); try { $timer = new Timer(); if ($this->shouldAggregateFromRawData) { Log::debug("PluginsArchiver::%s: Archiving day reports for plugin '%s'.", __FUNCTION__, $pluginName); $archiver->callAggregateDayReport(); } else { Log::debug("PluginsArchiver::%s: Archiving period reports for plugin '%s'.", __FUNCTION__, $pluginName); $archiver->callAggregateMultipleReports(); } $this->logAggregator->setQueryOriginHint(''); $performanceLogger->logMeasurement('plugin', $pluginName, $this->params, $timer); Log::debug("PluginsArchiver::%s: %s while archiving %s reports for plugin '%s' %s.", __FUNCTION__, $timer->getMemoryLeak(), $this->params->getPeriod()->getLabel(), $pluginName, $this->params->getSegment() ? sprintf("(for segment = '%s')", $this->params->getSegment()->getString()) : '' ); } catch (Exception $e) { throw new PluginsArchiverException($e->getMessage() . " - in plugin $pluginName", $e->getCode(), $e); } } else { Log::debug("PluginsArchiver::%s: Not archiving reports for plugin '%s'.", __FUNCTION__, $pluginName); } Manager::getInstance()->deleteAll($latestUsedTableId); unset($archiver); } }
php
public function callAggregateAllPlugins($visits, $visitsConverted, $forceArchivingWithoutVisits = false) { Log::debug("PluginsArchiver::%s: Initializing archiving process for all plugins [visits = %s, visits converted = %s]", __FUNCTION__, $visits, $visitsConverted); /** @var Logger $performanceLogger */ $performanceLogger = StaticContainer::get(Logger::class); $this->archiveProcessor->setNumberOfVisits($visits, $visitsConverted); $archivers = static::getPluginArchivers(); foreach ($archivers as $pluginName => $archiverClass) { // We clean up below all tables created during this function call (and recursive calls) $latestUsedTableId = Manager::getInstance()->getMostRecentTableId(); /** @var Archiver $archiver */ $archiver = $this->makeNewArchiverObject($archiverClass, $pluginName); if (!$archiver->isEnabled()) { Log::debug("PluginsArchiver::%s: Skipping archiving for plugin '%s' (disabled).", __FUNCTION__, $pluginName); continue; } if (!$forceArchivingWithoutVisits && !$visits && !$archiver->shouldRunEvenWhenNoVisits()) { Log::debug("PluginsArchiver::%s: Skipping archiving for plugin '%s' (no visits).", __FUNCTION__, $pluginName); continue; } if ($this->shouldProcessReportsForPlugin($pluginName)) { $this->logAggregator->setQueryOriginHint($pluginName); try { $timer = new Timer(); if ($this->shouldAggregateFromRawData) { Log::debug("PluginsArchiver::%s: Archiving day reports for plugin '%s'.", __FUNCTION__, $pluginName); $archiver->callAggregateDayReport(); } else { Log::debug("PluginsArchiver::%s: Archiving period reports for plugin '%s'.", __FUNCTION__, $pluginName); $archiver->callAggregateMultipleReports(); } $this->logAggregator->setQueryOriginHint(''); $performanceLogger->logMeasurement('plugin', $pluginName, $this->params, $timer); Log::debug("PluginsArchiver::%s: %s while archiving %s reports for plugin '%s' %s.", __FUNCTION__, $timer->getMemoryLeak(), $this->params->getPeriod()->getLabel(), $pluginName, $this->params->getSegment() ? sprintf("(for segment = '%s')", $this->params->getSegment()->getString()) : '' ); } catch (Exception $e) { throw new PluginsArchiverException($e->getMessage() . " - in plugin $pluginName", $e->getCode(), $e); } } else { Log::debug("PluginsArchiver::%s: Not archiving reports for plugin '%s'.", __FUNCTION__, $pluginName); } Manager::getInstance()->deleteAll($latestUsedTableId); unset($archiver); } }
[ "public", "function", "callAggregateAllPlugins", "(", "$", "visits", ",", "$", "visitsConverted", ",", "$", "forceArchivingWithoutVisits", "=", "false", ")", "{", "Log", "::", "debug", "(", "\"PluginsArchiver::%s: Initializing archiving process for all plugins [visits = %s, v...
Instantiates the Archiver class in each plugin that defines it, and triggers Aggregation processing on these plugins.
[ "Instantiates", "the", "Archiver", "class", "in", "each", "plugin", "that", "defines", "it", "and", "triggers", "Aggregation", "processing", "on", "these", "plugins", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor/PluginsArchiver.php#L121-L187
train
Calls all plugins and aggregate all reports
[ 30522, 2270, 3853, 2655, 8490, 17603, 5867, 8095, 24759, 15916, 7076, 1006, 1002, 7879, 1010, 1002, 7879, 8663, 26686, 1010, 1002, 2486, 2906, 5428, 6455, 24415, 5833, 11365, 12762, 1027, 6270, 1007, 1063, 8833, 1024, 1024, 2139, 8569, 2290...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/BrowserKit/CookieJar.php
CookieJar.updateFromSetCookie
public function updateFromSetCookie(array $setCookies, $uri = null) { $cookies = []; foreach ($setCookies as $cookie) { foreach (explode(',', $cookie) as $i => $part) { if (0 === $i || preg_match('/^(?P<token>\s*[0-9A-Za-z!#\$%\&\'\*\+\-\.^_`\|~]+)=/', $part)) { $cookies[] = ltrim($part); } else { $cookies[\count($cookies) - 1] .= ','.$part; } } } foreach ($cookies as $cookie) { try { $this->set(Cookie::fromString($cookie, $uri)); } catch (\InvalidArgumentException $e) { // invalid cookies are just ignored } } }
php
public function updateFromSetCookie(array $setCookies, $uri = null) { $cookies = []; foreach ($setCookies as $cookie) { foreach (explode(',', $cookie) as $i => $part) { if (0 === $i || preg_match('/^(?P<token>\s*[0-9A-Za-z!#\$%\&\'\*\+\-\.^_`\|~]+)=/', $part)) { $cookies[] = ltrim($part); } else { $cookies[\count($cookies) - 1] .= ','.$part; } } } foreach ($cookies as $cookie) { try { $this->set(Cookie::fromString($cookie, $uri)); } catch (\InvalidArgumentException $e) { // invalid cookies are just ignored } } }
[ "public", "function", "updateFromSetCookie", "(", "array", "$", "setCookies", ",", "$", "uri", "=", "null", ")", "{", "$", "cookies", "=", "[", "]", ";", "foreach", "(", "$", "setCookies", "as", "$", "cookie", ")", "{", "foreach", "(", "explode", "(", ...
Updates the cookie jar from a response Set-Cookie headers. @param array $setCookies Set-Cookie headers from an HTTP response @param string $uri The base URL
[ "Updates", "the", "cookie", "jar", "from", "a", "response", "Set", "-", "Cookie", "headers", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/CookieJar.php#L117-L138
train
Update the cookies from the cookies set in the request
[ 30522, 2270, 3853, 10651, 19699, 22225, 3388, 3597, 23212, 2063, 1006, 9140, 1002, 2275, 3597, 23212, 2229, 1010, 1002, 24471, 2072, 1027, 19701, 1007, 1063, 1002, 16324, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2275, 3597, 23212, 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/backend/widgets/Lists.php
Lists.getRecordOnClick
public function getRecordOnClick($record) { if (!isset($this->recordOnClick)) { return null; } $recordOnClick = RouterHelper::replaceParameters($record, $this->recordOnClick); return Html::attributes(['onclick' => $recordOnClick]); }
php
public function getRecordOnClick($record) { if (!isset($this->recordOnClick)) { return null; } $recordOnClick = RouterHelper::replaceParameters($record, $this->recordOnClick); return Html::attributes(['onclick' => $recordOnClick]); }
[ "public", "function", "getRecordOnClick", "(", "$", "record", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "recordOnClick", ")", ")", "{", "return", "null", ";", "}", "$", "recordOnClick", "=", "RouterHelper", "::", "replaceParameters", "(", ...
Returns the onclick event for a list row. @param Model $record @return string
[ "Returns", "the", "onclick", "event", "for", "a", "list", "row", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L676-L684
train
Returns HTML element for record click
[ 30522, 2270, 3853, 2131, 2890, 27108, 5280, 20464, 6799, 1006, 1002, 2501, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2501, 2239, 20464, 6799, 1007, 1007, 1063, 2709, 19701, 1025, 1065, 1002, 2501, 2239, 20464, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Controller.php
Controller.setPeriodVariablesView
public static function setPeriodVariablesView($view) { if (isset($view->period)) { return; } $periodValidator = new PeriodValidator(); $currentPeriod = Common::getRequestVar('period'); $view->displayUniqueVisitors = SettingsPiwik::isUniqueVisitorsEnabled($currentPeriod); $availablePeriods = $periodValidator->getPeriodsAllowedForUI(); if (! $periodValidator->isPeriodAllowedForUI($currentPeriod)) { throw new Exception("Period must be one of: " . implode(", ", $availablePeriods)); } $found = array_search($currentPeriod, $availablePeriods); unset($availablePeriods[$found]); $view->period = $currentPeriod; $view->otherPeriods = $availablePeriods; $view->enabledPeriods = self::getEnabledPeriodsInUI(); $view->periodsNames = self::getEnabledPeriodsNames(); }
php
public static function setPeriodVariablesView($view) { if (isset($view->period)) { return; } $periodValidator = new PeriodValidator(); $currentPeriod = Common::getRequestVar('period'); $view->displayUniqueVisitors = SettingsPiwik::isUniqueVisitorsEnabled($currentPeriod); $availablePeriods = $periodValidator->getPeriodsAllowedForUI(); if (! $periodValidator->isPeriodAllowedForUI($currentPeriod)) { throw new Exception("Period must be one of: " . implode(", ", $availablePeriods)); } $found = array_search($currentPeriod, $availablePeriods); unset($availablePeriods[$found]); $view->period = $currentPeriod; $view->otherPeriods = $availablePeriods; $view->enabledPeriods = self::getEnabledPeriodsInUI(); $view->periodsNames = self::getEnabledPeriodsNames(); }
[ "public", "static", "function", "setPeriodVariablesView", "(", "$", "view", ")", "{", "if", "(", "isset", "(", "$", "view", "->", "period", ")", ")", "{", "return", ";", "}", "$", "periodValidator", "=", "new", "PeriodValidator", "(", ")", ";", "$", "c...
Sets general period variables on a view, including: - **displayUniqueVisitors** - Whether unique visitors should be displayed for the current period. - **period** - The value of the **period** query parameter. - **otherPeriods** - `array('day', 'week', 'month', 'year', 'range')` - **periodsNames** - List of available periods mapped to their singular and plural translations. @param View $view @throws Exception if the current period is invalid. @api
[ "Sets", "general", "period", "variables", "on", "a", "view", "including", ":" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Controller.php#L851-L874
train
This method sets the period variables view.
[ 30522, 2270, 10763, 3853, 2275, 4842, 3695, 2094, 10755, 19210, 2015, 8584, 1006, 1002, 3193, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 3193, 1011, 1028, 2558, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 2558, 10175, 8524, 4263, 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...
php-ai/php-ml
src/DimensionReduction/KernelPCA.php
KernelPCA.fit
public function fit(array $data): array { $numRows = count($data); $this->data = $data; if ($this->gamma === null) { $this->gamma = 1.0 / $numRows; } $matrix = $this->calculateKernelMatrix($this->data, $numRows); $matrix = $this->centerMatrix($matrix, $numRows); $this->eigenDecomposition($matrix); $this->fit = true; return Matrix::transposeArray($this->eigVectors); }
php
public function fit(array $data): array { $numRows = count($data); $this->data = $data; if ($this->gamma === null) { $this->gamma = 1.0 / $numRows; } $matrix = $this->calculateKernelMatrix($this->data, $numRows); $matrix = $this->centerMatrix($matrix, $numRows); $this->eigenDecomposition($matrix); $this->fit = true; return Matrix::transposeArray($this->eigVectors); }
[ "public", "function", "fit", "(", "array", "$", "data", ")", ":", "array", "{", "$", "numRows", "=", "count", "(", "$", "data", ")", ";", "$", "this", "->", "data", "=", "$", "data", ";", "if", "(", "$", "this", "->", "gamma", "===", "null", ")...
Takes a data and returns a lower dimensional version of this data while preserving $totalVariance or $numFeatures. <br> $data is an n-by-m matrix and returned array is n-by-k matrix where k <= m
[ "Takes", "a", "data", "and", "returns", "a", "lower", "dimensional", "version", "of", "this", "data", "while", "preserving", "$totalVariance", "or", "$numFeatures", ".", "<br", ">", "$data", "is", "an", "n", "-", "by", "-", "m", "matrix", "and", "returned"...
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/DimensionReduction/KernelPCA.php#L77-L94
train
Fits the algorithm to the given array
[ 30522, 2270, 3853, 4906, 1006, 9140, 1002, 2951, 1007, 1024, 9140, 1063, 1002, 16371, 2213, 10524, 2015, 1027, 4175, 1006, 1002, 2951, 1007, 1025, 1002, 2023, 1011, 1028, 2951, 1027, 1002, 2951, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 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/Intl/Data/Generator/ScriptDataGenerator.php
ScriptDataGenerator.generateDataForMeta
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir) { $rootBundle = $reader->read($tempDir, 'root'); $this->scriptCodes = array_unique($this->scriptCodes); sort($this->scriptCodes); return [ 'Version' => $rootBundle['Version'], 'Scripts' => $this->scriptCodes, ]; }
php
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir) { $rootBundle = $reader->read($tempDir, 'root'); $this->scriptCodes = array_unique($this->scriptCodes); sort($this->scriptCodes); return [ 'Version' => $rootBundle['Version'], 'Scripts' => $this->scriptCodes, ]; }
[ "protected", "function", "generateDataForMeta", "(", "BundleReaderInterface", "$", "reader", ",", "$", "tempDir", ")", "{", "$", "rootBundle", "=", "$", "reader", "->", "read", "(", "$", "tempDir", ",", "'root'", ")", ";", "$", "this", "->", "scriptCodes", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php#L88-L100
train
Generate data for Meta
[ 30522, 5123, 3853, 7013, 6790, 14192, 12928, 1006, 14012, 16416, 4063, 18447, 2121, 12172, 1002, 8068, 1010, 1002, 8915, 8737, 4305, 2099, 1007, 1063, 1002, 7117, 27265, 2571, 1027, 1002, 8068, 1011, 1028, 3191, 1006, 1002, 8915, 8737, 4305...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FileUpload.php
FileUpload.getAcceptedFileTypes
public function getAcceptedFileTypes($includeDot = false) { $types = $this->fileTypes; if ($types === false) { $isImage = starts_with($this->getDisplayMode(), 'image'); $types = implode(',', FileDefinitions::get($isImage ? 'imageExtensions' : 'defaultExtensions')); } if (!$types || $types == '*') { return null; } if (!is_array($types)) { $types = explode(',', $types); } $types = array_map(function ($value) use ($includeDot) { $value = trim($value); if (substr($value, 0, 1) == '.') { $value = substr($value, 1); } if ($includeDot) { $value = '.'.$value; } return $value; }, $types); return implode(',', $types); }
php
public function getAcceptedFileTypes($includeDot = false) { $types = $this->fileTypes; if ($types === false) { $isImage = starts_with($this->getDisplayMode(), 'image'); $types = implode(',', FileDefinitions::get($isImage ? 'imageExtensions' : 'defaultExtensions')); } if (!$types || $types == '*') { return null; } if (!is_array($types)) { $types = explode(',', $types); } $types = array_map(function ($value) use ($includeDot) { $value = trim($value); if (substr($value, 0, 1) == '.') { $value = substr($value, 1); } if ($includeDot) { $value = '.'.$value; } return $value; }, $types); return implode(',', $types); }
[ "public", "function", "getAcceptedFileTypes", "(", "$", "includeDot", "=", "false", ")", "{", "$", "types", "=", "$", "this", "->", "fileTypes", ";", "if", "(", "$", "types", "===", "false", ")", "{", "$", "isImage", "=", "starts_with", "(", "$", "this...
Returns the specified accepted file types, or the default based on the mode. Image mode will return: - jpg,jpeg,bmp,png,gif,svg @return string
[ "Returns", "the", "specified", "accepted", "file", "types", "or", "the", "default", "based", "on", "the", "mode", ".", "Image", "mode", "will", "return", ":", "-", "jpg", "jpeg", "bmp", "png", "gif", "svg" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L240-L272
train
Returns the list of file types accepted by the user.
[ 30522, 2270, 3853, 2131, 6305, 3401, 13876, 2098, 8873, 7485, 18863, 2015, 1006, 1002, 2443, 4140, 1027, 6270, 1007, 1063, 1002, 4127, 1027, 1002, 2023, 1011, 1028, 5371, 13874, 2015, 1025, 2065, 1006, 1002, 4127, 1027, 1027, 1027, 6270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Application.php
Application.bindPathsInContainer
protected function bindPathsInContainer() { $this->instance('path', $this->path()); $this->instance('path.base', $this->basePath()); $this->instance('path.lang', $this->langPath()); $this->instance('path.config', $this->configPath()); $this->instance('path.public', $this->publicPath()); $this->instance('path.storage', $this->storagePath()); $this->instance('path.database', $this->databasePath()); $this->instance('path.resources', $this->resourcePath()); $this->instance('path.bootstrap', $this->bootstrapPath()); }
php
protected function bindPathsInContainer() { $this->instance('path', $this->path()); $this->instance('path.base', $this->basePath()); $this->instance('path.lang', $this->langPath()); $this->instance('path.config', $this->configPath()); $this->instance('path.public', $this->publicPath()); $this->instance('path.storage', $this->storagePath()); $this->instance('path.database', $this->databasePath()); $this->instance('path.resources', $this->resourcePath()); $this->instance('path.bootstrap', $this->bootstrapPath()); }
[ "protected", "function", "bindPathsInContainer", "(", ")", "{", "$", "this", "->", "instance", "(", "'path'", ",", "$", "this", "->", "path", "(", ")", ")", ";", "$", "this", "->", "instance", "(", "'path.base'", ",", "$", "this", "->", "basePath", "("...
Bind all of the application paths in the container. @return void
[ "Bind", "all", "of", "the", "application", "paths", "in", "the", "container", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Application.php#L283-L294
train
Binds paths in container
[ 30522, 5123, 3853, 14187, 15069, 11493, 8663, 18249, 2121, 1006, 1007, 30524, 2023, 1011, 1028, 6013, 1006, 1005, 4130, 1012, 11374, 1005, 1010, 1002, 2023, 1011, 1028, 11374, 15069, 1006, 1007, 1007, 1025, 1002, 2023, 1011, 1028, 6013, 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/HTML/Common2.php
HTML_Common2.prepareAttributes
protected static function prepareAttributes($attributes) { $prepared = array(); if (is_string($attributes)) { return self::parseAttributes($attributes); } elseif (is_array($attributes)) { foreach ($attributes as $key => $value) { if (is_int($key)) { $key = strtolower($value); $prepared[$key] = $key; } else { $prepared[strtolower($key)] = (string)$value; } } } return $prepared; }
php
protected static function prepareAttributes($attributes) { $prepared = array(); if (is_string($attributes)) { return self::parseAttributes($attributes); } elseif (is_array($attributes)) { foreach ($attributes as $key => $value) { if (is_int($key)) { $key = strtolower($value); $prepared[$key] = $key; } else { $prepared[strtolower($key)] = (string)$value; } } } return $prepared; }
[ "protected", "static", "function", "prepareAttributes", "(", "$", "attributes", ")", "{", "$", "prepared", "=", "array", "(", ")", ";", "if", "(", "is_string", "(", "$", "attributes", ")", ")", "{", "return", "self", "::", "parseAttributes", "(", "$", "a...
Creates a valid attribute array from either a string or an array @param mixed Array of attributes or HTML attribute string @return array An associative aray of attributes
[ "Creates", "a", "valid", "attribute", "array", "from", "either", "a", "string", "or", "an", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L177-L194
train
Prepares the attributes for the page
[ 30522, 5123, 10763, 3853, 7374, 19321, 3089, 8569, 4570, 1006, 1002, 12332, 1007, 1063, 1002, 4810, 1027, 9140, 1006, 1007, 1025, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 12332, 1007, 1007, 1063, 2709, 2969, 1024, 1024, 11968, 17310, 4779,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Tools/Paginator.php
Paginator.paginationRanger
protected function paginationRanger() { $parameters = [ 'first' => $this->paginator->firstItem(), 'last' => $this->paginator->lastItem(), 'total' => $this->paginator->total(), ]; $parameters = collect($parameters)->flatMap(function ($parameter, $key) { return [$key => "<b>$parameter</b>"]; }); return trans('admin.pagination.range', $parameters->all()); }
php
protected function paginationRanger() { $parameters = [ 'first' => $this->paginator->firstItem(), 'last' => $this->paginator->lastItem(), 'total' => $this->paginator->total(), ]; $parameters = collect($parameters)->flatMap(function ($parameter, $key) { return [$key => "<b>$parameter</b>"]; }); return trans('admin.pagination.range', $parameters->all()); }
[ "protected", "function", "paginationRanger", "(", ")", "{", "$", "parameters", "=", "[", "'first'", "=>", "$", "this", "->", "paginator", "->", "firstItem", "(", ")", ",", "'last'", "=>", "$", "this", "->", "paginator", "->", "lastItem", "(", ")", ",", ...
Get range infomation of paginator. @return string|\Symfony\Component\Translation\TranslatorInterface
[ "Get", "range", "infomation", "of", "paginator", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/Paginator.php#L67-L80
train
Return pagination range
[ 30522, 5123, 3853, 6643, 20876, 3508, 24388, 2121, 1006, 1007, 1063, 1002, 11709, 1027, 1031, 1005, 2034, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 6643, 20876, 4263, 1011, 1028, 2034, 4221, 2213, 1006, 1007, 1010, 1005, 2197, 1005, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Licenses.php
Licenses.validate
public static function validate($license = null) { if (!is_string($license)) { return false; } return preg_match('#' . self::$regex. '#', $license); }
php
public static function validate($license = null) { if (!is_string($license)) { return false; } return preg_match('#' . self::$regex. '#', $license); }
[ "public", "static", "function", "validate", "(", "$", "license", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "license", ")", ")", "{", "return", "false", ";", "}", "return", "preg_match", "(", "'#'", ".", "self", "::", "$", "regex",...
Validates the License format @param string $license @return bool
[ "Validates", "the", "License", "format" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Licenses.php#L96-L103
train
Validate License String
[ 30522, 2270, 10763, 3853, 9398, 3686, 1006, 1002, 6105, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 6105, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 2709, 3653, 2290, 1035, 2674, 1006, 1005, 1001, 1005, 1012, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Router.php
Router.getRouteCollection
public function getRouteCollection() { if (null === $this->collection) { $this->collection = $this->loader->load($this->resource, $this->options['resource_type']); } return $this->collection; }
php
public function getRouteCollection() { if (null === $this->collection) { $this->collection = $this->loader->load($this->resource, $this->options['resource_type']); } return $this->collection; }
[ "public", "function", "getRouteCollection", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "collection", ")", "{", "$", "this", "->", "collection", "=", "$", "this", "->", "loader", "->", "load", "(", "$", "this", "->", "resource", ",", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Router.php#L209-L216
train
Get RouteCollection - Get RouteCollection
[ 30522, 2270, 3853, 2131, 22494, 26557, 14511, 18491, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 3074, 1007, 1063, 1002, 2023, 1011, 1028, 3074, 1027, 1002, 2023, 1011, 1028, 7170, 2121, 1011, 1028, 7170, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Metric.php
Metric.getMetricValues
public static function getMetricValues(DataTable $table, $columnName, $mappingNameToId = null) { if (empty($mappingIdToName)) { $mappingNameToId = Metrics::getMappingFromNameToId(); } $columnName = self::getActualMetricColumn($table, $columnName, $mappingNameToId); return $table->getColumn($columnName); }
php
public static function getMetricValues(DataTable $table, $columnName, $mappingNameToId = null) { if (empty($mappingIdToName)) { $mappingNameToId = Metrics::getMappingFromNameToId(); } $columnName = self::getActualMetricColumn($table, $columnName, $mappingNameToId); return $table->getColumn($columnName); }
[ "public", "static", "function", "getMetricValues", "(", "DataTable", "$", "table", ",", "$", "columnName", ",", "$", "mappingNameToId", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "mappingIdToName", ")", ")", "{", "$", "mappingNameToId", "=", "Met...
Helper method that will determine the actual column name for a metric in a {@link Piwik\DataTable} and return every column value for this name. @param DataTable $table @param string $columnName @param int[]|null $mappingNameToId A custom mapping of metric names to special index values. By default {@link Metrics::getMappingFromNameToId()} is used. @return array
[ "Helper", "method", "that", "will", "determine", "the", "actual", "column", "name", "for", "a", "metric", "in", "a", "{", "@link", "Piwik", "\\", "DataTable", "}", "and", "return", "every", "column", "value", "for", "this", "name", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Metric.php#L166-L174
train
Returns the values of the specified column in the given table.
[ 30522, 2270, 10763, 3853, 2131, 12589, 10175, 15808, 1006, 2951, 10880, 1002, 2795, 1010, 1002, 5930, 18442, 1010, 1002, 12375, 18442, 3406, 3593, 1027, 19701, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 12375, 3593, 2669, 14074, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/Model.php
Model.getAllSites
public function getAllSites() { $db = $this->getDb(); $sites = $db->fetchAll("SELECT * FROM " . $this->table . " ORDER BY idsite ASC"); return $sites; }
php
public function getAllSites() { $db = $this->getDb(); $sites = $db->fetchAll("SELECT * FROM " . $this->table . " ORDER BY idsite ASC"); return $sites; }
[ "public", "function", "getAllSites", "(", ")", "{", "$", "db", "=", "$", "this", "->", "getDb", "(", ")", ";", "$", "sites", "=", "$", "db", "->", "fetchAll", "(", "\"SELECT * FROM \"", ".", "$", "this", "->", "table", ".", "\" ORDER BY idsite ASC\"", ...
Returns all websites @return array The list of websites, indexed by idsite
[ "Returns", "all", "websites" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L75-L81
train
Get all the sites
[ 30522, 2270, 3853, 2131, 8095, 28032, 2229, 1006, 1007, 1063, 1002, 16962, 1027, 1002, 2023, 1011, 1028, 2131, 18939, 1006, 1007, 1025, 1002, 4573, 1027, 1002, 16962, 1011, 1028, 18584, 8095, 1006, 1000, 7276, 1008, 2013, 1000, 1012, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/ServiceProvider.php
ServiceProvider.register
public function register() { $configPath = __DIR__ . '/../config/debugbar.php'; $this->mergeConfigFrom($configPath, 'debugbar'); $this->app->alias( DataFormatter::class, DataFormatterInterface::class ); $this->app->singleton(LaravelDebugbar::class, function () { $debugbar = new LaravelDebugbar($this->app); if ($this->app->bound(SessionManager::class)) { $sessionManager = $this->app->make(SessionManager::class); $httpDriver = new SymfonyHttpDriver($sessionManager); $debugbar->setHttpDriver($httpDriver); } return $debugbar; } ); $this->app->alias(LaravelDebugbar::class, 'debugbar'); $this->app->singleton('command.debugbar.clear', function ($app) { return new Console\ClearCommand($app['debugbar']); } ); $this->commands(['command.debugbar.clear']); }
php
public function register() { $configPath = __DIR__ . '/../config/debugbar.php'; $this->mergeConfigFrom($configPath, 'debugbar'); $this->app->alias( DataFormatter::class, DataFormatterInterface::class ); $this->app->singleton(LaravelDebugbar::class, function () { $debugbar = new LaravelDebugbar($this->app); if ($this->app->bound(SessionManager::class)) { $sessionManager = $this->app->make(SessionManager::class); $httpDriver = new SymfonyHttpDriver($sessionManager); $debugbar->setHttpDriver($httpDriver); } return $debugbar; } ); $this->app->alias(LaravelDebugbar::class, 'debugbar'); $this->app->singleton('command.debugbar.clear', function ($app) { return new Console\ClearCommand($app['debugbar']); } ); $this->commands(['command.debugbar.clear']); }
[ "public", "function", "register", "(", ")", "{", "$", "configPath", "=", "__DIR__", ".", "'/../config/debugbar.php'", ";", "$", "this", "->", "mergeConfigFrom", "(", "$", "configPath", ",", "'debugbar'", ")", ";", "$", "this", "->", "app", "->", "alias", "...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/ServiceProvider.php#L25-L57
train
Registers the debugbar services.
[ 30522, 2270, 3853, 4236, 1006, 1007, 1063, 1002, 9530, 8873, 21600, 8988, 1027, 1035, 1035, 16101, 1035, 1035, 1012, 1005, 1013, 1012, 1012, 1013, 9530, 8873, 2290, 1013, 2139, 8569, 18259, 2906, 1012, 25718, 1005, 1025, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Apc.php
Zend_Cache_Backend_Apc.getFillingPercentage
public function getFillingPercentage() { $mem = apc_sma_info(true); $memSize = $mem['num_seg'] * $mem['seg_size']; $memAvailable= $mem['avail_mem']; $memUsed = $memSize - $memAvailable; if ($memSize == 0) { Zend_Cache::throwException('can\'t get apc memory size'); } if ($memUsed > $memSize) { return 100; } return ((int) (100. * ($memUsed / $memSize))); }
php
public function getFillingPercentage() { $mem = apc_sma_info(true); $memSize = $mem['num_seg'] * $mem['seg_size']; $memAvailable= $mem['avail_mem']; $memUsed = $memSize - $memAvailable; if ($memSize == 0) { Zend_Cache::throwException('can\'t get apc memory size'); } if ($memUsed > $memSize) { return 100; } return ((int) (100. * ($memUsed / $memSize))); }
[ "public", "function", "getFillingPercentage", "(", ")", "{", "$", "mem", "=", "apc_sma_info", "(", "true", ")", ";", "$", "memSize", "=", "$", "mem", "[", "'num_seg'", "]", "*", "$", "mem", "[", "'seg_size'", "]", ";", "$", "memAvailable", "=", "$", ...
Return the filling percentage of the backend storage @throws Zend_Cache_Exception @return int integer between 0 and 100
[ "Return", "the", "filling", "percentage", "of", "the", "backend", "storage" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Apc.php#L184-L197
train
Get the percentage of space used for the current APC s memory usage
[ 30522, 2270, 3853, 2131, 8873, 13112, 4842, 13013, 4270, 1006, 1007, 1063, 1002, 2033, 2213, 1027, 9706, 2278, 1035, 15488, 2050, 1035, 18558, 1006, 2995, 1007, 1025, 1002, 2033, 5244, 4697, 1027, 1002, 2033, 2213, 1031, 1005, 16371, 2213, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Response.php
Response.getTtl
public function getTtl(): ?int { $maxAge = $this->getMaxAge(); return null !== $maxAge ? $maxAge - $this->getAge() : null; }
php
public function getTtl(): ?int { $maxAge = $this->getMaxAge(); return null !== $maxAge ? $maxAge - $this->getAge() : null; }
[ "public", "function", "getTtl", "(", ")", ":", "?", "int", "{", "$", "maxAge", "=", "$", "this", "->", "getMaxAge", "(", ")", ";", "return", "null", "!==", "$", "maxAge", "?", "$", "maxAge", "-", "$", "this", "->", "getAge", "(", ")", ":", "null"...
Returns the response's time-to-live in seconds. It returns null when no freshness information is present in the response. When the responses TTL is <= 0, the response may not be served from cache without first revalidating with the origin. @final
[ "Returns", "the", "response", "s", "time", "-", "to", "-", "live", "in", "seconds", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Response.php#L816-L821
train
Get the ttl of the current session
[ 30522, 2270, 3853, 2131, 4779, 2140, 1006, 1007, 1024, 1029, 20014, 1063, 1002, 4098, 4270, 1027, 1002, 2023, 1011, 1028, 2131, 17848, 4270, 1006, 1007, 1025, 2709, 19701, 999, 1027, 1027, 1002, 4098, 4270, 1029, 1002, 4098, 4270, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php
DefaultValueResolver.supports
public function supports(Request $request, ArgumentMetadata $argument) { return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic()); }
php
public function supports(Request $request, ArgumentMetadata $argument) { return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic()); }
[ "public", "function", "supports", "(", "Request", "$", "request", ",", "ArgumentMetadata", "$", "argument", ")", "{", "return", "$", "argument", "->", "hasDefaultValue", "(", ")", "||", "(", "null", "!==", "$", "argument", "->", "getType", "(", ")", "&&", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php#L28-L31
train
Returns true if the argument supports the request
[ 30522, 2270, 3853, 6753, 1006, 5227, 1002, 5227, 1010, 6685, 11368, 8447, 2696, 1002, 6685, 1007, 1063, 2709, 1002, 6685, 1011, 1028, 2038, 3207, 7011, 11314, 10175, 5657, 1006, 1007, 1064, 1064, 1006, 19701, 999, 1027, 1027, 1002, 6685, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/LanguagesManager/API.php
API.getTranslationsForLanguage
public function getTranslationsForLanguage($languageCode) { if (!$this->isLanguageAvailable($languageCode)) { return false; } $data = file_get_contents(PIWIK_INCLUDE_PATH . "/lang/$languageCode.json"); $translations = json_decode($data, true); $languageInfo = array(); foreach ($translations as $module => $keys) { foreach ($keys as $key => $value) { $languageInfo[] = array( 'label' => sprintf("%s_%s", $module, $key), 'value' => $value ); } } foreach (PluginManager::getInstance()->getLoadedPluginsName() as $pluginName) { $translations = $this->getPluginTranslationsForLanguage($pluginName, $languageCode); if (!empty($translations)) { foreach ($translations as $keys) { $languageInfo[] = $keys; } } } return $languageInfo; }
php
public function getTranslationsForLanguage($languageCode) { if (!$this->isLanguageAvailable($languageCode)) { return false; } $data = file_get_contents(PIWIK_INCLUDE_PATH . "/lang/$languageCode.json"); $translations = json_decode($data, true); $languageInfo = array(); foreach ($translations as $module => $keys) { foreach ($keys as $key => $value) { $languageInfo[] = array( 'label' => sprintf("%s_%s", $module, $key), 'value' => $value ); } } foreach (PluginManager::getInstance()->getLoadedPluginsName() as $pluginName) { $translations = $this->getPluginTranslationsForLanguage($pluginName, $languageCode); if (!empty($translations)) { foreach ($translations as $keys) { $languageInfo[] = $keys; } } } return $languageInfo; }
[ "public", "function", "getTranslationsForLanguage", "(", "$", "languageCode", ")", "{", "if", "(", "!", "$", "this", "->", "isLanguageAvailable", "(", "$", "languageCode", ")", ")", "{", "return", "false", ";", "}", "$", "data", "=", "file_get_contents", "("...
Returns translation strings by language @param string $languageCode ISO language code @return array|false Array of arrays, each containing 'label' (translation index) and 'value' (translated string); false if language unavailable
[ "Returns", "translation", "strings", "by", "language" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/API.php#L202-L230
train
Get translations for language
[ 30522, 2270, 3853, 2131, 6494, 3619, 13490, 22747, 2953, 25023, 6692, 3351, 1006, 1002, 2653, 16044, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 25340, 3070, 6692, 3351, 12462, 11733, 3468, 1006, 1002, 2653, 16044, 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...
overtrue/wechat
src/Kernel/Traits/HasAttributes.php
HasAttributes.with
public function with($attribute, $value) { $this->snakeable && $attribute = Str::snake($attribute); $this->setAttribute($attribute, $value); return $this; }
php
public function with($attribute, $value) { $this->snakeable && $attribute = Str::snake($attribute); $this->setAttribute($attribute, $value); return $this; }
[ "public", "function", "with", "(", "$", "attribute", ",", "$", "value", ")", "{", "$", "this", "->", "snakeable", "&&", "$", "attribute", "=", "Str", "::", "snake", "(", "$", "attribute", ")", ";", "$", "this", "->", "setAttribute", "(", "$", "attrib...
Set attribute. @param string $attribute @param mixed $value @return $this
[ "Set", "attribute", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Traits/HasAttributes.php#L101-L108
train
Set attribute value
[ 30522, 2270, 3853, 2007, 1006, 1002, 17961, 1010, 1002, 3643, 1007, 1063, 1002, 2023, 1011, 1028, 7488, 3085, 1004, 1004, 1002, 17961, 1027, 2358, 2099, 1024, 1024, 7488, 1006, 1002, 17961, 1007, 1025, 1002, 2023, 1011, 1028, 2275, 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...
matomo-org/matomo
plugins/GeoIp2/LocationProvider/GeoIp2.php
GeoIp2.convertRegionCodeToIso
public static function convertRegionCodeToIso($countryCode, $fipsRegionCode, $returnOriginalIfNotFound = false) { static $mapping; if(empty($mapping)) { $mapping = include __DIR__ . '/../data/regionMapping.php'; } $countryCode = strtoupper($countryCode); if (empty($countryCode) || in_array($countryCode, ['EU', 'AP', 'A1', 'A2'])) { return ['', '']; } if (in_array($countryCode, ['US', 'CA'])) { // US and CA always haven been iso codes return [$countryCode, $fipsRegionCode]; } if ($countryCode == 'TI') { $countryCode = 'CN'; $fipsRegionCode = '14'; } $isoRegionCode = $returnOriginalIfNotFound ? $fipsRegionCode : ''; if (!empty($fipsRegionCode) && !empty($mapping[$countryCode][$fipsRegionCode])) { $isoRegionCode = $mapping[$countryCode][$fipsRegionCode]; } return [$countryCode, $isoRegionCode]; }
php
public static function convertRegionCodeToIso($countryCode, $fipsRegionCode, $returnOriginalIfNotFound = false) { static $mapping; if(empty($mapping)) { $mapping = include __DIR__ . '/../data/regionMapping.php'; } $countryCode = strtoupper($countryCode); if (empty($countryCode) || in_array($countryCode, ['EU', 'AP', 'A1', 'A2'])) { return ['', '']; } if (in_array($countryCode, ['US', 'CA'])) { // US and CA always haven been iso codes return [$countryCode, $fipsRegionCode]; } if ($countryCode == 'TI') { $countryCode = 'CN'; $fipsRegionCode = '14'; } $isoRegionCode = $returnOriginalIfNotFound ? $fipsRegionCode : ''; if (!empty($fipsRegionCode) && !empty($mapping[$countryCode][$fipsRegionCode])) { $isoRegionCode = $mapping[$countryCode][$fipsRegionCode]; } return [$countryCode, $isoRegionCode]; }
[ "public", "static", "function", "convertRegionCodeToIso", "(", "$", "countryCode", ",", "$", "fipsRegionCode", ",", "$", "returnOriginalIfNotFound", "=", "false", ")", "{", "static", "$", "mapping", ";", "if", "(", "empty", "(", "$", "mapping", ")", ")", "{"...
Converts an old FIPS region code to ISO @param string $countryCode @param string $fipsRegionCode @param bool $returnOriginalIfNotFound return given region code if no mapping was found @return array
[ "Converts", "an", "old", "FIPS", "region", "code", "to", "ISO" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/LocationProvider/GeoIp2.php#L228-L250
train
Converts a region code to an ISO code
[ 30522, 2270, 10763, 3853, 10463, 23784, 16044, 3406, 19565, 1006, 1002, 2406, 16044, 1010, 1002, 10882, 4523, 23784, 16044, 1010, 1002, 2709, 10050, 24965, 10128, 17048, 14876, 8630, 1027, 6270, 1007, 1063, 10763, 1002, 12375, 1025, 2065, 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/system/classes/VersionManager.php
VersionManager.applyDatabaseScript
protected function applyDatabaseScript($code, $version, $script) { /* * Execute the database PHP script */ $updateFile = $this->pluginManager->getPluginPath($code) . '/updates/' . $script; if (!File::isFile($updateFile)) { $this->note('- <error>v' . $version . ': Migration file "' . $script . '" not found</error>'); } $this->updater->setUp($updateFile); Db::table('system_plugin_history')->insert([ 'code' => $code, 'type' => self::HISTORY_TYPE_SCRIPT, 'version' => $version, 'detail' => $script, 'created_at' => new Carbon ]); }
php
protected function applyDatabaseScript($code, $version, $script) { /* * Execute the database PHP script */ $updateFile = $this->pluginManager->getPluginPath($code) . '/updates/' . $script; if (!File::isFile($updateFile)) { $this->note('- <error>v' . $version . ': Migration file "' . $script . '" not found</error>'); } $this->updater->setUp($updateFile); Db::table('system_plugin_history')->insert([ 'code' => $code, 'type' => self::HISTORY_TYPE_SCRIPT, 'version' => $version, 'detail' => $script, 'created_at' => new Carbon ]); }
[ "protected", "function", "applyDatabaseScript", "(", "$", "code", ",", "$", "version", ",", "$", "script", ")", "{", "/*\n * Execute the database PHP script\n */", "$", "updateFile", "=", "$", "this", "->", "pluginManager", "->", "getPluginPath", "(", ...
Registers a database update script in the history table.
[ "Registers", "a", "database", "update", "script", "in", "the", "history", "table", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/VersionManager.php#L387-L407
train
Apply the database script
[ 30522, 5123, 3853, 6611, 2850, 2696, 15058, 22483, 1006, 1002, 3642, 1010, 1002, 2544, 1010, 1002, 5896, 1007, 1063, 1013, 1008, 1008, 15389, 1996, 7809, 25718, 5896, 1008, 1013, 1002, 10651, 8873, 2571, 1027, 1002, 2023, 1011, 1028, 13354,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Notifications/Channels/MailChannel.php
MailChannel.buildMessage
protected function buildMessage($mailMessage, $notifiable, $notification, $message) { $this->addressMessage($mailMessage, $notifiable, $notification, $message); $mailMessage->subject($message->subject ?: Str::title( Str::snake(class_basename($notification), ' ') )); $this->addAttachments($mailMessage, $message); if (! is_null($message->priority)) { $mailMessage->setPriority($message->priority); } }
php
protected function buildMessage($mailMessage, $notifiable, $notification, $message) { $this->addressMessage($mailMessage, $notifiable, $notification, $message); $mailMessage->subject($message->subject ?: Str::title( Str::snake(class_basename($notification), ' ') )); $this->addAttachments($mailMessage, $message); if (! is_null($message->priority)) { $mailMessage->setPriority($message->priority); } }
[ "protected", "function", "buildMessage", "(", "$", "mailMessage", ",", "$", "notifiable", ",", "$", "notification", ",", "$", "message", ")", "{", "$", "this", "->", "addressMessage", "(", "$", "mailMessage", ",", "$", "notifiable", ",", "$", "notification",...
Build the mail message. @param \Illuminate\Mail\Message $mailMessage @param mixed $notifiable @param \Illuminate\Notifications\Notification $notification @param \Illuminate\Notifications\Messages\MailMessage $message @return void
[ "Build", "the", "mail", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/MailChannel.php#L127-L140
train
Build the message
[ 30522, 5123, 3853, 3857, 7834, 3736, 3351, 1006, 1002, 5653, 7834, 3736, 3351, 1010, 1002, 2025, 30524, 1006, 1002, 4471, 1011, 1028, 3395, 1029, 1024, 2358, 2099, 1024, 1024, 2516, 1006, 2358, 2099, 1024, 1024, 7488, 1006, 2465, 1035, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/FileStore.php
FileStore.put
public function put($key, $value, $seconds) { $this->ensureCacheDirectoryExists($path = $this->path($key)); $result = $this->files->put( $path, $this->expiration($seconds).serialize($value), true ); return $result !== false && $result > 0; }
php
public function put($key, $value, $seconds) { $this->ensureCacheDirectoryExists($path = $this->path($key)); $result = $this->files->put( $path, $this->expiration($seconds).serialize($value), true ); return $result !== false && $result > 0; }
[ "public", "function", "put", "(", "$", "key", ",", "$", "value", ",", "$", "seconds", ")", "{", "$", "this", "->", "ensureCacheDirectoryExists", "(", "$", "path", "=", "$", "this", "->", "path", "(", "$", "key", ")", ")", ";", "$", "result", "=", ...
Store an item in the cache for a given number of seconds. @param string $key @param mixed $value @param int $seconds @return bool
[ "Store", "an", "item", "in", "the", "cache", "for", "a", "given", "number", "of", "seconds", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/FileStore.php#L60-L69
train
Put a value into cache.
[ 30522, 2270, 3853, 2404, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 3823, 1007, 1063, 1002, 2023, 1011, 1028, 5676, 3540, 7690, 7442, 16761, 6672, 9048, 12837, 1006, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 4130, 1006, 1002, 3145, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
domnikl/DesignPatternsPHP
Structural/Registry/Registry.php
Registry.set
public static function set(string $key, $value) { if (!in_array($key, self::$allowedKeys)) { throw new \InvalidArgumentException('Invalid key given'); } self::$storedValues[$key] = $value; }
php
public static function set(string $key, $value) { if (!in_array($key, self::$allowedKeys)) { throw new \InvalidArgumentException('Invalid key given'); } self::$storedValues[$key] = $value; }
[ "public", "static", "function", "set", "(", "string", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "in_array", "(", "$", "key", ",", "self", "::", "$", "allowedKeys", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "...
@param string $key @param mixed $value @return void
[ "@param", "string", "$key", "@param", "mixed", "$value" ]
5f5649b57ea94471e20b54eb439c6368dea07886
https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/Structural/Registry/Registry.php#L30-L37
train
Set a value to the store
[ 30522, 2270, 10763, 3853, 2275, 1006, 5164, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 999, 1999, 1035, 9140, 1006, 1002, 3145, 1010, 2969, 1024, 1024, 1002, 3039, 14839, 2015, 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/backend/formwidgets/ColorPicker.php
ColorPicker.getAvailableColors
protected function getAvailableColors() { $availableColors = $this->availableColors; if (is_array($availableColors)) { return $availableColors; } elseif (is_string($availableColors) && !empty($availableColors)) { if ($this->model->methodExists($availableColors)) { return $this->availableColors = $this->model->{$availableColors}( $this->formField->fieldName, $this->formField->value, $this->formField->config ); } else { throw new ApplicationException(Lang::get('backend::lang.field.colors_method_not_exists', [ 'model' => get_class($this->model), 'method' => $availableColors, 'field' => $this->formField->fieldName ])); } } }
php
protected function getAvailableColors() { $availableColors = $this->availableColors; if (is_array($availableColors)) { return $availableColors; } elseif (is_string($availableColors) && !empty($availableColors)) { if ($this->model->methodExists($availableColors)) { return $this->availableColors = $this->model->{$availableColors}( $this->formField->fieldName, $this->formField->value, $this->formField->config ); } else { throw new ApplicationException(Lang::get('backend::lang.field.colors_method_not_exists', [ 'model' => get_class($this->model), 'method' => $availableColors, 'field' => $this->formField->fieldName ])); } } }
[ "protected", "function", "getAvailableColors", "(", ")", "{", "$", "availableColors", "=", "$", "this", "->", "availableColors", ";", "if", "(", "is_array", "(", "$", "availableColors", ")", ")", "{", "return", "$", "availableColors", ";", "}", "elseif", "("...
Gets the appropriate list of colors. @return array
[ "Gets", "the", "appropriate", "list", "of", "colors", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/ColorPicker.php#L94-L115
train
Get available colors
[ 30522, 5123, 3853, 2131, 12462, 11733, 30524, 10128, 1006, 2003, 1035, 5164, 1006, 1002, 2800, 18717, 2015, 1007, 1004, 1004, 999, 4064, 1006, 1002, 2800, 18717, 2015, 1007, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2944, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
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...
matomo-org/matomo
core/Filechecks.php
Filechecks.getMakeWritableCommand
private static function getMakeWritableCommand($realpath) { $realpath = Common::sanitizeInputValue($realpath); if (SettingsServer::isWindows()) { return "<code>cacls $realpath /t /g " . Common::sanitizeInputValue(self::getUser()) . ":f</code><br />\n"; } return "<code>chmod -R 0755 $realpath</code><br />"; }
php
private static function getMakeWritableCommand($realpath) { $realpath = Common::sanitizeInputValue($realpath); if (SettingsServer::isWindows()) { return "<code>cacls $realpath /t /g " . Common::sanitizeInputValue(self::getUser()) . ":f</code><br />\n"; } return "<code>chmod -R 0755 $realpath</code><br />"; }
[ "private", "static", "function", "getMakeWritableCommand", "(", "$", "realpath", ")", "{", "$", "realpath", "=", "Common", "::", "sanitizeInputValue", "(", "$", "realpath", ")", ";", "if", "(", "SettingsServer", "::", "isWindows", "(", ")", ")", "{", "return...
Returns the help text displayed to suggest which command to run to give writable access to a file or directory @param string $realpath @return string
[ "Returns", "the", "help", "text", "displayed", "to", "suggest", "which", "command", "to", "run", "to", "give", "writable", "access", "to", "a", "file", "or", "directory" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Filechecks.php#L180-L187
train
Returns the command to make the file writable
[ 30522, 2797, 10763, 3853, 2131, 2863, 3489, 13088, 6590, 3468, 9006, 2386, 2094, 1006, 1002, 2613, 15069, 1007, 1063, 1002, 2613, 15069, 1027, 2691, 1024, 1024, 2624, 25090, 4371, 2378, 18780, 10175, 5657, 1006, 1002, 2613, 15069, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
ServerBased.getLocation
public function getLocation($info) { $ip = $this->getIpFromInfo($info); // geoip modules that are built into servers can't use a forced IP. in this case we try // to fallback to another version. $myIP = IP::getIpFromHeader(); if (!self::isSameOrAnonymizedIp($ip, $myIP) && (!isset($info['disable_fallbacks']) || !$info['disable_fallbacks']) ) { Common::printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: $myIP. GeoIP Server Module (apache/nginx) does not support this use case... "); $fallbacks = array( Pecl::ID, Php::ID ); foreach ($fallbacks as $fallbackProviderId) { $otherProvider = LocationProvider::getProviderById($fallbackProviderId); if ($otherProvider) { Common::printDebug("Used $fallbackProviderId to detect this visitor IP"); return $otherProvider->getLocation($info); } } Common::printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error."); return false; } $result = array(); foreach (self::$geoIpServerVars as $resultKey => $geoipVarName) { if (!empty($_SERVER[$geoipVarName])) { $result[$resultKey] = $_SERVER[$geoipVarName]; } $geoipVarNameV6 = $geoipVarName . '_V6'; if (!empty($_SERVER[$geoipVarNameV6])) { $result[$resultKey] = $_SERVER[$geoipVarNameV6]; } } foreach (self::$geoIpUtfServerVars as $resultKey => $geoipVarName) { if (!empty($_SERVER[$geoipVarName])) { $result[$resultKey] = utf8_encode($_SERVER[$geoipVarName]); } } $this->completeLocationResult($result); return $result; }
php
public function getLocation($info) { $ip = $this->getIpFromInfo($info); // geoip modules that are built into servers can't use a forced IP. in this case we try // to fallback to another version. $myIP = IP::getIpFromHeader(); if (!self::isSameOrAnonymizedIp($ip, $myIP) && (!isset($info['disable_fallbacks']) || !$info['disable_fallbacks']) ) { Common::printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: $myIP. GeoIP Server Module (apache/nginx) does not support this use case... "); $fallbacks = array( Pecl::ID, Php::ID ); foreach ($fallbacks as $fallbackProviderId) { $otherProvider = LocationProvider::getProviderById($fallbackProviderId); if ($otherProvider) { Common::printDebug("Used $fallbackProviderId to detect this visitor IP"); return $otherProvider->getLocation($info); } } Common::printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error."); return false; } $result = array(); foreach (self::$geoIpServerVars as $resultKey => $geoipVarName) { if (!empty($_SERVER[$geoipVarName])) { $result[$resultKey] = $_SERVER[$geoipVarName]; } $geoipVarNameV6 = $geoipVarName . '_V6'; if (!empty($_SERVER[$geoipVarNameV6])) { $result[$resultKey] = $_SERVER[$geoipVarNameV6]; } } foreach (self::$geoIpUtfServerVars as $resultKey => $geoipVarName) { if (!empty($_SERVER[$geoipVarName])) { $result[$resultKey] = utf8_encode($_SERVER[$geoipVarName]); } } $this->completeLocationResult($result); return $result; }
[ "public", "function", "getLocation", "(", "$", "info", ")", "{", "$", "ip", "=", "$", "this", "->", "getIpFromInfo", "(", "$", "info", ")", ";", "// geoip modules that are built into servers can't use a forced IP. in this case we try", "// to fallback to another version.", ...
Uses a GeoIP database to get a visitor's location based on their IP address. This function will return different results based on the data used and based on how the GeoIP module is configured. If a region database is used, it may return the country code, region code, city name, area code, latitude, longitude and postal code of the visitor. Alternatively, only the country code may be returned for another database. If your HTTP server is not configured to include all GeoIP information, some information will not be available to Piwik. @param array $info Must have an 'ip' field. @return array
[ "Uses", "a", "GeoIP", "database", "to", "get", "a", "visitor", "s", "location", "based", "on", "their", "IP", "address", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php#L67-L113
train
Returns the location of the IP address
[ 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, 1013, 1013, 20248, 11514, 14184, 2008, 2024, 2328, 2046, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Console/Gpm/SelfupgradeCommand.php
SelfupgradeCommand.download
private function download($package) { $tmp_dir = Grav::instance()['locator']->findResource('tmp://', true, true); $this->tmp = $tmp_dir . '/Grav-' . uniqid('', false); $output = Response::get($package['download'], [], [$this, 'progress']); Folder::create($this->tmp); $this->output->write("\x0D"); $this->output->write(" |- Downloading upgrade [{$this->formatBytes($package['size'])}]... 100%"); $this->output->writeln(''); file_put_contents($this->tmp . DS . $package['name'], $output); return $this->tmp . DS . $package['name']; }
php
private function download($package) { $tmp_dir = Grav::instance()['locator']->findResource('tmp://', true, true); $this->tmp = $tmp_dir . '/Grav-' . uniqid('', false); $output = Response::get($package['download'], [], [$this, 'progress']); Folder::create($this->tmp); $this->output->write("\x0D"); $this->output->write(" |- Downloading upgrade [{$this->formatBytes($package['size'])}]... 100%"); $this->output->writeln(''); file_put_contents($this->tmp . DS . $package['name'], $output); return $this->tmp . DS . $package['name']; }
[ "private", "function", "download", "(", "$", "package", ")", "{", "$", "tmp_dir", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", "->", "findResource", "(", "'tmp://'", ",", "true", ",", "true", ")", ";", "$", "this", "->", "tmp", "="...
@param Package $package @return string
[ "@param", "Package", "$package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/SelfupgradeCommand.php#L184-L199
train
Download the upgrade file
[ 30522, 2797, 3853, 8816, 1006, 1002, 7427, 1007, 1063, 1002, 1056, 8737, 1035, 16101, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 8840, 11266, 2953, 1005, 1033, 1011, 1028, 2424, 6072, 8162, 3401, 1006, 1005, 1056, 8737, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.findMany
public function findMany($ids, $columns = ['*']) { if (empty($ids)) { return $this->model->newCollection(); } return $this->whereKey($ids)->get($columns); }
php
public function findMany($ids, $columns = ['*']) { if (empty($ids)) { return $this->model->newCollection(); } return $this->whereKey($ids)->get($columns); }
[ "public", "function", "findMany", "(", "$", "ids", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "empty", "(", "$", "ids", ")", ")", "{", "return", "$", "this", "->", "model", "->", "newCollection", "(", ")", ";", "}", "return",...
Find multiple models by their primary keys. @param \Illuminate\Contracts\Support\Arrayable|array $ids @param array $columns @return \Illuminate\Database\Eloquent\Collection
[ "Find", "multiple", "models", "by", "their", "primary", "keys", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L339-L346
train
Find many records by id
[ 30522, 2270, 3853, 2424, 2386, 2100, 1006, 1002, 8909, 2015, 1010, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 8909, 2015, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 204...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Metrics.php
Metrics.isLowerValueBetter
public static function isLowerValueBetter($column) { $lowerIsBetterPatterns = array( 'bounce', 'exit' ); foreach ($lowerIsBetterPatterns as $pattern) { if (strpos($column, $pattern) !== false) { return true; } } return false; }
php
public static function isLowerValueBetter($column) { $lowerIsBetterPatterns = array( 'bounce', 'exit' ); foreach ($lowerIsBetterPatterns as $pattern) { if (strpos($column, $pattern) !== false) { return true; } } return false; }
[ "public", "static", "function", "isLowerValueBetter", "(", "$", "column", ")", "{", "$", "lowerIsBetterPatterns", "=", "array", "(", "'bounce'", ",", "'exit'", ")", ";", "foreach", "(", "$", "lowerIsBetterPatterns", "as", "$", "pattern", ")", "{", "if", "(",...
Is a lower value for a given column better? @param $column @return bool @ignore
[ "Is", "a", "lower", "value", "for", "a", "given", "column", "better?", "@param", "$column", "@return", "bool" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Metrics.php#L214-L227
train
Returns true if the column is in the lower case value of bounce or exit
[ 30522, 2270, 10763, 3853, 2003, 27663, 26585, 5657, 20915, 3334, 1006, 1002, 5930, 1007, 1063, 1002, 2896, 2483, 20915, 3334, 4502, 12079, 3619, 1027, 9140, 1006, 1005, 17523, 1005, 1010, 1005, 6164, 1005, 1007, 1025, 18921, 6776, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php
FactoryMakeCommand.buildClass
protected function buildClass($name) { $namespaceModel = $this->option('model') ? $this->qualifyClass($this->option('model')) : trim($this->rootNamespace(), '\\').'\\Model'; $model = class_basename($namespaceModel); return str_replace( [ 'NamespacedDummyModel', 'DummyModel', ], [ $namespaceModel, $model, ], parent::buildClass($name) ); }
php
protected function buildClass($name) { $namespaceModel = $this->option('model') ? $this->qualifyClass($this->option('model')) : trim($this->rootNamespace(), '\\').'\\Model'; $model = class_basename($namespaceModel); return str_replace( [ 'NamespacedDummyModel', 'DummyModel', ], [ $namespaceModel, $model, ], parent::buildClass($name) ); }
[ "protected", "function", "buildClass", "(", "$", "name", ")", "{", "$", "namespaceModel", "=", "$", "this", "->", "option", "(", "'model'", ")", "?", "$", "this", "->", "qualifyClass", "(", "$", "this", "->", "option", "(", "'model'", ")", ")", ":", ...
Build the class with the given name. @param string $name @return string
[ "Build", "the", "class", "with", "the", "given", "name", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php#L47-L66
train
Build the class.
[ 30522, 5123, 3853, 3857, 26266, 1006, 1002, 2171, 1007, 1063, 1002, 3415, 15327, 5302, 9247, 1027, 1002, 2023, 1011, 1028, 5724, 1006, 1005, 2944, 1005, 1007, 1029, 1002, 2023, 1011, 1028, 7515, 26266, 1006, 1002, 2023, 1011, 1028, 5724, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Facades/Facade.php
Facade.spy
public static function spy() { if (! static::isMock()) { $class = static::getMockableClass(); return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { static::swap($spy); }); } }
php
public static function spy() { if (! static::isMock()) { $class = static::getMockableClass(); return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { static::swap($spy); }); } }
[ "public", "static", "function", "spy", "(", ")", "{", "if", "(", "!", "static", "::", "isMock", "(", ")", ")", "{", "$", "class", "=", "static", "::", "getMockableClass", "(", ")", ";", "return", "tap", "(", "$", "class", "?", "Mockery", "::", "spy...
Convert the facade into a Mockery spy. @return \Mockery\MockInterface
[ "Convert", "the", "facade", "into", "a", "Mockery", "spy", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Facades/Facade.php#L44-L53
train
Spy the class.
[ 30522, 2270, 10763, 3853, 8645, 1006, 1007, 1063, 2065, 1006, 999, 10763, 1024, 1024, 2003, 5302, 3600, 1006, 1007, 1007, 1063, 1002, 2465, 1027, 10763, 1024, 1024, 2131, 5302, 3600, 3085, 26266, 1006, 1007, 1025, 2709, 11112, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php
MetadataAwareNameConverter.denormalize
public function denormalize($propertyName, string $class = null, string $format = null, array $context = []) { if (null === $class) { return $this->denormalizeFallback($propertyName, $class, $format, $context); } if (!isset(self::$denormalizeCache[$class][$propertyName])) { self::$denormalizeCache[$class][$propertyName] = $this->getCacheValueForDenormalization($propertyName, $class); } return self::$denormalizeCache[$class][$propertyName] ?? $this->denormalizeFallback($propertyName, $class, $format, $context); }
php
public function denormalize($propertyName, string $class = null, string $format = null, array $context = []) { if (null === $class) { return $this->denormalizeFallback($propertyName, $class, $format, $context); } if (!isset(self::$denormalizeCache[$class][$propertyName])) { self::$denormalizeCache[$class][$propertyName] = $this->getCacheValueForDenormalization($propertyName, $class); } return self::$denormalizeCache[$class][$propertyName] ?? $this->denormalizeFallback($propertyName, $class, $format, $context); }
[ "public", "function", "denormalize", "(", "$", "propertyName", ",", "string", "$", "class", "=", "null", ",", "string", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "if", "(", "null", "===", "$", "class", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php#L59-L70
train
Denormalizes a property
[ 30522, 2270, 3853, 7939, 2953, 9067, 4697, 1006, 1002, 3200, 18442, 1010, 5164, 1002, 2465, 1027, 19701, 1010, 5164, 1002, 4289, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
CachePoolPass.process
public function process(ContainerBuilder $container) { if ($container->hasParameter('cache.prefix.seed')) { $seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed')); } else { $seed = '_'.$container->getParameter('kernel.project_dir'); } $seed .= '.'.$container->getParameter('kernel.container_class'); $pools = []; $clearers = []; $attributes = [ 'provider', 'name', 'namespace', 'default_lifetime', 'reset', ]; foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) { $adapter = $pool = $container->getDefinition($id); if ($pool->isAbstract()) { continue; } $class = $adapter->getClass(); while ($adapter instanceof ChildDefinition) { $adapter = $container->findDefinition($adapter->getParent()); $class = $class ?: $adapter->getClass(); if ($t = $adapter->getTag($this->cachePoolTag)) { $tags[0] += $t[0]; } } $name = $tags[0]['name'] ?? $id; if (!isset($tags[0]['namespace'])) { if (null !== $class) { $seed .= '.'.$class; } $tags[0]['namespace'] = $this->getNamespace($seed, $name); } if (isset($tags[0]['clearer'])) { $clearer = $tags[0]['clearer']; while ($container->hasAlias($clearer)) { $clearer = (string) $container->getAlias($clearer); } } else { $clearer = null; } unset($tags[0]['clearer'], $tags[0]['name']); if (isset($tags[0]['provider'])) { $tags[0]['provider'] = new Reference(static::getServiceProvider($container, $tags[0]['provider'])); } $i = 0; foreach ($attributes as $attr) { if (!isset($tags[0][$attr])) { // no-op } elseif ('reset' === $attr) { if ($tags[0][$attr]) { $pool->addTag($this->kernelResetTag, ['method' => $tags[0][$attr]]); } } elseif ('namespace' !== $attr || ArrayAdapter::class !== $adapter->getClass()) { $pool->replaceArgument($i++, $tags[0][$attr]); } unset($tags[0][$attr]); } if (!empty($tags[0])) { throw new InvalidArgumentException(sprintf('Invalid "%s" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime" and "reset", found "%s".', $this->cachePoolTag, $id, implode('", "', array_keys($tags[0])))); } if (null !== $clearer) { $clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); } $pools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); } $notAliasedCacheClearerId = $this->cacheClearerId; while ($container->hasAlias($this->cacheClearerId)) { $this->cacheClearerId = (string) $container->getAlias($this->cacheClearerId); } if ($container->hasDefinition($this->cacheClearerId)) { $clearers[$notAliasedCacheClearerId] = $pools; } foreach ($clearers as $id => $pools) { $clearer = $container->getDefinition($id); if ($clearer instanceof ChildDefinition) { $clearer->replaceArgument(0, $pools); } else { $clearer->setArgument(0, $pools); } $clearer->addTag($this->cachePoolClearerTag); if ($this->cacheSystemClearerId === $id) { $clearer->addTag($this->cacheSystemClearerTag); } } if ($container->hasDefinition('console.command.cache_pool_list')) { $container->getDefinition('console.command.cache_pool_list')->replaceArgument(0, array_keys($pools)); } }
php
public function process(ContainerBuilder $container) { if ($container->hasParameter('cache.prefix.seed')) { $seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed')); } else { $seed = '_'.$container->getParameter('kernel.project_dir'); } $seed .= '.'.$container->getParameter('kernel.container_class'); $pools = []; $clearers = []; $attributes = [ 'provider', 'name', 'namespace', 'default_lifetime', 'reset', ]; foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) { $adapter = $pool = $container->getDefinition($id); if ($pool->isAbstract()) { continue; } $class = $adapter->getClass(); while ($adapter instanceof ChildDefinition) { $adapter = $container->findDefinition($adapter->getParent()); $class = $class ?: $adapter->getClass(); if ($t = $adapter->getTag($this->cachePoolTag)) { $tags[0] += $t[0]; } } $name = $tags[0]['name'] ?? $id; if (!isset($tags[0]['namespace'])) { if (null !== $class) { $seed .= '.'.$class; } $tags[0]['namespace'] = $this->getNamespace($seed, $name); } if (isset($tags[0]['clearer'])) { $clearer = $tags[0]['clearer']; while ($container->hasAlias($clearer)) { $clearer = (string) $container->getAlias($clearer); } } else { $clearer = null; } unset($tags[0]['clearer'], $tags[0]['name']); if (isset($tags[0]['provider'])) { $tags[0]['provider'] = new Reference(static::getServiceProvider($container, $tags[0]['provider'])); } $i = 0; foreach ($attributes as $attr) { if (!isset($tags[0][$attr])) { // no-op } elseif ('reset' === $attr) { if ($tags[0][$attr]) { $pool->addTag($this->kernelResetTag, ['method' => $tags[0][$attr]]); } } elseif ('namespace' !== $attr || ArrayAdapter::class !== $adapter->getClass()) { $pool->replaceArgument($i++, $tags[0][$attr]); } unset($tags[0][$attr]); } if (!empty($tags[0])) { throw new InvalidArgumentException(sprintf('Invalid "%s" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime" and "reset", found "%s".', $this->cachePoolTag, $id, implode('", "', array_keys($tags[0])))); } if (null !== $clearer) { $clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); } $pools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); } $notAliasedCacheClearerId = $this->cacheClearerId; while ($container->hasAlias($this->cacheClearerId)) { $this->cacheClearerId = (string) $container->getAlias($this->cacheClearerId); } if ($container->hasDefinition($this->cacheClearerId)) { $clearers[$notAliasedCacheClearerId] = $pools; } foreach ($clearers as $id => $pools) { $clearer = $container->getDefinition($id); if ($clearer instanceof ChildDefinition) { $clearer->replaceArgument(0, $pools); } else { $clearer->setArgument(0, $pools); } $clearer->addTag($this->cachePoolClearerTag); if ($this->cacheSystemClearerId === $id) { $clearer->addTag($this->cacheSystemClearerTag); } } if ($container->hasDefinition('console.command.cache_pool_list')) { $container->getDefinition('console.command.cache_pool_list')->replaceArgument(0, array_keys($pools)); } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "if", "(", "$", "container", "->", "hasParameter", "(", "'cache.prefix.seed'", ")", ")", "{", "$", "seed", "=", "'.'", ".", "$", "container", "->", "getParameterBag", "(", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php#L48-L149
train
Process the cache pool tags
[ 30522, 2270, 3853, 2832, 1006, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 2065, 1006, 1002, 11661, 1011, 1028, 2038, 28689, 22828, 1006, 1005, 17053, 1012, 17576, 1012, 6534, 1005, 1007, 1007, 1063, 1002, 6534, 1027, 1005, 1012, 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/Mail/Storage/Imap.php
Zend_Mail_Storage_Imap.countMessages
public function countMessages($flags = null) { if (!$this->_currentFolder) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('No selected folder to count'); } if ($flags === null) { return count($this->_protocol->search(array('ALL'))); } $params = array(); foreach ((array)$flags as $flag) { if (isset(self::$_searchFlags[$flag])) { $params[] = self::$_searchFlags[$flag]; } else { $params[] = 'KEYWORD'; $params[] = $this->_protocol->escapeString($flag); } } return count($this->_protocol->search($params)); }
php
public function countMessages($flags = null) { if (!$this->_currentFolder) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('No selected folder to count'); } if ($flags === null) { return count($this->_protocol->search(array('ALL'))); } $params = array(); foreach ((array)$flags as $flag) { if (isset(self::$_searchFlags[$flag])) { $params[] = self::$_searchFlags[$flag]; } else { $params[] = 'KEYWORD'; $params[] = $this->_protocol->escapeString($flag); } } return count($this->_protocol->search($params)); }
[ "public", "function", "countMessages", "(", "$", "flags", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_currentFolder", ")", "{", "/**\n * @see Zend_Mail_Storage_Exception\n */", "// require_once 'Zend/Mail/Storage/Exception.php';", "th...
Count messages all messages in current box @return int number of messages @throws Zend_Mail_Storage_Exception @throws Zend_Mail_Protocol_Exception
[ "Count", "messages", "all", "messages", "in", "current", "box" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Imap.php#L113-L137
train
Count messages in the current folder
[ 30522, 2270, 3853, 4175, 7834, 3736, 8449, 1006, 1002, 9245, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2783, 10371, 2121, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2156, 16729, 2094, 1035, 5653, 1035, 5527, 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/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...
matomo-org/matomo
core/UrlHelper.php
UrlHelper.getPathAndQueryFromUrl
public static function getPathAndQueryFromUrl($url) { $parsedUrl = parse_url($url); $result = ''; if (isset($parsedUrl['path'])) { if (substr($parsedUrl['path'], 0, 1) == '/') { $parsedUrl['path'] = substr($parsedUrl['path'], 1); } $result .= $parsedUrl['path']; } if (isset($parsedUrl['query'])) { $result .= '?' . $parsedUrl['query']; } return $result; }
php
public static function getPathAndQueryFromUrl($url) { $parsedUrl = parse_url($url); $result = ''; if (isset($parsedUrl['path'])) { if (substr($parsedUrl['path'], 0, 1) == '/') { $parsedUrl['path'] = substr($parsedUrl['path'], 1); } $result .= $parsedUrl['path']; } if (isset($parsedUrl['query'])) { $result .= '?' . $parsedUrl['query']; } return $result; }
[ "public", "static", "function", "getPathAndQueryFromUrl", "(", "$", "url", ")", "{", "$", "parsedUrl", "=", "parse_url", "(", "$", "url", ")", ";", "$", "result", "=", "''", ";", "if", "(", "isset", "(", "$", "parsedUrl", "[", "'path'", "]", ")", ")"...
Returns the path and query string of a URL. @param string $url The URL. @return string eg, `/test/index.php?module=CoreHome` if `$url` is `http://piwik.org/test/index.php?module=CoreHome`. @api
[ "Returns", "the", "path", "and", "query", "string", "of", "a", "URL", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/UrlHelper.php#L295-L309
train
Returns the path and query from a URL
[ 30522, 2270, 10763, 3853, 2131, 15069, 5685, 4226, 2854, 19699, 5358, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1063, 1002, 11968, 6924, 3126, 2140, 1027, 11968, 3366, 1035, 24471, 2140, 1006, 1002, 24471, 2140, 1007, 1025, 1002, 2765, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Console/Scheduling/ScheduleRunCommand.php
ScheduleRunCommand.runSingleServerEvent
protected function runSingleServerEvent($event) { if ($this->schedule->serverShouldRun($event, $this->startedAt)) { $this->runEvent($event); } else { $this->line('<info>Skipping command (has already run on another server):</info> '.$event->getSummaryForDisplay()); } }
php
protected function runSingleServerEvent($event) { if ($this->schedule->serverShouldRun($event, $this->startedAt)) { $this->runEvent($event); } else { $this->line('<info>Skipping command (has already run on another server):</info> '.$event->getSummaryForDisplay()); } }
[ "protected", "function", "runSingleServerEvent", "(", "$", "event", ")", "{", "if", "(", "$", "this", "->", "schedule", "->", "serverShouldRun", "(", "$", "event", ",", "$", "this", "->", "startedAt", ")", ")", "{", "$", "this", "->", "runEvent", "(", ...
Run the given single server event. @param \Illuminate\Console\Scheduling\Event $event @return void
[ "Run", "the", "given", "single", "server", "event", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php#L92-L99
train
Runs single server event
[ 30522, 5123, 3853, 3216, 2075, 24527, 2099, 28943, 15338, 1006, 1002, 2724, 30524, 15338, 1006, 1002, 2724, 1007, 1025, 1065, 2842, 1063, 1002, 2023, 1011, 1028, 2240, 1006, 1005, 1026, 18558, 1028, 25978, 3094, 1006, 2038, 2525, 2448, 2006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/FrameReflower/Block.php
Block._text_align
protected function _text_align() { $style = $this->_frame->get_style(); $w = $this->_frame->get_containing_block("w"); $width = (float)$style->length_in_pt($style->width, $w); switch ($style->text_align) { default: case "left": foreach ($this->_frame->get_line_boxes() as $line) { if (!$line->left) { continue; } foreach ($line->get_frames() as $frame) { if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $line->left); } } return; case "right": foreach ($this->_frame->get_line_boxes() as $line) { // Move each child over by $dx $dx = $width - $line->w - $line->right; foreach ($line->get_frames() as $frame) { // Block frames are not aligned by text-align if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $dx); } } break; case "justify": // We justify all lines except the last one $lines = $this->_frame->get_line_boxes(); // needs to be a variable (strict standards) $last_line = array_pop($lines); foreach ($lines as $i => $line) { if ($line->br) { unset($lines[$i]); } } // One space character's width. Will be used to get a more accurate spacing $space_width = $this->get_dompdf()->getFontMetrics()->getTextWidth(" ", $style->font_family, $style->font_size); foreach ($lines as $line) { if ($line->left) { foreach ($line->get_frames() as $frame) { if (!$frame instanceof TextFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $line->left); } } // Set the spacing for each child if ($line->wc > 1) { $spacing = ($width - ($line->left + $line->w + $line->right) + $space_width) / ($line->wc - 1); } else { $spacing = 0; } $dx = 0; foreach ($line->get_frames() as $frame) { if (!$frame instanceof TextFrameDecorator) { continue; } $text = $frame->get_text(); $spaces = mb_substr_count($text, " "); $char_spacing = (float)$style->length_in_pt($style->letter_spacing); $_spacing = $spacing + $char_spacing; $frame->set_position($frame->get_position("x") + $dx); $frame->set_text_spacing($_spacing); $dx += $spaces * $_spacing; } // The line (should) now occupy the entire width $line->w = $width; } // Adjust the last line if necessary if ($last_line->left) { foreach ($last_line->get_frames() as $frame) { if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $last_line->left); } } break; case "center": case "centre": foreach ($this->_frame->get_line_boxes() as $line) { // Centre each line by moving each frame in the line by: $dx = ($width + $line->left - $line->w - $line->right) / 2; foreach ($line->get_frames() as $frame) { // Block frames are not aligned by text-align if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $dx); } } break; } }
php
protected function _text_align() { $style = $this->_frame->get_style(); $w = $this->_frame->get_containing_block("w"); $width = (float)$style->length_in_pt($style->width, $w); switch ($style->text_align) { default: case "left": foreach ($this->_frame->get_line_boxes() as $line) { if (!$line->left) { continue; } foreach ($line->get_frames() as $frame) { if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $line->left); } } return; case "right": foreach ($this->_frame->get_line_boxes() as $line) { // Move each child over by $dx $dx = $width - $line->w - $line->right; foreach ($line->get_frames() as $frame) { // Block frames are not aligned by text-align if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $dx); } } break; case "justify": // We justify all lines except the last one $lines = $this->_frame->get_line_boxes(); // needs to be a variable (strict standards) $last_line = array_pop($lines); foreach ($lines as $i => $line) { if ($line->br) { unset($lines[$i]); } } // One space character's width. Will be used to get a more accurate spacing $space_width = $this->get_dompdf()->getFontMetrics()->getTextWidth(" ", $style->font_family, $style->font_size); foreach ($lines as $line) { if ($line->left) { foreach ($line->get_frames() as $frame) { if (!$frame instanceof TextFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $line->left); } } // Set the spacing for each child if ($line->wc > 1) { $spacing = ($width - ($line->left + $line->w + $line->right) + $space_width) / ($line->wc - 1); } else { $spacing = 0; } $dx = 0; foreach ($line->get_frames() as $frame) { if (!$frame instanceof TextFrameDecorator) { continue; } $text = $frame->get_text(); $spaces = mb_substr_count($text, " "); $char_spacing = (float)$style->length_in_pt($style->letter_spacing); $_spacing = $spacing + $char_spacing; $frame->set_position($frame->get_position("x") + $dx); $frame->set_text_spacing($_spacing); $dx += $spaces * $_spacing; } // The line (should) now occupy the entire width $line->w = $width; } // Adjust the last line if necessary if ($last_line->left) { foreach ($last_line->get_frames() as $frame) { if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $last_line->left); } } break; case "center": case "centre": foreach ($this->_frame->get_line_boxes() as $line) { // Centre each line by moving each frame in the line by: $dx = ($width + $line->left - $line->w - $line->right) / 2; foreach ($line->get_frames() as $frame) { // Block frames are not aligned by text-align if ($frame instanceof BlockFrameDecorator) { continue; } $frame->set_position($frame->get_position("x") + $dx); } } break; } }
[ "protected", "function", "_text_align", "(", ")", "{", "$", "style", "=", "$", "this", "->", "_frame", "->", "get_style", "(", ")", ";", "$", "w", "=", "$", "this", "->", "_frame", "->", "get_containing_block", "(", "\"w\"", ")", ";", "$", "width", "...
Adjust the justification of each of our lines. http://www.w3.org/TR/CSS21/text.html#propdef-text-align
[ "Adjust", "the", "justification", "of", "each", "of", "our", "lines", ".", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "CSS21", "/", "text", ".", "html#propdef", "-", "text", "-", "align" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameReflower/Block.php#L429-L550
train
Calculates the text alignment of the frame
[ 30522, 5123, 3853, 1035, 3793, 30524, 1028, 1035, 4853, 1011, 1028, 2131, 1035, 2806, 1006, 1007, 1025, 1002, 1059, 1027, 1002, 2023, 1011, 1028, 1035, 4853, 1011, 1028, 2131, 1035, 4820, 1035, 3796, 1006, 1000, 1059, 1000, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Menu/MenuAdmin.php
MenuAdmin.addDiagnosticItem
public function addDiagnosticItem($menuName, $url, $order = 50, $tooltip = false) { $this->addItem('CoreAdminHome_MenuDiagnostic', $menuName, $url, $order, $tooltip); }
php
public function addDiagnosticItem($menuName, $url, $order = 50, $tooltip = false) { $this->addItem('CoreAdminHome_MenuDiagnostic', $menuName, $url, $order, $tooltip); }
[ "public", "function", "addDiagnosticItem", "(", "$", "menuName", ",", "$", "url", ",", "$", "order", "=", "50", ",", "$", "tooltip", "=", "false", ")", "{", "$", "this", "->", "addItem", "(", "'CoreAdminHome_MenuDiagnostic'", ",", "$", "menuName", ",", "...
See {@link add()}. Adds a new menu item to the diagnostic section of the admin menu. @param string $menuName @param array $url @param int $order @param bool|string $tooltip @api @since 2.5.0
[ "See", "{" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAdmin.php#L62-L65
train
Add a menu item with diagnostic information to the menu
[ 30522, 2270, 3853, 5587, 9032, 26745, 10074, 4221, 2213, 1006, 1002, 12183, 18442, 1010, 1002, 24471, 2140, 1010, 1002, 2344, 1027, 2753, 1010, 1002, 6994, 25101, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 5587, 4221, 2213, 1006, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
HasOneOrMany.addConstraints
public function addConstraints() { if (static::$constraints) { $this->query->where($this->foreignKey, '=', $this->getParentKey()); $this->query->whereNotNull($this->foreignKey); } }
php
public function addConstraints() { if (static::$constraints) { $this->query->where($this->foreignKey, '=', $this->getParentKey()); $this->query->whereNotNull($this->foreignKey); } }
[ "public", "function", "addConstraints", "(", ")", "{", "if", "(", "static", "::", "$", "constraints", ")", "{", "$", "this", "->", "query", "->", "where", "(", "$", "this", "->", "foreignKey", ",", "'='", ",", "$", "this", "->", "getParentKey", "(", ...
Set the base constraints on the relation query. @return void
[ "Set", "the", "base", "constraints", "on", "the", "relation", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php#L67-L74
train
Add constraints to the query
[ 30522, 2270, 3853, 5587, 8663, 20528, 18447, 2015, 1006, 1007, 1063, 2065, 1006, 10763, 1024, 1024, 1002, 14679, 1007, 1063, 1002, 2023, 1011, 1028, 23032, 1011, 1028, 2073, 1006, 1002, 2023, 1011, 1028, 3097, 14839, 1010, 1005, 1027, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.bootIfNotBooted
protected function bootIfNotBooted() { if (! isset(static::$booted[static::class])) { static::$booted[static::class] = true; $this->fireModelEvent('booting', false); static::boot(); $this->fireModelEvent('booted', false); } }
php
protected function bootIfNotBooted() { if (! isset(static::$booted[static::class])) { static::$booted[static::class] = true; $this->fireModelEvent('booting', false); static::boot(); $this->fireModelEvent('booted', false); } }
[ "protected", "function", "bootIfNotBooted", "(", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "booted", "[", "static", "::", "class", "]", ")", ")", "{", "static", "::", "$", "booted", "[", "static", "::", "class", "]", "=", "true", ...
Check if the model needs to be booted and if so, do it. @return void
[ "Check", "if", "the", "model", "needs", "to", "be", "booted", "and", "if", "so", "do", "it", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L179-L190
train
Boots the class if it hasn t been booted yet.
[ 30522, 5123, 3853, 9573, 10128, 17048, 27927, 2098, 1006, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 10763, 1024, 1024, 1002, 9573, 2098, 1031, 10763, 1024, 1024, 2465, 1033, 1007, 1007, 1063, 10763, 1024, 1024, 1002, 9573, 2098, 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...
matomo-org/matomo
libs/HTML/Common2.php
HTML_Common2.setAttributes
public function setAttributes($attributes) { $attributes = self::prepareAttributes($attributes); $watched = array(); foreach ($this->watchedAttributes as $watchedKey) { if (isset($attributes[$watchedKey])) { $this->setAttribute($watchedKey, $attributes[$watchedKey]); unset($attributes[$watchedKey]); } else { $this->removeAttribute($watchedKey); } if (isset($this->attributes[$watchedKey])) { $watched[$watchedKey] = $this->attributes[$watchedKey]; } } $this->attributes = array_merge($watched, $attributes); return $this; }
php
public function setAttributes($attributes) { $attributes = self::prepareAttributes($attributes); $watched = array(); foreach ($this->watchedAttributes as $watchedKey) { if (isset($attributes[$watchedKey])) { $this->setAttribute($watchedKey, $attributes[$watchedKey]); unset($attributes[$watchedKey]); } else { $this->removeAttribute($watchedKey); } if (isset($this->attributes[$watchedKey])) { $watched[$watchedKey] = $this->attributes[$watchedKey]; } } $this->attributes = array_merge($watched, $attributes); return $this; }
[ "public", "function", "setAttributes", "(", "$", "attributes", ")", "{", "$", "attributes", "=", "self", "::", "prepareAttributes", "(", "$", "attributes", ")", ";", "$", "watched", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "watched...
Sets the attributes @param mixed Array of attribute 'name' => 'value' pairs or HTML attribute string @return HTML_Common2
[ "Sets", "the", "attributes" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L274-L291
train
Set attributes of the grammar
[ 30522, 2270, 3853, 2275, 30524, 14839, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 12332, 1031, 1002, 3427, 14839, 1033, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 19321, 3089, 8569, 2618, 1006, 1002, 3427, 14839, 1010, 1002, 1233...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php
ViolationMapper.mapViolation
public function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false) { $this->allowNonSynchronized = $allowNonSynchronized; // The scope is the currently found most specific form that // an error should be mapped to. After setting the scope, the // mapper will try to continue to find more specific matches in // the children of scope. If it cannot, the error will be // mapped to this scope. $scope = null; $violationPath = null; $relativePath = null; $match = false; // Don't create a ViolationPath instance for empty property paths if (\strlen($violation->getPropertyPath()) > 0) { $violationPath = new ViolationPath($violation->getPropertyPath()); $relativePath = $this->reconstructPath($violationPath, $form); } // This case happens if the violation path is empty and thus // the violation should be mapped to the root form if (null === $violationPath) { $scope = $form; } // In general, mapping happens from the root form to the leaf forms // First, the rules of the root form are applied to determine // the subsequent descendant. The rules of this descendant are then // applied to find the next and so on, until we have found the // most specific form that matches the violation. // If any of the forms found in this process is not synchronized, // mapping is aborted. Non-synchronized forms could not reverse // transform the value entered by the user, thus any further violations // caused by the (invalid) reverse transformed value should be // ignored. if (null !== $relativePath) { // Set the scope to the root of the relative path // This root will usually be $form. If the path contains // an unmapped form though, the last unmapped form found // will be the root of the path. $scope = $relativePath->getRoot(); $it = new PropertyPathIterator($relativePath); while ($this->acceptsErrors($scope) && null !== ($child = $this->matchChild($scope, $it))) { $scope = $child; $it->next(); $match = true; } } // This case happens if an error happened in the data under a // form inheriting its parent data that does not match any of the // children of that form. if (null !== $violationPath && !$match) { // If we could not map the error to anything more specific // than the root element, map it to the innermost directly // mapped form of the violation path // e.g. "children[foo].children[bar].data.baz" // Here the innermost directly mapped child is "bar" $scope = $form; $it = new ViolationPathIterator($violationPath); // Note: acceptsErrors() will always return true for forms inheriting // their parent data, because these forms can never be non-synchronized // (they don't do any data transformation on their own) while ($this->acceptsErrors($scope) && $it->valid() && $it->mapsForm()) { if (!$scope->has($it->current())) { // Break if we find a reference to a non-existing child break; } $scope = $scope->get($it->current()); $it->next(); } } // Follow dot rules until we have the final target $mapping = $scope->getConfig()->getOption('error_mapping'); while ($this->acceptsErrors($scope) && isset($mapping['.'])) { $dotRule = new MappingRule($scope, '.', $mapping['.']); $scope = $dotRule->getTarget(); $mapping = $scope->getConfig()->getOption('error_mapping'); } // Only add the error if the form is synchronized if ($this->acceptsErrors($scope)) { $scope->addError(new FormError( $violation->getMessage(), $violation->getMessageTemplate(), $violation->getParameters(), $violation->getPlural(), $violation )); } }
php
public function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false) { $this->allowNonSynchronized = $allowNonSynchronized; // The scope is the currently found most specific form that // an error should be mapped to. After setting the scope, the // mapper will try to continue to find more specific matches in // the children of scope. If it cannot, the error will be // mapped to this scope. $scope = null; $violationPath = null; $relativePath = null; $match = false; // Don't create a ViolationPath instance for empty property paths if (\strlen($violation->getPropertyPath()) > 0) { $violationPath = new ViolationPath($violation->getPropertyPath()); $relativePath = $this->reconstructPath($violationPath, $form); } // This case happens if the violation path is empty and thus // the violation should be mapped to the root form if (null === $violationPath) { $scope = $form; } // In general, mapping happens from the root form to the leaf forms // First, the rules of the root form are applied to determine // the subsequent descendant. The rules of this descendant are then // applied to find the next and so on, until we have found the // most specific form that matches the violation. // If any of the forms found in this process is not synchronized, // mapping is aborted. Non-synchronized forms could not reverse // transform the value entered by the user, thus any further violations // caused by the (invalid) reverse transformed value should be // ignored. if (null !== $relativePath) { // Set the scope to the root of the relative path // This root will usually be $form. If the path contains // an unmapped form though, the last unmapped form found // will be the root of the path. $scope = $relativePath->getRoot(); $it = new PropertyPathIterator($relativePath); while ($this->acceptsErrors($scope) && null !== ($child = $this->matchChild($scope, $it))) { $scope = $child; $it->next(); $match = true; } } // This case happens if an error happened in the data under a // form inheriting its parent data that does not match any of the // children of that form. if (null !== $violationPath && !$match) { // If we could not map the error to anything more specific // than the root element, map it to the innermost directly // mapped form of the violation path // e.g. "children[foo].children[bar].data.baz" // Here the innermost directly mapped child is "bar" $scope = $form; $it = new ViolationPathIterator($violationPath); // Note: acceptsErrors() will always return true for forms inheriting // their parent data, because these forms can never be non-synchronized // (they don't do any data transformation on their own) while ($this->acceptsErrors($scope) && $it->valid() && $it->mapsForm()) { if (!$scope->has($it->current())) { // Break if we find a reference to a non-existing child break; } $scope = $scope->get($it->current()); $it->next(); } } // Follow dot rules until we have the final target $mapping = $scope->getConfig()->getOption('error_mapping'); while ($this->acceptsErrors($scope) && isset($mapping['.'])) { $dotRule = new MappingRule($scope, '.', $mapping['.']); $scope = $dotRule->getTarget(); $mapping = $scope->getConfig()->getOption('error_mapping'); } // Only add the error if the form is synchronized if ($this->acceptsErrors($scope)) { $scope->addError(new FormError( $violation->getMessage(), $violation->getMessageTemplate(), $violation->getParameters(), $violation->getPlural(), $violation )); } }
[ "public", "function", "mapViolation", "(", "ConstraintViolation", "$", "violation", ",", "FormInterface", "$", "form", ",", "$", "allowNonSynchronized", "=", "false", ")", "{", "$", "this", "->", "allowNonSynchronized", "=", "$", "allowNonSynchronized", ";", "// T...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php#L35-L135
train
Map a constraint violation to the most specific form that the user has found.
[ 30522, 2270, 3853, 4949, 25500, 13490, 1006, 27142, 25500, 13490, 1002, 11371, 1010, 2433, 18447, 2121, 12172, 1002, 2433, 1010, 1002, 3499, 8540, 6508, 12680, 4948, 3550, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 3499, 8540, 6508, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
TextDescriptor.describeContainerServices
protected function describeContainerServices(ContainerBuilder $builder, array $options = []) { $showHidden = isset($options['show_hidden']) && $options['show_hidden']; $showTag = isset($options['tag']) ? $options['tag'] : null; if ($showHidden) { $title = 'Symfony Container Hidden Services'; } else { $title = 'Symfony Container Services'; } if ($showTag) { $title .= sprintf(' Tagged with "%s" Tag', $options['tag']); } $options['output']->title($title); $serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds(); $maxTags = []; if (isset($options['filter'])) { $serviceIds = array_filter($serviceIds, $options['filter']); } foreach ($serviceIds as $key => $serviceId) { $definition = $this->resolveServiceDefinition($builder, $serviceId); // filter out hidden services unless shown explicitly if ($showHidden xor '.' === ($serviceId[0] ?? null)) { unset($serviceIds[$key]); continue; } if ($definition instanceof Definition) { if ($showTag) { $tags = $definition->getTag($showTag); foreach ($tags as $tag) { foreach ($tag as $key => $value) { if (!isset($maxTags[$key])) { $maxTags[$key] = \strlen($key); } if (\strlen($value) > $maxTags[$key]) { $maxTags[$key] = \strlen($value); } } } } } } $tagsCount = \count($maxTags); $tagsNames = array_keys($maxTags); $tableHeaders = array_merge(['Service ID'], $tagsNames, ['Class name']); $tableRows = []; $rawOutput = isset($options['raw_text']) && $options['raw_text']; foreach ($this->sortServiceIds($serviceIds) as $serviceId) { $definition = $this->resolveServiceDefinition($builder, $serviceId); $styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', OutputFormatter::escape($serviceId)); if ($definition instanceof Definition) { if ($showTag) { foreach ($definition->getTag($showTag) as $key => $tag) { $tagValues = []; foreach ($tagsNames as $tagName) { $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : ''; } if (0 === $key) { $tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]); } else { $tableRows[] = array_merge([' "'], $tagValues, ['']); } } } else { $tableRows[] = [$styledServiceId, $definition->getClass()]; } } elseif ($definition instanceof Alias) { $alias = $definition; $tableRows[] = array_merge([$styledServiceId, sprintf('alias for "%s"', $alias)], $tagsCount ? array_fill(0, $tagsCount, '') : []); } else { $tableRows[] = array_merge([$styledServiceId, \get_class($definition)], $tagsCount ? array_fill(0, $tagsCount, '') : []); } } $options['output']->table($tableHeaders, $tableRows); }
php
protected function describeContainerServices(ContainerBuilder $builder, array $options = []) { $showHidden = isset($options['show_hidden']) && $options['show_hidden']; $showTag = isset($options['tag']) ? $options['tag'] : null; if ($showHidden) { $title = 'Symfony Container Hidden Services'; } else { $title = 'Symfony Container Services'; } if ($showTag) { $title .= sprintf(' Tagged with "%s" Tag', $options['tag']); } $options['output']->title($title); $serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds(); $maxTags = []; if (isset($options['filter'])) { $serviceIds = array_filter($serviceIds, $options['filter']); } foreach ($serviceIds as $key => $serviceId) { $definition = $this->resolveServiceDefinition($builder, $serviceId); // filter out hidden services unless shown explicitly if ($showHidden xor '.' === ($serviceId[0] ?? null)) { unset($serviceIds[$key]); continue; } if ($definition instanceof Definition) { if ($showTag) { $tags = $definition->getTag($showTag); foreach ($tags as $tag) { foreach ($tag as $key => $value) { if (!isset($maxTags[$key])) { $maxTags[$key] = \strlen($key); } if (\strlen($value) > $maxTags[$key]) { $maxTags[$key] = \strlen($value); } } } } } } $tagsCount = \count($maxTags); $tagsNames = array_keys($maxTags); $tableHeaders = array_merge(['Service ID'], $tagsNames, ['Class name']); $tableRows = []; $rawOutput = isset($options['raw_text']) && $options['raw_text']; foreach ($this->sortServiceIds($serviceIds) as $serviceId) { $definition = $this->resolveServiceDefinition($builder, $serviceId); $styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', OutputFormatter::escape($serviceId)); if ($definition instanceof Definition) { if ($showTag) { foreach ($definition->getTag($showTag) as $key => $tag) { $tagValues = []; foreach ($tagsNames as $tagName) { $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : ''; } if (0 === $key) { $tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]); } else { $tableRows[] = array_merge([' "'], $tagValues, ['']); } } } else { $tableRows[] = [$styledServiceId, $definition->getClass()]; } } elseif ($definition instanceof Alias) { $alias = $definition; $tableRows[] = array_merge([$styledServiceId, sprintf('alias for "%s"', $alias)], $tagsCount ? array_fill(0, $tagsCount, '') : []); } else { $tableRows[] = array_merge([$styledServiceId, \get_class($definition)], $tagsCount ? array_fill(0, $tagsCount, '') : []); } } $options['output']->table($tableHeaders, $tableRows); }
[ "protected", "function", "describeContainerServices", "(", "ContainerBuilder", "$", "builder", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "showHidden", "=", "isset", "(", "$", "options", "[", "'show_hidden'", "]", ")", "&&", "$", "options", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php#L176-L261
train
Describes the container services
[ 30522, 5123, 3853, 6235, 8663, 18249, 2545, 2121, 7903, 2229, 1006, 11661, 8569, 23891, 2099, 1002, 12508, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2265, 27511, 4181, 1027, 26354, 3388, 1006, 1002, 7047, 1031, 1005, 2265,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
ExceptionController.templateExists
protected function templateExists($template) { $template = (string) $template; $loader = $this->twig->getLoader(); if ($loader instanceof ExistsLoaderInterface || method_exists($loader, 'exists')) { return $loader->exists($template); } try { $loader->getSourceContext($template)->getCode(); return true; } catch (LoaderError $e) { } return false; }
php
protected function templateExists($template) { $template = (string) $template; $loader = $this->twig->getLoader(); if ($loader instanceof ExistsLoaderInterface || method_exists($loader, 'exists')) { return $loader->exists($template); } try { $loader->getSourceContext($template)->getCode(); return true; } catch (LoaderError $e) { } return false; }
[ "protected", "function", "templateExists", "(", "$", "template", ")", "{", "$", "template", "=", "(", "string", ")", "$", "template", ";", "$", "loader", "=", "$", "this", "->", "twig", "->", "getLoader", "(", ")", ";", "if", "(", "$", "loader", "ins...
to be removed when the minimum required version of Twig is >= 3.0
[ "to", "be", "removed", "when", "the", "minimum", "required", "version", "of", "Twig", "is", ">", "=", "3", ".", "0" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php#L126-L143
train
Checks if a template exists in the current context
[ 30522, 5123, 3853, 23561, 10288, 5130, 1006, 1002, 23561, 1007, 1063, 1002, 23561, 1027, 1006, 5164, 1007, 1002, 23561, 1025, 1002, 7170, 2121, 1027, 1002, 2023, 1011, 1028, 1056, 16279, 1011, 1028, 2131, 11066, 2121, 1006, 1007, 1025, 2065...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Field.php
Field.fill
public function fill($data) { // Field value is already setted. // if (!is_null($this->value)) { // return; // } $this->data = $data; if (is_array($this->column)) { foreach ($this->column as $key => $column) { $this->value[$key] = Arr::get($data, $column); } return; } $this->value = Arr::get($data, $this->column); if (isset($this->customFormat) && $this->customFormat instanceof \Closure) { $this->value = call_user_func($this->customFormat, $this->value); } }
php
public function fill($data) { // Field value is already setted. // if (!is_null($this->value)) { // return; // } $this->data = $data; if (is_array($this->column)) { foreach ($this->column as $key => $column) { $this->value[$key] = Arr::get($data, $column); } return; } $this->value = Arr::get($data, $this->column); if (isset($this->customFormat) && $this->customFormat instanceof \Closure) { $this->value = call_user_func($this->customFormat, $this->value); } }
[ "public", "function", "fill", "(", "$", "data", ")", "{", "// Field value is already setted.", "// if (!is_null($this->value)) {", "// return;", "// }", "$", "this", "->", "data", "=", "$", "data", ";", "if", "(", "is_array", "(", "$", "this...
Fill data to the field. @param array $data @return void
[ "Fill", "data", "to", "the", "field", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field.php#L341-L362
train
Fill the field value from the given array
[ 30522, 2270, 3853, 6039, 1006, 1002, 2951, 1007, 1063, 1013, 1013, 2492, 3643, 2003, 2525, 2275, 3064, 1012, 1013, 1013, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 3643, 1007, 1007, 1063, 1013, 1013, 2709, 1025, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.renameColumn
public function renameColumn($oldName, $newName) { foreach ($this->rows as $row) { $row->renameColumn($oldName, $newName); $subTable = $row->getSubtable(); if ($subTable) { $subTable->renameColumn($oldName, $newName); } } if (!is_null($this->summaryRow)) { $this->summaryRow->renameColumn($oldName, $newName); } if (!is_null($this->totalsRow)) { $this->totalsRow->renameColumn($oldName, $newName); } }
php
public function renameColumn($oldName, $newName) { foreach ($this->rows as $row) { $row->renameColumn($oldName, $newName); $subTable = $row->getSubtable(); if ($subTable) { $subTable->renameColumn($oldName, $newName); } } if (!is_null($this->summaryRow)) { $this->summaryRow->renameColumn($oldName, $newName); } if (!is_null($this->totalsRow)) { $this->totalsRow->renameColumn($oldName, $newName); } }
[ "public", "function", "renameColumn", "(", "$", "oldName", ",", "$", "newName", ")", "{", "foreach", "(", "$", "this", "->", "rows", "as", "$", "row", ")", "{", "$", "row", "->", "renameColumn", "(", "$", "oldName", ",", "$", "newName", ")", ";", "...
Rename a column in every row. This change is applied recursively to all subtables. @param string $oldName Old column name. @param string $newName New column name.
[ "Rename", "a", "column", "in", "every", "row", ".", "This", "change", "is", "applied", "recursively", "to", "all", "subtables", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1086-L1102
train
Renames a column in all rows summary and totals rows
[ 30522, 2270, 3853, 14916, 14074, 25778, 2819, 2078, 1006, 1002, 2214, 18442, 1010, 1002, 2047, 18442, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 10281, 2004, 1002, 5216, 1007, 1063, 1002, 5216, 1011, 1028, 14916, 14074, 25778, 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/Page/Medium/Medium.php
Medium.thumbnail
public function thumbnail($type = 'auto') { if ($type !== 'auto' && !\in_array($type, $this->thumbnailTypes, true)) { return $this; } if ($this->thumbnailType !== $type) { $this->_thumbnail = null; } $this->thumbnailType = $type; return $this; }
php
public function thumbnail($type = 'auto') { if ($type !== 'auto' && !\in_array($type, $this->thumbnailTypes, true)) { return $this; } if ($this->thumbnailType !== $type) { $this->_thumbnail = null; } $this->thumbnailType = $type; return $this; }
[ "public", "function", "thumbnail", "(", "$", "type", "=", "'auto'", ")", "{", "if", "(", "$", "type", "!==", "'auto'", "&&", "!", "\\", "in_array", "(", "$", "type", ",", "$", "this", "->", "thumbnailTypes", ",", "true", ")", ")", "{", "return", "$...
Switch thumbnail. @param string $type @return $this
[ "Switch", "thumbnail", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L518-L531
train
Set thumbnail type
[ 30522, 2270, 3853, 7639, 25464, 1006, 1002, 2828, 1027, 1005, 8285, 1005, 1007, 1063, 2065, 1006, 1002, 2828, 999, 1027, 1027, 1005, 8285, 1005, 1004, 1004, 999, 1032, 1999, 1035, 9140, 1006, 1002, 2828, 1010, 1002, 2023, 1011, 1028, 7639...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Model.php
Model.isSiteEmpty
public function isSiteEmpty($siteId) { $sql = sprintf('SELECT idsite FROM %s WHERE idsite = ? limit 1', Common::prefixTable('log_visit')); $result = \Piwik\Db::fetchOne($sql, array($siteId)); return $result == null; }
php
public function isSiteEmpty($siteId) { $sql = sprintf('SELECT idsite FROM %s WHERE idsite = ? limit 1', Common::prefixTable('log_visit')); $result = \Piwik\Db::fetchOne($sql, array($siteId)); return $result == null; }
[ "public", "function", "isSiteEmpty", "(", "$", "siteId", ")", "{", "$", "sql", "=", "sprintf", "(", "'SELECT idsite FROM %s WHERE idsite = ? limit 1'", ",", "Common", "::", "prefixTable", "(", "'log_visit'", ")", ")", ";", "$", "result", "=", "\\", "Piwik", "\...
Returns true if the site doesn't have raw data. @param int $siteId @return bool
[ "Returns", "true", "if", "the", "site", "doesn", "t", "have", "raw", "data", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Model.php#L421-L428
train
Returns true if the site is empty.
[ 30522, 2270, 3853, 26354, 4221, 6633, 13876, 2100, 1006, 1002, 2609, 3593, 1007, 1063, 1002, 29296, 1027, 9043, 2546, 1006, 1005, 7276, 8909, 28032, 2063, 2013, 1003, 1055, 2073, 8909, 28032, 2063, 1027, 1029, 5787, 1015, 1005, 1010, 2691, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Lists.php
Lists.evalRelationTypeValue
protected function evalRelationTypeValue($record, $column, $value) { traceLog(sprintf('Warning: List column type "relation" for class "%s" is not valid.', get_class($record))); return $this->evalTextTypeValue($record, $column, $value); }
php
protected function evalRelationTypeValue($record, $column, $value) { traceLog(sprintf('Warning: List column type "relation" for class "%s" is not valid.', get_class($record))); return $this->evalTextTypeValue($record, $column, $value); }
[ "protected", "function", "evalRelationTypeValue", "(", "$", "record", ",", "$", "column", ",", "$", "value", ")", "{", "traceLog", "(", "sprintf", "(", "'Warning: List column type \"relation\" for class \"%s\" is not valid.'", ",", "get_class", "(", "$", "record", ")"...
Common mistake, relation is not a valid list column. @deprecated Remove if year >= 2018
[ "Common", "mistake", "relation", "is", "not", "a", "valid", "list", "column", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1172-L1176
train
Evaluate the relation type value
[ 30522, 5123, 3853, 9345, 20974, 10581, 3508, 13874, 10175, 5657, 1006, 1002, 2501, 1010, 1002, 5930, 1010, 1002, 3643, 1007, 1063, 7637, 21197, 1006, 9043, 2546, 1006, 1005, 5432, 1024, 2862, 5930, 2828, 1000, 7189, 1000, 2005, 2465, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/MetadataLoader.php
MetadataLoader.load
public function load() { $defaults = $this->getDefaultPluginInformation(); $plugin = $this->loadPluginInfoJson(); // use translated plugin description if available if ($defaults['description'] != Piwik::translate($defaults['description'])) { unset($plugin['description']); } // look for a license file $licenseFile = $this->getPathToLicenseFile(); if(!empty($licenseFile)) { $plugin['license_file'] = $licenseFile; } return array_merge( $defaults, $plugin ); }
php
public function load() { $defaults = $this->getDefaultPluginInformation(); $plugin = $this->loadPluginInfoJson(); // use translated plugin description if available if ($defaults['description'] != Piwik::translate($defaults['description'])) { unset($plugin['description']); } // look for a license file $licenseFile = $this->getPathToLicenseFile(); if(!empty($licenseFile)) { $plugin['license_file'] = $licenseFile; } return array_merge( $defaults, $plugin ); }
[ "public", "function", "load", "(", ")", "{", "$", "defaults", "=", "$", "this", "->", "getDefaultPluginInformation", "(", ")", ";", "$", "plugin", "=", "$", "this", "->", "loadPluginInfoJson", "(", ")", ";", "// use translated plugin description if available", "...
Loads plugin metadata. @see Plugin::getInformation. @return array
[ "Loads", "plugin", "metadata", ".", "@see", "Plugin", "::", "getInformation", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/MetadataLoader.php#L51-L71
train
Load plugin information from the plugin info. json
[ 30522, 2270, 3853, 7170, 1006, 1007, 1063, 1002, 12398, 2015, 1027, 1002, 2023, 1011, 1028, 2131, 3207, 7011, 11314, 24759, 15916, 5498, 2078, 14192, 3370, 1006, 1007, 1025, 1002, 13354, 2378, 1027, 1002, 2023, 1011, 1028, 7170, 24759, 1591...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Admin.php
Admin.registerAuthRoutes
public function registerAuthRoutes() { $attributes = [ 'prefix' => config('admin.route.prefix'), 'middleware' => config('admin.route.middleware'), ]; app('router')->group($attributes, function ($router) { /* @var \Illuminate\Routing\Router $router */ $router->namespace('Encore\Admin\Controllers')->group(function ($router) { /* @var \Illuminate\Routing\Router $router */ $router->resource('auth/users', 'UserController')->names('admin.auth.users'); $router->resource('auth/roles', 'RoleController')->names('admin.auth.roles'); $router->resource('auth/permissions', 'PermissionController')->names('admin.auth.permissions'); $router->resource('auth/menu', 'MenuController', ['except' => ['create']])->names('admin.auth.menu'); $router->resource('auth/logs', 'LogController', ['only' => ['index', 'destroy']])->names('admin.auth.logs'); }); $authController = config('admin.auth.controller', AuthController::class); /* @var \Illuminate\Routing\Router $router */ $router->get('auth/login', $authController.'@getLogin')->name('admin.login'); $router->post('auth/login', $authController.'@postLogin'); $router->get('auth/logout', $authController.'@getLogout')->name('admin.logout'); $router->get('auth/setting', $authController.'@getSetting')->name('admin.setting'); $router->put('auth/setting', $authController.'@putSetting'); }); }
php
public function registerAuthRoutes() { $attributes = [ 'prefix' => config('admin.route.prefix'), 'middleware' => config('admin.route.middleware'), ]; app('router')->group($attributes, function ($router) { /* @var \Illuminate\Routing\Router $router */ $router->namespace('Encore\Admin\Controllers')->group(function ($router) { /* @var \Illuminate\Routing\Router $router */ $router->resource('auth/users', 'UserController')->names('admin.auth.users'); $router->resource('auth/roles', 'RoleController')->names('admin.auth.roles'); $router->resource('auth/permissions', 'PermissionController')->names('admin.auth.permissions'); $router->resource('auth/menu', 'MenuController', ['except' => ['create']])->names('admin.auth.menu'); $router->resource('auth/logs', 'LogController', ['only' => ['index', 'destroy']])->names('admin.auth.logs'); }); $authController = config('admin.auth.controller', AuthController::class); /* @var \Illuminate\Routing\Router $router */ $router->get('auth/login', $authController.'@getLogin')->name('admin.login'); $router->post('auth/login', $authController.'@postLogin'); $router->get('auth/logout', $authController.'@getLogout')->name('admin.logout'); $router->get('auth/setting', $authController.'@getSetting')->name('admin.setting'); $router->put('auth/setting', $authController.'@putSetting'); }); }
[ "public", "function", "registerAuthRoutes", "(", ")", "{", "$", "attributes", "=", "[", "'prefix'", "=>", "config", "(", "'admin.route.prefix'", ")", ",", "'middleware'", "=>", "config", "(", "'admin.route.middleware'", ")", ",", "]", ";", "app", "(", "'router...
Register the auth routes. @return void
[ "Register", "the", "auth", "routes", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Admin.php#L258-L287
train
Register Admin routes
[ 30522, 2270, 3853, 4236, 4887, 2705, 22494, 4570, 1006, 1007, 1063, 1002, 12332, 1027, 1031, 1005, 17576, 1005, 1027, 1028, 9530, 8873, 2290, 1006, 1005, 4748, 10020, 1012, 2799, 1012, 17576, 1005, 1007, 1010, 1005, 2690, 8059, 1005, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/ChildDefinition.php
ChildDefinition.replaceArgument
public function replaceArgument($index, $value) { if (\is_int($index)) { $this->arguments['index_'.$index] = $value; } elseif (0 === strpos($index, '$')) { $this->arguments[$index] = $value; } else { throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.'); } return $this; }
php
public function replaceArgument($index, $value) { if (\is_int($index)) { $this->arguments['index_'.$index] = $value; } elseif (0 === strpos($index, '$')) { $this->arguments[$index] = $value; } else { throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.'); } return $this; }
[ "public", "function", "replaceArgument", "(", "$", "index", ",", "$", "value", ")", "{", "if", "(", "\\", "is_int", "(", "$", "index", ")", ")", "{", "$", "this", "->", "arguments", "[", "'index_'", ".", "$", "index", "]", "=", "$", "value", ";", ...
You should always use this method when overwriting existing arguments of the parent definition. If you directly call setArguments() keep in mind that you must follow certain conventions when you want to overwrite the arguments of the parent definition, otherwise your arguments will only be appended. @param int|string $index @param mixed $value @return self the current instance @throws InvalidArgumentException when $index isn't an integer
[ "You", "should", "always", "use", "this", "method", "when", "overwriting", "existing", "arguments", "of", "the", "parent", "definition", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ChildDefinition.php#L96-L107
train
Set an argument value
[ 30522, 2270, 3853, 5672, 2906, 22850, 4765, 1006, 1002, 5950, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 20014, 1006, 1002, 5950, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 9918, 1031, 1005, 30524, 1033, 1027, 1002, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/DependencyInjection/LazyLoadingFragmentHandler.php
LazyLoadingFragmentHandler.render
public function render($uri, $renderer = 'inline', array $options = []) { if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) { $this->addRenderer($this->container->get($renderer)); $this->initialized[$renderer] = true; } return parent::render($uri, $renderer, $options); }
php
public function render($uri, $renderer = 'inline', array $options = []) { if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) { $this->addRenderer($this->container->get($renderer)); $this->initialized[$renderer] = true; } return parent::render($uri, $renderer, $options); }
[ "public", "function", "render", "(", "$", "uri", ",", "$", "renderer", "=", "'inline'", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "initialized", "[", "$", "renderer", "]", ")", "&&", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DependencyInjection/LazyLoadingFragmentHandler.php#L38-L46
train
Render a page with a specific renderer
[ 30522, 2270, 3853, 17552, 1006, 1002, 24471, 2072, 1010, 1002, 17552, 2121, 1027, 1005, 23881, 1005, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3988, 3550, 1031, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Show/Tools.php
Tools.getEditPath
protected function getEditPath() { $key = $this->panel->getParent()->getModel()->getKey(); return $this->getListPath().'/'.$key.'/edit'; }
php
protected function getEditPath() { $key = $this->panel->getParent()->getModel()->getKey(); return $this->getListPath().'/'.$key.'/edit'; }
[ "protected", "function", "getEditPath", "(", ")", "{", "$", "key", "=", "$", "this", "->", "panel", "->", "getParent", "(", ")", "->", "getModel", "(", ")", "->", "getKey", "(", ")", ";", "return", "$", "this", "->", "getListPath", "(", ")", ".", "...
Get request path for edit. @return string
[ "Get", "request", "path", "for", "edit", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L163-L168
train
Get edit path
[ 30522, 5123, 3853, 2131, 2098, 4183, 15069, 1006, 1007, 1063, 1002, 3145, 1027, 1002, 2023, 1011, 1028, 5997, 1011, 1028, 2131, 19362, 4765, 1006, 1007, 1011, 1028, 2131, 5302, 9247, 1006, 1007, 1011, 1028, 2131, 14839, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
ChoiceType.buildView
public function buildView(FormView $view, FormInterface $form, array $options) { $choiceTranslationDomain = $options['choice_translation_domain']; if ($view->parent && null === $choiceTranslationDomain) { $choiceTranslationDomain = $view->vars['translation_domain']; } /** @var ChoiceListInterface $choiceList */ $choiceList = $form->getConfig()->getAttribute('choice_list'); /** @var ChoiceListView $choiceListView */ $choiceListView = $form->getConfig()->hasAttribute('choice_list_view') ? $form->getConfig()->getAttribute('choice_list_view') : $this->createChoiceListView($choiceList, $options); $view->vars = array_replace($view->vars, [ 'multiple' => $options['multiple'], 'expanded' => $options['expanded'], 'preferred_choices' => $choiceListView->preferredChoices, 'choices' => $choiceListView->choices, 'separator' => '-------------------', 'placeholder' => null, 'choice_translation_domain' => $choiceTranslationDomain, ]); // The decision, whether a choice is selected, is potentially done // thousand of times during the rendering of a template. Provide a // closure here that is optimized for the value of the form, to // avoid making the type check inside the closure. if ($options['multiple']) { $view->vars['is_selected'] = function ($choice, array $values) { return \in_array($choice, $values, true); }; } else { $view->vars['is_selected'] = function ($choice, $value) { return $choice === $value; }; } // Check if the choices already contain the empty value $view->vars['placeholder_in_choices'] = $choiceListView->hasPlaceholder(); // Only add the empty value option if this is not the case if (null !== $options['placeholder'] && !$view->vars['placeholder_in_choices']) { $view->vars['placeholder'] = $options['placeholder']; } if ($options['multiple'] && !$options['expanded']) { // Add "[]" to the name in case a select tag with multiple options is // displayed. Otherwise only one of the selected options is sent in the // POST request. $view->vars['full_name'] .= '[]'; } }
php
public function buildView(FormView $view, FormInterface $form, array $options) { $choiceTranslationDomain = $options['choice_translation_domain']; if ($view->parent && null === $choiceTranslationDomain) { $choiceTranslationDomain = $view->vars['translation_domain']; } /** @var ChoiceListInterface $choiceList */ $choiceList = $form->getConfig()->getAttribute('choice_list'); /** @var ChoiceListView $choiceListView */ $choiceListView = $form->getConfig()->hasAttribute('choice_list_view') ? $form->getConfig()->getAttribute('choice_list_view') : $this->createChoiceListView($choiceList, $options); $view->vars = array_replace($view->vars, [ 'multiple' => $options['multiple'], 'expanded' => $options['expanded'], 'preferred_choices' => $choiceListView->preferredChoices, 'choices' => $choiceListView->choices, 'separator' => '-------------------', 'placeholder' => null, 'choice_translation_domain' => $choiceTranslationDomain, ]); // The decision, whether a choice is selected, is potentially done // thousand of times during the rendering of a template. Provide a // closure here that is optimized for the value of the form, to // avoid making the type check inside the closure. if ($options['multiple']) { $view->vars['is_selected'] = function ($choice, array $values) { return \in_array($choice, $values, true); }; } else { $view->vars['is_selected'] = function ($choice, $value) { return $choice === $value; }; } // Check if the choices already contain the empty value $view->vars['placeholder_in_choices'] = $choiceListView->hasPlaceholder(); // Only add the empty value option if this is not the case if (null !== $options['placeholder'] && !$view->vars['placeholder_in_choices']) { $view->vars['placeholder'] = $options['placeholder']; } if ($options['multiple'] && !$options['expanded']) { // Add "[]" to the name in case a select tag with multiple options is // displayed. Otherwise only one of the selected options is sent in the // POST request. $view->vars['full_name'] .= '[]'; } }
[ "public", "function", "buildView", "(", "FormView", "$", "view", ",", "FormInterface", "$", "form", ",", "array", "$", "options", ")", "{", "$", "choiceTranslationDomain", "=", "$", "options", "[", "'choice_translation_domain'", "]", ";", "if", "(", "$", "vi...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L172-L225
train
Build the view
[ 30522, 2270, 3853, 3857, 8584, 1006, 2433, 8584, 1002, 3193, 1010, 2433, 18447, 2121, 12172, 1002, 2433, 1010, 9140, 1002, 7047, 1007, 1063, 1002, 3601, 6494, 3619, 13490, 9527, 8113, 1027, 1002, 7047, 1031, 1005, 3601, 1035, 5449, 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...
octobercms/october
modules/backend/models/AccessLog.php
AccessLog.getRecent
public static function getRecent($user) { $records = static::where('user_id', $user->id) ->orderBy('created_at', 'desc') ->limit(2) ->get() ; if (!count($records)) { return null; } $first = $records->first(); return !$first->created_at->isToday() ? $first : $records->pop(); }
php
public static function getRecent($user) { $records = static::where('user_id', $user->id) ->orderBy('created_at', 'desc') ->limit(2) ->get() ; if (!count($records)) { return null; } $first = $records->first(); return !$first->created_at->isToday() ? $first : $records->pop(); }
[ "public", "static", "function", "getRecent", "(", "$", "user", ")", "{", "$", "records", "=", "static", "::", "where", "(", "'user_id'", ",", "$", "user", "->", "id", ")", "->", "orderBy", "(", "'created_at'", ",", "'desc'", ")", "->", "limit", "(", ...
Returns a recent entry, latest entry is not considered recent if the creation day is the same as today. @return self
[ "Returns", "a", "recent", "entry", "latest", "entry", "is", "not", "considered", "recent", "if", "the", "creation", "day", "is", "the", "same", "as", "today", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/AccessLog.php#L46-L61
train
Get recent entry
[ 30522, 2270, 10763, 3853, 2131, 2890, 13013, 1006, 1002, 5310, 1007, 1063, 1002, 2636, 1027, 10763, 1024, 1024, 2073, 1006, 1005, 5310, 1035, 8909, 1005, 1010, 1002, 5310, 1011, 1028, 8909, 1007, 1011, 1028, 2344, 3762, 1006, 1005, 2580, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Table/Row/Abstract.php
Zend_Db_Table_Row_Abstract.delete
public function delete() { /** * A read-only row cannot be deleted. */ if ($this->_readOnly === true) { // require_once 'Zend/Db/Table/Row/Exception.php'; throw new Zend_Db_Table_Row_Exception('This row has been marked read-only'); } $where = $this->_getWhereQuery(); /** * Execute pre-DELETE logic */ $this->_delete(); /** * Execute cascading deletes against dependent tables */ $depTables = $this->_getTable()->getDependentTables(); if (!empty($depTables)) { $pk = $this->_getPrimaryKey(); foreach ($depTables as $tableClass) { $t = $this->_getTableFromString($tableClass); $t->_cascadeDelete($this->getTableClass(), $pk); } } /** * Execute the DELETE (this may throw an exception) */ $result = $this->_getTable()->delete($where); /** * Execute post-DELETE logic */ $this->_postDelete(); /** * Reset all fields to null to indicate that the row is not there */ $this->_data = array_combine( array_keys($this->_data), array_fill(0, count($this->_data), null) ); return $result; }
php
public function delete() { /** * A read-only row cannot be deleted. */ if ($this->_readOnly === true) { // require_once 'Zend/Db/Table/Row/Exception.php'; throw new Zend_Db_Table_Row_Exception('This row has been marked read-only'); } $where = $this->_getWhereQuery(); /** * Execute pre-DELETE logic */ $this->_delete(); /** * Execute cascading deletes against dependent tables */ $depTables = $this->_getTable()->getDependentTables(); if (!empty($depTables)) { $pk = $this->_getPrimaryKey(); foreach ($depTables as $tableClass) { $t = $this->_getTableFromString($tableClass); $t->_cascadeDelete($this->getTableClass(), $pk); } } /** * Execute the DELETE (this may throw an exception) */ $result = $this->_getTable()->delete($where); /** * Execute post-DELETE logic */ $this->_postDelete(); /** * Reset all fields to null to indicate that the row is not there */ $this->_data = array_combine( array_keys($this->_data), array_fill(0, count($this->_data), null) ); return $result; }
[ "public", "function", "delete", "(", ")", "{", "/**\n * A read-only row cannot be deleted.\n */", "if", "(", "$", "this", "->", "_readOnly", "===", "true", ")", "{", "// require_once 'Zend/Db/Table/Row/Exception.php';", "throw", "new", "Zend_Db_Table_Row_Excep...
Deletes existing rows. @return int The number of rows deleted.
[ "Deletes", "existing", "rows", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Row/Abstract.php#L595-L643
train
Delete the row
[ 30522, 2270, 3853, 3972, 12870, 1006, 1007, 1063, 1013, 1008, 1008, 1008, 1037, 3191, 1011, 2069, 5216, 3685, 2022, 17159, 1012, 1008, 1013, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 3191, 2239, 2135, 1027, 1027, 1027, 2995, 1007, 1063, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/MediumFactory.php
MediumFactory.fromArray
public static function fromArray(array $items = [], Blueprint $blueprint = null) { $type = $items['type'] ?? null; switch ($type) { case 'image': return new ImageMedium($items, $blueprint); case 'thumbnail': return new ThumbnailImageMedium($items, $blueprint); case 'animated': case 'vector': return new StaticImageMedium($items, $blueprint); case 'video': return new VideoMedium($items, $blueprint); case 'audio': return new AudioMedium($items, $blueprint); default: return new Medium($items, $blueprint); } }
php
public static function fromArray(array $items = [], Blueprint $blueprint = null) { $type = $items['type'] ?? null; switch ($type) { case 'image': return new ImageMedium($items, $blueprint); case 'thumbnail': return new ThumbnailImageMedium($items, $blueprint); case 'animated': case 'vector': return new StaticImageMedium($items, $blueprint); case 'video': return new VideoMedium($items, $blueprint); case 'audio': return new AudioMedium($items, $blueprint); default: return new Medium($items, $blueprint); } }
[ "public", "static", "function", "fromArray", "(", "array", "$", "items", "=", "[", "]", ",", "Blueprint", "$", "blueprint", "=", "null", ")", "{", "$", "type", "=", "$", "items", "[", "'type'", "]", "??", "null", ";", "switch", "(", "$", "type", ")...
Create Medium from array of parameters @param array $items @param Blueprint|null $blueprint @return Medium
[ "Create", "Medium", "from", "array", "of", "parameters" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/MediumFactory.php#L128-L147
train
Create Medium from array
[ 30522, 2270, 10763, 3853, 2013, 2906, 9447, 1006, 9140, 1002, 5167, 1027, 1031, 1033, 1010, 2630, 16550, 1002, 2630, 16550, 1027, 19701, 1007, 1063, 1002, 2828, 1027, 1002, 5167, 1031, 1005, 2828, 1005, 1033, 1029, 1029, 19701, 1025, 6942, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Events/Libevent.php
Libevent.add
public function add($fd, $flag, $func, $args = array()) { switch ($flag) { case self::EV_SIGNAL: $fd_key = (int)$fd; $real_flag = EV_SIGNAL | EV_PERSIST; $this->_eventSignal[$fd_key] = event_new(); if (!event_set($this->_eventSignal[$fd_key], $fd, $real_flag, $func, null)) { return false; } if (!event_base_set($this->_eventSignal[$fd_key], $this->_eventBase)) { return false; } if (!event_add($this->_eventSignal[$fd_key])) { return false; } return true; case self::EV_TIMER: case self::EV_TIMER_ONCE: $event = event_new(); $timer_id = (int)$event; if (!event_set($event, 0, EV_TIMEOUT, array($this, 'timerCallback'), $timer_id)) { return false; } if (!event_base_set($event, $this->_eventBase)) { return false; } $time_interval = $fd * 1000000; if (!event_add($event, $time_interval)) { return false; } $this->_eventTimer[$timer_id] = array($func, (array)$args, $event, $flag, $time_interval); return $timer_id; default : $fd_key = (int)$fd; $real_flag = $flag === self::EV_READ ? EV_READ | EV_PERSIST : EV_WRITE | EV_PERSIST; $event = event_new(); if (!event_set($event, $fd, $real_flag, $func, null)) { return false; } if (!event_base_set($event, $this->_eventBase)) { return false; } if (!event_add($event)) { return false; } $this->_allEvents[$fd_key][$flag] = $event; return true; } }
php
public function add($fd, $flag, $func, $args = array()) { switch ($flag) { case self::EV_SIGNAL: $fd_key = (int)$fd; $real_flag = EV_SIGNAL | EV_PERSIST; $this->_eventSignal[$fd_key] = event_new(); if (!event_set($this->_eventSignal[$fd_key], $fd, $real_flag, $func, null)) { return false; } if (!event_base_set($this->_eventSignal[$fd_key], $this->_eventBase)) { return false; } if (!event_add($this->_eventSignal[$fd_key])) { return false; } return true; case self::EV_TIMER: case self::EV_TIMER_ONCE: $event = event_new(); $timer_id = (int)$event; if (!event_set($event, 0, EV_TIMEOUT, array($this, 'timerCallback'), $timer_id)) { return false; } if (!event_base_set($event, $this->_eventBase)) { return false; } $time_interval = $fd * 1000000; if (!event_add($event, $time_interval)) { return false; } $this->_eventTimer[$timer_id] = array($func, (array)$args, $event, $flag, $time_interval); return $timer_id; default : $fd_key = (int)$fd; $real_flag = $flag === self::EV_READ ? EV_READ | EV_PERSIST : EV_WRITE | EV_PERSIST; $event = event_new(); if (!event_set($event, $fd, $real_flag, $func, null)) { return false; } if (!event_base_set($event, $this->_eventBase)) { return false; } if (!event_add($event)) { return false; } $this->_allEvents[$fd_key][$flag] = $event; return true; } }
[ "public", "function", "add", "(", "$", "fd", ",", "$", "flag", ",", "$", "func", ",", "$", "args", "=", "array", "(", ")", ")", "{", "switch", "(", "$", "flag", ")", "{", "case", "self", "::", "EV_SIGNAL", ":", "$", "fd_key", "=", "(", "int", ...
{@inheritdoc}
[ "{" ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Libevent.php#L63-L122
train
Adds an event to the system
[ 30522, 2270, 3853, 5587, 1006, 1002, 1042, 2094, 1010, 1002, 5210, 1010, 1002, 4569, 2278, 1010, 1002, 12098, 5620, 1027, 9140, 1006, 1007, 1007, 1063, 6942, 1006, 1002, 5210, 1007, 1063, 2553, 2969, 1024, 1024, 23408, 1035, 4742, 1024, 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/API/DocumentationGenerator.php
DocumentationGenerator.checkDocumentation
public function checkDocumentation($moduleToCheck) { if (strpos($moduleToCheck, '@hide') == true) { $moduleToCheck = str_replace(strtok(strstr($moduleToCheck, '@hide'), "\n"), "", $moduleToCheck); } return $moduleToCheck; }
php
public function checkDocumentation($moduleToCheck) { if (strpos($moduleToCheck, '@hide') == true) { $moduleToCheck = str_replace(strtok(strstr($moduleToCheck, '@hide'), "\n"), "", $moduleToCheck); } return $moduleToCheck; }
[ "public", "function", "checkDocumentation", "(", "$", "moduleToCheck", ")", "{", "if", "(", "strpos", "(", "$", "moduleToCheck", ",", "'@hide'", ")", "==", "true", ")", "{", "$", "moduleToCheck", "=", "str_replace", "(", "strtok", "(", "strstr", "(", "$", ...
Check if documentation contains @hide annotation and deletes it @param $moduleToCheck @return mixed
[ "Check", "if", "documentation", "contains", "@hide", "annotation", "and", "deletes", "it" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DocumentationGenerator.php#L188-L194
train
Check module documentation
[ 30522, 2270, 3853, 4638, 3527, 24894, 19304, 1006, 1002, 11336, 3406, 5403, 3600, 1007, 1063, 2065, 1006, 2358, 14536, 2891, 1006, 1002, 11336, 3406, 5403, 3600, 1010, 1005, 1030, 5342, 1005, 1007, 1027, 1027, 2995, 1007, 1063, 1002, 11336,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Config.php
Zend_Config._loadFileErrorHandler
protected function _loadFileErrorHandler($errno, $errstr, $errfile, $errline) { if ($this->_loadFileErrorStr === null) { $this->_loadFileErrorStr = $errstr; } else { $this->_loadFileErrorStr .= (PHP_EOL . $errstr); } }
php
protected function _loadFileErrorHandler($errno, $errstr, $errfile, $errline) { if ($this->_loadFileErrorStr === null) { $this->_loadFileErrorStr = $errstr; } else { $this->_loadFileErrorStr .= (PHP_EOL . $errstr); } }
[ "protected", "function", "_loadFileErrorHandler", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ")", "{", "if", "(", "$", "this", "->", "_loadFileErrorStr", "===", "null", ")", "{", "$", "this", "->", "_loadFileErrorStr",...
Handle any errors from simplexml_load_file or parse_ini_file @param integer $errno @param string $errstr @param string $errfile @param integer $errline
[ "Handle", "any", "errors", "from", "simplexml_load_file", "or", "parse_ini_file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Config.php#L447-L454
train
Load file error handler
[ 30522, 5123, 3853, 1035, 7170, 8873, 10559, 18933, 25032, 5685, 3917, 1006, 1002, 9413, 19139, 1010, 1002, 9413, 12096, 2099, 1010, 1002, 9413, 12881, 9463, 1010, 1002, 9413, 19403, 2063, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 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...
octobercms/october
modules/system/ServiceProvider.php
ServiceProvider.registerLogging
protected function registerLogging() { Event::listen(\Illuminate\Log\Events\MessageLogged::class, function ($event) { if (EventLog::useLogging()) { EventLog::add($event->message, $event->level); } }); }
php
protected function registerLogging() { Event::listen(\Illuminate\Log\Events\MessageLogged::class, function ($event) { if (EventLog::useLogging()) { EventLog::add($event->message, $event->level); } }); }
[ "protected", "function", "registerLogging", "(", ")", "{", "Event", "::", "listen", "(", "\\", "Illuminate", "\\", "Log", "\\", "Events", "\\", "MessageLogged", "::", "class", ",", "function", "(", "$", "event", ")", "{", "if", "(", "EventLog", "::", "us...
/* Write all log events to the database
[ "/", "*", "Write", "all", "log", "events", "to", "the", "database" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/ServiceProvider.php#L263-L270
train
Register logging to the event logger
[ 30522, 5123, 3853, 4236, 21197, 4726, 1006, 1007, 1063, 2724, 1024, 1024, 4952, 1006, 1032, 5665, 12717, 12556, 1032, 8833, 1032, 2824, 1032, 4471, 21197, 5999, 1024, 1024, 2465, 1010, 3853, 1006, 1002, 2724, 1007, 1063, 2065, 1006, 2724, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/models/ImportModel.php
ImportModel.processImportRow
protected function processImportRow($rowData, $matches) { $newRow = []; foreach ($matches as $columnIndex => $dbNames) { $value = array_get($rowData, $columnIndex); foreach ((array) $dbNames as $dbName) { $newRow[$dbName] = $value; } } return $newRow; }
php
protected function processImportRow($rowData, $matches) { $newRow = []; foreach ($matches as $columnIndex => $dbNames) { $value = array_get($rowData, $columnIndex); foreach ((array) $dbNames as $dbName) { $newRow[$dbName] = $value; } } return $newRow; }
[ "protected", "function", "processImportRow", "(", "$", "rowData", ",", "$", "matches", ")", "{", "$", "newRow", "=", "[", "]", ";", "foreach", "(", "$", "matches", "as", "$", "columnIndex", "=>", "$", "dbNames", ")", "{", "$", "value", "=", "array_get"...
Converts a single row of CSV data to the column map. @return array
[ "Converts", "a", "single", "row", "of", "CSV", "data", "to", "the", "column", "map", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ImportModel.php#L157-L169
train
Process import row
[ 30522, 5123, 3853, 2832, 5714, 6442, 10524, 1006, 1002, 5216, 2850, 2696, 1010, 1002, 3503, 1007, 1063, 1002, 2047, 10524, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 3503, 2004, 1002, 5930, 22254, 10288, 1027, 1028, 1002, 16962, 18442...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Form.php
Form.get
public function get($name) { if (isset($this->children[$name])) { return $this->children[$name]; } throw new OutOfBoundsException(sprintf('Child "%s" does not exist.', $name)); }
php
public function get($name) { if (isset($this->children[$name])) { return $this->children[$name]; } throw new OutOfBoundsException(sprintf('Child "%s" does not exist.', $name)); }
[ "public", "function", "get", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "children", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "children", "[", "$", "name", "]", ";", "}", "throw", "new", "Ou...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L932-L939
train
Get a child by name
[ 30522, 2270, 3853, 2131, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 30524, 2171, 1033, 1025, 1065, 5466, 2047, 2041, 11253, 15494, 3366, 2595, 24422, 1006, 9043, 2546, 1006, 1005, 2775, 1000, 1003, 1055, 1000, 2515, 2025, 4839, 1012, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Table/Abstract.php
Zend_Db_Table_Abstract.delete
public function delete($where) { $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name; return $this->_db->delete($tableSpec, $where); }
php
public function delete($where) { $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name; return $this->_db->delete($tableSpec, $where); }
[ "public", "function", "delete", "(", "$", "where", ")", "{", "$", "tableSpec", "=", "(", "$", "this", "->", "_schema", "?", "$", "this", "->", "_schema", ".", "'.'", ":", "''", ")", ".", "$", "this", "->", "_name", ";", "return", "$", "this", "->...
Deletes existing rows. @param array|string $where SQL WHERE clause(s). @return int The number of rows deleted.
[ "Deletes", "existing", "rows", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L1181-L1185
train
Delete all records from the table
[ 30522, 2270, 3853, 3972, 12870, 1006, 1002, 2073, 1007, 1063, 1002, 7251, 5051, 2278, 1027, 1006, 1002, 2023, 1011, 1028, 1035, 8040, 28433, 1029, 1002, 2023, 1011, 1028, 1035, 8040, 28433, 1012, 1005, 1012, 1005, 1024, 1005, 1005, 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...
z-song/laravel-admin
src/Grid/Tools/BatchActions.php
BatchActions.add
public function add($title, BatchAction $action = null) { $id = $this->actions->count(); if (func_num_args() == 1) { $action = $title; $action->setId($id); } elseif (func_num_args() == 2) { $action->setId($id); $action->setTitle($title); } $this->actions->push($action); return $this; }
php
public function add($title, BatchAction $action = null) { $id = $this->actions->count(); if (func_num_args() == 1) { $action = $title; $action->setId($id); } elseif (func_num_args() == 2) { $action->setId($id); $action->setTitle($title); } $this->actions->push($action); return $this; }
[ "public", "function", "add", "(", "$", "title", ",", "BatchAction", "$", "action", "=", "null", ")", "{", "$", "id", "=", "$", "this", "->", "actions", "->", "count", "(", ")", ";", "if", "(", "func_num_args", "(", ")", "==", "1", ")", "{", "$", ...
Add a batch action. @param $title @param BatchAction|null $action @return $this
[ "Add", "a", "batch", "action", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/BatchActions.php#L79-L94
train
Add Batch Action
[ 30522, 2270, 3853, 5587, 1006, 1002, 2516, 1010, 14108, 18908, 3258, 1002, 2895, 1027, 19701, 1007, 1063, 1002, 8909, 1027, 1002, 2023, 1011, 1028, 4506, 1011, 1028, 4175, 1006, 1007, 1025, 2065, 1006, 4569, 2278, 1035, 16371, 2213, 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...
laravel/framework
src/Illuminate/Foundation/Application.php
Application.registerBaseServiceProviders
protected function registerBaseServiceProviders() { $this->register(new EventServiceProvider($this)); $this->register(new LogServiceProvider($this)); $this->register(new RoutingServiceProvider($this)); }
php
protected function registerBaseServiceProviders() { $this->register(new EventServiceProvider($this)); $this->register(new LogServiceProvider($this)); $this->register(new RoutingServiceProvider($this)); }
[ "protected", "function", "registerBaseServiceProviders", "(", ")", "{", "$", "this", "->", "register", "(", "new", "EventServiceProvider", "(", "$", "this", ")", ")", ";", "$", "this", "->", "register", "(", "new", "LogServiceProvider", "(", "$", "this", ")"...
Register all of the base service providers. @return void
[ "Register", "all", "of", "the", "base", "service", "providers", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Application.php#L190-L195
train
Register base service providers
[ 30522, 5123, 3853, 4236, 15058, 8043, 7903, 13699, 12298, 18688, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4236, 1006, 2047, 2824, 2121, 7903, 13699, 12298, 18688, 1006, 1002, 2023, 1007, 1007, 1025, 1002, 2023, 1011, 1028, 4236, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MediaLibrary.php
MediaLibrary.sortItemList
protected function sortItemList(&$itemList, $sortSettings) { $files = []; $folders = []; // Convert string $sortBy to array if (is_string($sortSettings)) { $sortSettings = [ 'by' => $sortSettings, 'direction' => self::SORT_DIRECTION_ASC, ]; } usort($itemList, function ($a, $b) use ($sortSettings) { $result = 0; switch ($sortSettings['by']) { case self::SORT_BY_TITLE: $result = strcasecmp($a->path, $b->path); break; case self::SORT_BY_SIZE: if ($a->size < $b->size) { $result = -1; } else { $result = $a->size > $b->size ? 1 : 0; } break; case self::SORT_BY_MODIFIED: if ($a->lastModified < $b->lastModified) { $result = -1; } else { $result = $a->lastModified > $b->lastModified ? 1 : 0; } break; } // Reverse the polarity of the result to direct sorting in a descending order instead if ($sortSettings['direction'] === self::SORT_DIRECTION_DESC) { $result = 0 - $result; } return $result; }); }
php
protected function sortItemList(&$itemList, $sortSettings) { $files = []; $folders = []; // Convert string $sortBy to array if (is_string($sortSettings)) { $sortSettings = [ 'by' => $sortSettings, 'direction' => self::SORT_DIRECTION_ASC, ]; } usort($itemList, function ($a, $b) use ($sortSettings) { $result = 0; switch ($sortSettings['by']) { case self::SORT_BY_TITLE: $result = strcasecmp($a->path, $b->path); break; case self::SORT_BY_SIZE: if ($a->size < $b->size) { $result = -1; } else { $result = $a->size > $b->size ? 1 : 0; } break; case self::SORT_BY_MODIFIED: if ($a->lastModified < $b->lastModified) { $result = -1; } else { $result = $a->lastModified > $b->lastModified ? 1 : 0; } break; } // Reverse the polarity of the result to direct sorting in a descending order instead if ($sortSettings['direction'] === self::SORT_DIRECTION_DESC) { $result = 0 - $result; } return $result; }); }
[ "protected", "function", "sortItemList", "(", "&", "$", "itemList", ",", "$", "sortSettings", ")", "{", "$", "files", "=", "[", "]", ";", "$", "folders", "=", "[", "]", ";", "// Convert string $sortBy to array", "if", "(", "is_string", "(", "$", "sortSetti...
Sorts the item list by title, size or last modified date. @param array $itemList Specifies the item list to sort. @param mixed $sortSettings Determines the sorting preference. Supported values are 'title', 'size', 'lastModified' (see SORT_BY_XXX class constants) or an associative array with a 'by' key and a 'direction' key: ['by' => SORT_BY_XXX, 'direction' => SORT_DIRECTION_XXX].
[ "Sorts", "the", "item", "list", "by", "title", "size", "or", "last", "modified", "date", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L685-L728
train
Sort item list by file size or title
[ 30522, 5123, 3853, 4066, 4221, 19968, 2923, 1006, 1004, 1002, 8875, 9863, 1010, 1002, 11901, 18319, 3070, 2015, 1007, 1063, 1002, 6764, 1027, 1031, 1033, 1025, 1002, 19622, 2015, 1027, 1031, 1033, 1025, 1013, 1013, 10463, 5164, 1002, 4066, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/Loader/CacheLoader.php
CacheLoader.load
public function load(TemplateReferenceInterface $template) { $key = hash('sha256', $template->getLogicalName()); $dir = $this->dir.\DIRECTORY_SEPARATOR.substr($key, 0, 2); $file = substr($key, 2).'.tpl'; $path = $dir.\DIRECTORY_SEPARATOR.$file; if (is_file($path)) { if (null !== $this->logger) { $this->logger->debug('Fetching template from cache.', ['name' => $template->get('name')]); } return new FileStorage($path); } if (false === $storage = $this->loader->load($template)) { return false; } $content = $storage->getContent(); if (!is_dir($dir) && !@mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf('Cache Loader was not able to create directory "%s"', $dir)); } file_put_contents($path, $content); if (null !== $this->logger) { $this->logger->debug('Storing template in cache.', ['name' => $template->get('name')]); } return new FileStorage($path); }
php
public function load(TemplateReferenceInterface $template) { $key = hash('sha256', $template->getLogicalName()); $dir = $this->dir.\DIRECTORY_SEPARATOR.substr($key, 0, 2); $file = substr($key, 2).'.tpl'; $path = $dir.\DIRECTORY_SEPARATOR.$file; if (is_file($path)) { if (null !== $this->logger) { $this->logger->debug('Fetching template from cache.', ['name' => $template->get('name')]); } return new FileStorage($path); } if (false === $storage = $this->loader->load($template)) { return false; } $content = $storage->getContent(); if (!is_dir($dir) && !@mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf('Cache Loader was not able to create directory "%s"', $dir)); } file_put_contents($path, $content); if (null !== $this->logger) { $this->logger->debug('Storing template in cache.', ['name' => $template->get('name')]); } return new FileStorage($path); }
[ "public", "function", "load", "(", "TemplateReferenceInterface", "$", "template", ")", "{", "$", "key", "=", "hash", "(", "'sha256'", ",", "$", "template", "->", "getLogicalName", "(", ")", ")", ";", "$", "dir", "=", "$", "this", "->", "dir", ".", "\\"...
Loads a template. @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise
[ "Loads", "a", "template", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Loader/CacheLoader.php#L47-L79
train
Load a template from cache
[ 30522, 2270, 3853, 7170, 1006, 23561, 2890, 25523, 18447, 2121, 12172, 1002, 23561, 1007, 1063, 1002, 3145, 1027, 23325, 1006, 1005, 21146, 17788, 2575, 1005, 1010, 1002, 23561, 1011, 1028, 2131, 9966, 18442, 1006, 1007, 1007, 1025, 1002, 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/DataTable/Renderer/Csv.php
Csv.render
public function render() { $str = $this->renderTable($this->table); if (empty($str)) { return self::NO_DATA_AVAILABLE; } $this->renderHeader(); $str = $this->convertToUnicode($str); return $str; }
php
public function render() { $str = $this->renderTable($this->table); if (empty($str)) { return self::NO_DATA_AVAILABLE; } $this->renderHeader(); $str = $this->convertToUnicode($str); return $str; }
[ "public", "function", "render", "(", ")", "{", "$", "str", "=", "$", "this", "->", "renderTable", "(", "$", "this", "->", "table", ")", ";", "if", "(", "empty", "(", "$", "str", ")", ")", "{", "return", "self", "::", "NO_DATA_AVAILABLE", ";", "}", ...
Computes the dataTable output and returns the string/binary @return string
[ "Computes", "the", "dataTable", "output", "and", "returns", "the", "string", "/", "binary" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Csv.php#L79-L90
train
Render the table and return the string
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 1002, 2358, 2099, 1027, 1002, 2023, 1011, 1028, 17552, 10880, 1006, 1002, 2023, 1011, 1028, 2795, 1007, 1025, 2065, 1006, 4064, 1006, 1002, 2358, 2099, 1007, 1007, 1063, 2709, 2969, 1024, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/RouteCollection.php
RouteCollection.addCollection
public function addCollection(self $collection) { // we need to remove all routes with the same names first because just replacing them // would not place the new route at the end of the merged array foreach ($collection->all() as $name => $route) { unset($this->routes[$name]); $this->routes[$name] = $route; } foreach ($collection->getResources() as $resource) { $this->addResource($resource); } }
php
public function addCollection(self $collection) { // we need to remove all routes with the same names first because just replacing them // would not place the new route at the end of the merged array foreach ($collection->all() as $name => $route) { unset($this->routes[$name]); $this->routes[$name] = $route; } foreach ($collection->getResources() as $resource) { $this->addResource($resource); } }
[ "public", "function", "addCollection", "(", "self", "$", "collection", ")", "{", "// we need to remove all routes with the same names first because just replacing them", "// would not place the new route at the end of the merged array", "foreach", "(", "$", "collection", "->", "all",...
Adds a route collection at the end of the current set by appending all routes of the added collection.
[ "Adds", "a", "route", "collection", "at", "the", "end", "of", "the", "current", "set", "by", "appending", "all", "routes", "of", "the", "added", "collection", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L120-L132
train
Add a route collection
[ 30522, 2270, 3853, 5587, 26895, 18491, 1006, 2969, 1002, 3074, 1007, 1063, 1013, 1013, 2057, 2342, 2000, 6366, 2035, 5847, 2007, 1996, 2168, 3415, 2034, 2138, 2074, 6419, 2068, 1013, 1013, 2052, 2025, 2173, 1996, 2047, 2799, 2012, 1996, 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
core/Columns/Dimension.php
Dimension.formatValue
public function formatValue($value, $idSite, Formatter $formatter) { switch ($this->type) { case Dimension::TYPE_BOOL: if (empty($value)) { return Piwik::translate('General_No'); } return Piwik::translate('General_Yes'); case Dimension::TYPE_ENUM: $values = $this->getEnumColumnValues(); if (isset($values[$value])) { return $values[$value]; } break; case Dimension::TYPE_MONEY: return $formatter->getPrettyMoney($value, $idSite); case Dimension::TYPE_FLOAT: return $formatter->getPrettyNumber((float) $value, $precision = 2); case Dimension::TYPE_NUMBER: return $formatter->getPrettyNumber($value); case Dimension::TYPE_DURATION_S: return $formatter->getPrettyTimeFromSeconds($value, $displayAsSentence = false); case Dimension::TYPE_DURATION_MS: return $formatter->getPrettyTimeFromSeconds($value, $displayAsSentence = true); case Dimension::TYPE_PERCENT: return $formatter->getPrettyPercentFromQuotient($value); case Dimension::TYPE_BYTE: return $formatter->getPrettySizeFromBytes($value); } return $value; }
php
public function formatValue($value, $idSite, Formatter $formatter) { switch ($this->type) { case Dimension::TYPE_BOOL: if (empty($value)) { return Piwik::translate('General_No'); } return Piwik::translate('General_Yes'); case Dimension::TYPE_ENUM: $values = $this->getEnumColumnValues(); if (isset($values[$value])) { return $values[$value]; } break; case Dimension::TYPE_MONEY: return $formatter->getPrettyMoney($value, $idSite); case Dimension::TYPE_FLOAT: return $formatter->getPrettyNumber((float) $value, $precision = 2); case Dimension::TYPE_NUMBER: return $formatter->getPrettyNumber($value); case Dimension::TYPE_DURATION_S: return $formatter->getPrettyTimeFromSeconds($value, $displayAsSentence = false); case Dimension::TYPE_DURATION_MS: return $formatter->getPrettyTimeFromSeconds($value, $displayAsSentence = true); case Dimension::TYPE_PERCENT: return $formatter->getPrettyPercentFromQuotient($value); case Dimension::TYPE_BYTE: return $formatter->getPrettySizeFromBytes($value); } return $value; }
[ "public", "function", "formatValue", "(", "$", "value", ",", "$", "idSite", ",", "Formatter", "$", "formatter", ")", "{", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "Dimension", "::", "TYPE_BOOL", ":", "if", "(", "empty", "(", "$", "...
Formats the dimension value. By default, the dimension is formatted based on the set dimension type. @param mixed $value @param int $idSite @param Formatter $formatter @return mixed @api since Piwik 3.2.0
[ "Formats", "the", "dimension", "value", ".", "By", "default", "the", "dimension", "is", "formatted", "based", "on", "the", "set", "dimension", "type", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/Dimension.php#L427-L459
train
Format Dimension Value
[ 30522, 2270, 3853, 4289, 10175, 5657, 1006, 1002, 3643, 1010, 1002, 8909, 28032, 2063, 1010, 4289, 3334, 1002, 4289, 3334, 1007, 1063, 6942, 1006, 1002, 2023, 1011, 1028, 2828, 1007, 1063, 2553, 9812, 1024, 1024, 2828, 1035, 22017, 2140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ValidatorBuilder.php
ValidatorBuilder.setMetadataCache
public function setMetadataCache(CacheInterface $cache) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot set a custom metadata cache after setting a custom metadata factory. Configure your metadata factory instead.'); } $this->metadataCache = $cache; return $this; }
php
public function setMetadataCache(CacheInterface $cache) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot set a custom metadata cache after setting a custom metadata factory. Configure your metadata factory instead.'); } $this->metadataCache = $cache; return $this; }
[ "public", "function", "setMetadataCache", "(", "CacheInterface", "$", "cache", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "metadataFactory", ")", "{", "throw", "new", "ValidatorException", "(", "'You cannot set a custom metadata cache after setting a custom ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/ValidatorBuilder.php#L235-L244
train
Set the custom metadata cache
[ 30522, 2270, 3853, 2275, 11368, 8447, 2696, 3540, 5403, 1006, 17053, 18447, 2121, 12172, 1002, 17053, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 27425, 21450, 1007, 1063, 5466, 2047, 9398, 8844, 10288, 24422, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Pdo/Abstract.php
Zend_Db_Adapter_Pdo_Abstract.setFetchMode
public function setFetchMode($mode) { //check for PDO extension if (!extension_loaded('pdo')) { /** * @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded'); } switch ($mode) { case PDO::FETCH_LAZY: case PDO::FETCH_ASSOC: case PDO::FETCH_NUM: case PDO::FETCH_BOTH: case PDO::FETCH_NAMED: case PDO::FETCH_OBJ: $this->_fetchMode = $mode; break; default: /** * @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("Invalid fetch mode '$mode' specified"); break; } }
php
public function setFetchMode($mode) { //check for PDO extension if (!extension_loaded('pdo')) { /** * @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded'); } switch ($mode) { case PDO::FETCH_LAZY: case PDO::FETCH_ASSOC: case PDO::FETCH_NUM: case PDO::FETCH_BOTH: case PDO::FETCH_NAMED: case PDO::FETCH_OBJ: $this->_fetchMode = $mode; break; default: /** * @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("Invalid fetch mode '$mode' specified"); break; } }
[ "public", "function", "setFetchMode", "(", "$", "mode", ")", "{", "//check for PDO extension", "if", "(", "!", "extension_loaded", "(", "'pdo'", ")", ")", "{", "/**\n * @see Zend_Db_Adapter_Exception\n */", "// require_once 'Zend/Db/Adapter/Exception.php...
Set the PDO fetch mode. @todo Support FETCH_CLASS and FETCH_INTO. @param int $mode A PDO fetch mode. @return void @throws Zend_Db_Adapter_Exception
[ "Set", "the", "PDO", "fetch", "mode", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Abstract.php#L334-L361
train
Set the fetch mode
[ 30522, 2270, 3853, 2275, 7959, 10649, 5302, 3207, 1006, 1002, 5549, 1007, 1063, 1013, 1013, 4638, 2005, 22851, 2080, 5331, 2065, 1006, 999, 5331, 1035, 8209, 1006, 1005, 22851, 2080, 1005, 1007, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 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
core/DataTable/Map.php
Map.copyRowsAndSetLabel
private function copyRowsAndSetLabel($toTable, $fromTable, $label) { foreach ($fromTable->getRows() as $fromRow) { $oldColumns = $fromRow->getColumns(); unset($oldColumns['label']); $columns = array_merge(array('label' => $label), $oldColumns); $row = new Row(array( Row::COLUMNS => $columns, Row::METADATA => $fromRow->getMetadata(), Row::DATATABLE_ASSOCIATED => $fromRow->getIdSubDataTable() )); $toTable->addRow($row); } }
php
private function copyRowsAndSetLabel($toTable, $fromTable, $label) { foreach ($fromTable->getRows() as $fromRow) { $oldColumns = $fromRow->getColumns(); unset($oldColumns['label']); $columns = array_merge(array('label' => $label), $oldColumns); $row = new Row(array( Row::COLUMNS => $columns, Row::METADATA => $fromRow->getMetadata(), Row::DATATABLE_ASSOCIATED => $fromRow->getIdSubDataTable() )); $toTable->addRow($row); } }
[ "private", "function", "copyRowsAndSetLabel", "(", "$", "toTable", ",", "$", "fromTable", ",", "$", "label", ")", "{", "foreach", "(", "$", "fromTable", "->", "getRows", "(", ")", "as", "$", "fromRow", ")", "{", "$", "oldColumns", "=", "$", "fromRow", ...
Utility function used by mergeChildren. Copies the rows from one table, sets their 'label' columns to a value and adds them to another table. @param DataTable $toTable The table to copy rows to. @param DataTable $fromTable The table to copy rows from. @param string $label The value to set the 'label' column of every copied row.
[ "Utility", "function", "used", "by", "mergeChildren", ".", "Copies", "the", "rows", "from", "one", "table", "sets", "their", "label", "columns", "to", "a", "value", "and", "adds", "them", "to", "another", "table", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Map.php#L435-L449
train
Copy rows and set label to table
[ 30522, 2797, 3853, 6100, 10524, 8791, 5104, 3388, 20470, 2884, 1006, 1002, 2000, 10880, 1010, 1002, 2013, 10880, 1010, 1002, 3830, 1007, 1063, 18921, 6776, 1006, 1002, 2013, 10880, 1011, 1028, 2131, 10524, 2015, 1006, 1007, 2004, 1002, 2013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Renderer/Array.php
HTML_QuickForm2_Renderer_Array.pushContainer
public function pushContainer(array $container) { if (!empty($container['required'])) { $this->hasRequired = true; } if (empty($this->containers)) { $this->array += $container; $this->containers = array(&$this->array['elements']); } else { $cntIndex = count($this->containers) - 1; $myIndex = count($this->containers[$cntIndex]); $this->containers[$cntIndex][$myIndex] = $container; $this->containers[$cntIndex + 1] =& $this->containers[$cntIndex][$myIndex]['elements']; } }
php
public function pushContainer(array $container) { if (!empty($container['required'])) { $this->hasRequired = true; } if (empty($this->containers)) { $this->array += $container; $this->containers = array(&$this->array['elements']); } else { $cntIndex = count($this->containers) - 1; $myIndex = count($this->containers[$cntIndex]); $this->containers[$cntIndex][$myIndex] = $container; $this->containers[$cntIndex + 1] =& $this->containers[$cntIndex][$myIndex]['elements']; } }
[ "public", "function", "pushContainer", "(", "array", "$", "container", ")", "{", "if", "(", "!", "empty", "(", "$", "container", "[", "'required'", "]", ")", ")", "{", "$", "this", "->", "hasRequired", "=", "true", ";", "}", "if", "(", "empty", "(", ...
Stores an array representing a Container in the form array @param array
[ "Stores", "an", "array", "representing", "a", "Container", "in", "the", "form", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Array.php#L264-L278
train
Pushes an array to the end of the array
[ 30522, 2270, 3853, 5245, 8663, 18249, 2121, 1006, 9140, 1002, 11661, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 11661, 1031, 1005, 3223, 1005, 1033, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 2038, 2890, 15549, 5596, 1027, 2995, 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...
octobercms/october
modules/system/console/ThemeInstall.php
ThemeInstall.handle
public function handle() { $themeName = $this->argument('name'); $argDirName = $this->argument('dirName'); if ($argDirName && $themeName == $argDirName) { $argDirName = null; } if ($argDirName) { if (!preg_match('/^[a-z0-9\_\-]+$/i', $argDirName)) { return $this->error('Invalid destination directory name.'); } if (Theme::exists($argDirName)) { return $this->error(sprintf('A theme named %s already exists.', $argDirName)); } } try { $themeManager = ThemeManager::instance(); $updateManager = UpdateManager::instance(); $themeDetails = $updateManager->requestThemeDetails($themeName); if ($themeManager->isInstalled($themeDetails['code'])) { return $this->error(sprintf('The theme %s is already installed.', $themeDetails['code'])); } if (Theme::exists($themeDetails['code'])) { return $this->error(sprintf('A theme named %s already exists.', $themeDetails['code'])); } $fields = ['Name', 'Description', 'Author', 'URL', '']; $this->info(sprintf( implode(': %s'.PHP_EOL, $fields), $themeDetails['code'], $themeDetails['description'], $themeDetails['author'], $themeDetails['product_url'] )); if (!$this->confirm('Do you wish to continue? [Y|n]', true)) { return; } $this->info('Downloading theme...'); $updateManager->downloadTheme($themeDetails['code'], $themeDetails['hash']); $this->info('Extracting theme...'); $updateManager->extractTheme($themeDetails['code'], $themeDetails['hash']); $dirName = $this->themeCodeToDir($themeDetails['code']); if ($argDirName) { /* * Move downloaded theme to a new directory. * Basically we're renaming it. */ File::move(themes_path().'/'.$dirName, themes_path().'/'.$argDirName); /* * Let's make sure to unflag the 'old' theme as * installed so it can be re-installed later. */ $themeManager->setUninstalled($themeDetails['code']); $dirName = $argDirName; } $this->info(sprintf('The theme %s has been installed. (now %s)', $themeDetails['code'], $dirName)); } catch (Exception $ex) { $this->error($ex->getMessage()); } }
php
public function handle() { $themeName = $this->argument('name'); $argDirName = $this->argument('dirName'); if ($argDirName && $themeName == $argDirName) { $argDirName = null; } if ($argDirName) { if (!preg_match('/^[a-z0-9\_\-]+$/i', $argDirName)) { return $this->error('Invalid destination directory name.'); } if (Theme::exists($argDirName)) { return $this->error(sprintf('A theme named %s already exists.', $argDirName)); } } try { $themeManager = ThemeManager::instance(); $updateManager = UpdateManager::instance(); $themeDetails = $updateManager->requestThemeDetails($themeName); if ($themeManager->isInstalled($themeDetails['code'])) { return $this->error(sprintf('The theme %s is already installed.', $themeDetails['code'])); } if (Theme::exists($themeDetails['code'])) { return $this->error(sprintf('A theme named %s already exists.', $themeDetails['code'])); } $fields = ['Name', 'Description', 'Author', 'URL', '']; $this->info(sprintf( implode(': %s'.PHP_EOL, $fields), $themeDetails['code'], $themeDetails['description'], $themeDetails['author'], $themeDetails['product_url'] )); if (!$this->confirm('Do you wish to continue? [Y|n]', true)) { return; } $this->info('Downloading theme...'); $updateManager->downloadTheme($themeDetails['code'], $themeDetails['hash']); $this->info('Extracting theme...'); $updateManager->extractTheme($themeDetails['code'], $themeDetails['hash']); $dirName = $this->themeCodeToDir($themeDetails['code']); if ($argDirName) { /* * Move downloaded theme to a new directory. * Basically we're renaming it. */ File::move(themes_path().'/'.$dirName, themes_path().'/'.$argDirName); /* * Let's make sure to unflag the 'old' theme as * installed so it can be re-installed later. */ $themeManager->setUninstalled($themeDetails['code']); $dirName = $argDirName; } $this->info(sprintf('The theme %s has been installed. (now %s)', $themeDetails['code'], $dirName)); } catch (Exception $ex) { $this->error($ex->getMessage()); } }
[ "public", "function", "handle", "(", ")", "{", "$", "themeName", "=", "$", "this", "->", "argument", "(", "'name'", ")", ";", "$", "argDirName", "=", "$", "this", "->", "argument", "(", "'dirName'", ")", ";", "if", "(", "$", "argDirName", "&&", "$", ...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/ThemeInstall.php#L37-L113
train
Handle theme request
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 4323, 18442, 1027, 1002, 2023, 1011, 1028, 6685, 1006, 1005, 2171, 1005, 1007, 1025, 1002, 12098, 2290, 4305, 12789, 4168, 1027, 1002, 2023, 1011, 1028, 6685, 1006, 1005, 16101, 18442, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/controllers/Files.php
Files.get
public function get($code = null) { try { return $this->findFileObject($code)->output('inline', true); } catch (Exception $ex) {} return Response::make(View::make('backend::404'), 404); }
php
public function get($code = null) { try { return $this->findFileObject($code)->output('inline', true); } catch (Exception $ex) {} return Response::make(View::make('backend::404'), 404); }
[ "public", "function", "get", "(", "$", "code", "=", "null", ")", "{", "try", "{", "return", "$", "this", "->", "findFileObject", "(", "$", "code", ")", "->", "output", "(", "'inline'", ",", "true", ")", ";", "}", "catch", "(", "Exception", "$", "ex...
Output file, or fall back on the 404 page
[ "Output", "file", "or", "fall", "back", "on", "the", "404", "page" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L26-L34
train
Get the content of a code
[ 30522, 2270, 3853, 2131, 1006, 1002, 3642, 1027, 19701, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 2424, 8873, 2571, 16429, 20614, 1006, 1002, 3642, 1007, 1011, 1028, 6434, 1006, 1005, 23881, 1005, 1010, 2995, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/Broadcasting/Client.php
Client.previewCard
public function previewCard(string $cardId, $reception, $method = self::PREVIEW_BY_OPENID) { return $this->previewMessage(new Card($cardId), $reception, $method); }
php
public function previewCard(string $cardId, $reception, $method = self::PREVIEW_BY_OPENID) { return $this->previewMessage(new Card($cardId), $reception, $method); }
[ "public", "function", "previewCard", "(", "string", "$", "cardId", ",", "$", "reception", ",", "$", "method", "=", "self", "::", "PREVIEW_BY_OPENID", ")", "{", "return", "$", "this", "->", "previewMessage", "(", "new", "Card", "(", "$", "cardId", ")", ",...
Preview a card message. @param mixed $cardId message @param string $reception @param string $method @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\RuntimeException @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Preview", "a", "card", "message", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L316-L319
train
Preview a card
[ 30522, 2270, 3853, 19236, 11522, 1006, 5164, 1002, 4003, 3593, 1010, 1002, 7684, 1010, 1002, 4118, 1027, 2969, 1024, 1024, 19236, 1035, 2011, 1035, 2330, 3593, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 19236, 7834, 3736, 3351, 1006, 2047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Data.php
Data.joinDefaults
public function joinDefaults($name, $value, $separator = '.') { if (\is_object($value)) { $value = (array) $value; } $old = $this->get($name, null, $separator); if ($old !== null) { $value = $this->blueprints()->mergeData($value, $old, $name, $separator); } $this->set($name, $value, $separator); return $this; }
php
public function joinDefaults($name, $value, $separator = '.') { if (\is_object($value)) { $value = (array) $value; } $old = $this->get($name, null, $separator); if ($old !== null) { $value = $this->blueprints()->mergeData($value, $old, $name, $separator); } $this->set($name, $value, $separator); return $this; }
[ "public", "function", "joinDefaults", "(", "$", "name", ",", "$", "value", ",", "$", "separator", "=", "'.'", ")", "{", "if", "(", "\\", "is_object", "(", "$", "value", ")", ")", "{", "$", "value", "=", "(", "array", ")", "$", "value", ";", "}", ...
Set default values by using blueprints. @param string $name Dot separated path to the requested value. @param mixed $value Value to be joined. @param string $separator Separator, defaults to '.' @return $this
[ "Set", "default", "values", "by", "using", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Data.php#L111-L125
train
Join default values with a separator
[ 30522, 2270, 3853, 3693, 3207, 7011, 11314, 2015, 1006, 1002, 2171, 1010, 1002, 3643, 1010, 1002, 19802, 25879, 2953, 1027, 1005, 1012, 1005, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 4874, 1006, 1002, 3643, 1007, 1007, 1063, 1002, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Renderer.php
Renderer.render
public function render(Frame $frame) { global $_dompdf_debug; $this->_check_callbacks("begin_frame", $frame); if ($_dompdf_debug) { echo $frame; flush(); } $style = $frame->get_style(); if (in_array($style->visibility, array("hidden", "collapse"))) { return; } $display = $style->display; // Starts the CSS transformation if ($style->transform && is_array($style->transform)) { $this->_canvas->save(); list($x, $y) = $frame->get_padding_box(); $origin = $style->transform_origin; foreach ($style->transform as $transform) { list($function, $values) = $transform; if ($function === "matrix") { $function = "transform"; } $values = array_map("floatval", $values); $values[] = $x + (float)$style->length_in_pt($origin[0], (float)$style->length_in_pt($style->width)); $values[] = $y + (float)$style->length_in_pt($origin[1], (float)$style->length_in_pt($style->height)); call_user_func_array(array($this->_canvas, $function), $values); } } switch ($display) { case "block": case "list-item": case "inline-block": case "table": case "inline-table": $this->_render_frame("block", $frame); break; case "inline": if ($frame->is_text_node()) { $this->_render_frame("text", $frame); } else { $this->_render_frame("inline", $frame); } break; case "table-cell": $this->_render_frame("table-cell", $frame); break; case "table-row-group": case "table-header-group": case "table-footer-group": $this->_render_frame("table-row-group", $frame); break; case "-dompdf-list-bullet": $this->_render_frame("list-bullet", $frame); break; case "-dompdf-image": $this->_render_frame("image", $frame); break; case "none": $node = $frame->get_node(); if ($node->nodeName === "script") { if ($node->getAttribute("type") === "text/php" || $node->getAttribute("language") === "php" ) { // Evaluate embedded php scripts $this->_render_frame("php", $frame); } elseif ($node->getAttribute("type") === "text/javascript" || $node->getAttribute("language") === "javascript" ) { // Insert JavaScript $this->_render_frame("javascript", $frame); } } // Don't render children, so skip to next iter return; default: break; } // Starts the overflow: hidden box if ($style->overflow === "hidden") { list($x, $y, $w, $h) = $frame->get_padding_box(); // get border radii $style = $frame->get_style(); list($tl, $tr, $br, $bl) = $style->get_computed_border_radius($w, $h); if ($tl + $tr + $br + $bl > 0) { $this->_canvas->clipping_roundrectangle($x, $y, (float)$w, (float)$h, $tl, $tr, $br, $bl); } else { $this->_canvas->clipping_rectangle($x, $y, (float)$w, (float)$h); } } $stack = array(); foreach ($frame->get_children() as $child) { // < 0 : nagative z-index // = 0 : no z-index, no stacking context // = 1 : stacking context without z-index // > 1 : z-index $child_style = $child->get_style(); $child_z_index = $child_style->z_index; $z_index = 0; if ($child_z_index !== "auto") { $z_index = intval($child_z_index) + 1; } elseif ($child_style->float !== "none" || $child->is_positionned()) { $z_index = 1; } $stack[$z_index][] = $child; } ksort($stack); foreach ($stack as $by_index) { foreach ($by_index as $child) { $this->render($child); } } // Ends the overflow: hidden box if ($style->overflow === "hidden") { $this->_canvas->clipping_end(); } if ($style->transform && is_array($style->transform)) { $this->_canvas->restore(); } // Check for end frame callback $this->_check_callbacks("end_frame", $frame); }
php
public function render(Frame $frame) { global $_dompdf_debug; $this->_check_callbacks("begin_frame", $frame); if ($_dompdf_debug) { echo $frame; flush(); } $style = $frame->get_style(); if (in_array($style->visibility, array("hidden", "collapse"))) { return; } $display = $style->display; // Starts the CSS transformation if ($style->transform && is_array($style->transform)) { $this->_canvas->save(); list($x, $y) = $frame->get_padding_box(); $origin = $style->transform_origin; foreach ($style->transform as $transform) { list($function, $values) = $transform; if ($function === "matrix") { $function = "transform"; } $values = array_map("floatval", $values); $values[] = $x + (float)$style->length_in_pt($origin[0], (float)$style->length_in_pt($style->width)); $values[] = $y + (float)$style->length_in_pt($origin[1], (float)$style->length_in_pt($style->height)); call_user_func_array(array($this->_canvas, $function), $values); } } switch ($display) { case "block": case "list-item": case "inline-block": case "table": case "inline-table": $this->_render_frame("block", $frame); break; case "inline": if ($frame->is_text_node()) { $this->_render_frame("text", $frame); } else { $this->_render_frame("inline", $frame); } break; case "table-cell": $this->_render_frame("table-cell", $frame); break; case "table-row-group": case "table-header-group": case "table-footer-group": $this->_render_frame("table-row-group", $frame); break; case "-dompdf-list-bullet": $this->_render_frame("list-bullet", $frame); break; case "-dompdf-image": $this->_render_frame("image", $frame); break; case "none": $node = $frame->get_node(); if ($node->nodeName === "script") { if ($node->getAttribute("type") === "text/php" || $node->getAttribute("language") === "php" ) { // Evaluate embedded php scripts $this->_render_frame("php", $frame); } elseif ($node->getAttribute("type") === "text/javascript" || $node->getAttribute("language") === "javascript" ) { // Insert JavaScript $this->_render_frame("javascript", $frame); } } // Don't render children, so skip to next iter return; default: break; } // Starts the overflow: hidden box if ($style->overflow === "hidden") { list($x, $y, $w, $h) = $frame->get_padding_box(); // get border radii $style = $frame->get_style(); list($tl, $tr, $br, $bl) = $style->get_computed_border_radius($w, $h); if ($tl + $tr + $br + $bl > 0) { $this->_canvas->clipping_roundrectangle($x, $y, (float)$w, (float)$h, $tl, $tr, $br, $bl); } else { $this->_canvas->clipping_rectangle($x, $y, (float)$w, (float)$h); } } $stack = array(); foreach ($frame->get_children() as $child) { // < 0 : nagative z-index // = 0 : no z-index, no stacking context // = 1 : stacking context without z-index // > 1 : z-index $child_style = $child->get_style(); $child_z_index = $child_style->z_index; $z_index = 0; if ($child_z_index !== "auto") { $z_index = intval($child_z_index) + 1; } elseif ($child_style->float !== "none" || $child->is_positionned()) { $z_index = 1; } $stack[$z_index][] = $child; } ksort($stack); foreach ($stack as $by_index) { foreach ($by_index as $child) { $this->render($child); } } // Ends the overflow: hidden box if ($style->overflow === "hidden") { $this->_canvas->clipping_end(); } if ($style->transform && is_array($style->transform)) { $this->_canvas->restore(); } // Check for end frame callback $this->_check_callbacks("end_frame", $frame); }
[ "public", "function", "render", "(", "Frame", "$", "frame", ")", "{", "global", "$", "_dompdf_debug", ";", "$", "this", "->", "_check_callbacks", "(", "\"begin_frame\"", ",", "$", "frame", ")", ";", "if", "(", "$", "_dompdf_debug", ")", "{", "echo", "$",...
Render frames recursively @param Frame $frame the frame to render
[ "Render", "frames", "recursively" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Renderer.php#L55-L209
train
Renders the frame
[ 30522, 2270, 3853, 17552, 1006, 4853, 1002, 4853, 1007, 1063, 3795, 1002, 1035, 14383, 17299, 2546, 1035, 2139, 8569, 2290, 1025, 1002, 2023, 1011, 1028, 1035, 4638, 1035, 2655, 12221, 1006, 1000, 4088, 1035, 4853, 1000, 1010, 1002, 4853, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/WidgetBase.php
WidgetBase.bindToController
public function bindToController() { if ($this->controller->widget === null) { $this->controller->widget = new stdClass; } $this->controller->widget->{$this->alias} = $this; }
php
public function bindToController() { if ($this->controller->widget === null) { $this->controller->widget = new stdClass; } $this->controller->widget->{$this->alias} = $this; }
[ "public", "function", "bindToController", "(", ")", "{", "if", "(", "$", "this", "->", "controller", "->", "widget", "===", "null", ")", "{", "$", "this", "->", "controller", "->", "widget", "=", "new", "stdClass", ";", "}", "$", "this", "->", "control...
Binds a widget to the controller for safe use. @return void
[ "Binds", "a", "widget", "to", "the", "controller", "for", "safe", "use", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/WidgetBase.php#L113-L120
train
Binds the widget to the controller
[ 30522, 2270, 3853, 14187, 3406, 8663, 13181, 10820, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 11486, 1011, 1028, 15536, 24291, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 11486, 1011, 1028, 15536, 24291, 1027, 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/LanguagesManager/API.php
API.uses12HourClockForUser
public function uses12HourClockForUser($login) { if ($login == 'anonymous') { return false; } Piwik::checkUserHasSuperUserAccessOrIsTheUser($login); $lang = $this->getModel()->uses12HourClock($login); return $lang; }
php
public function uses12HourClockForUser($login) { if ($login == 'anonymous') { return false; } Piwik::checkUserHasSuperUserAccessOrIsTheUser($login); $lang = $this->getModel()->uses12HourClock($login); return $lang; }
[ "public", "function", "uses12HourClockForUser", "(", "$", "login", ")", "{", "if", "(", "$", "login", "==", "'anonymous'", ")", "{", "return", "false", ";", "}", "Piwik", "::", "checkUserHasSuperUserAccessOrIsTheUser", "(", "$", "login", ")", ";", "$", "lang...
Returns whether the user uses 12 hour clock @param string $login @return string
[ "Returns", "whether", "the", "user", "uses", "12", "hour", "clock" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/API.php#L318-L329
train
Returns true if the user uses 12h time clock for the current language
[ 30522, 2270, 3853, 3594, 12521, 6806, 3126, 20464, 7432, 29278, 20330, 1006, 1002, 8833, 2378, 1007, 1063, 2065, 1006, 1002, 8833, 2378, 1027, 1027, 1005, 10812, 1005, 1007, 1063, 2709, 6270, 1025, 1065, 14255, 9148, 2243, 1024, 1024, 4638,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
PHPMailer/PHPMailer
src/PHPMailer.php
PHPMailer.smtpClose
public function smtpClose() { if (null !== $this->smtp) { if ($this->smtp->connected()) { $this->smtp->quit(); $this->smtp->close(); } } }
php
public function smtpClose() { if (null !== $this->smtp) { if ($this->smtp->connected()) { $this->smtp->quit(); $this->smtp->close(); } } }
[ "public", "function", "smtpClose", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "smtp", ")", "{", "if", "(", "$", "this", "->", "smtp", "->", "connected", "(", ")", ")", "{", "$", "this", "->", "smtp", "->", "quit", "(", ")", ";"...
Close the active SMTP session if one exists.
[ "Close", "the", "active", "SMTP", "session", "if", "one", "exists", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L2009-L2017
train
Close SMTP connection
[ 30522, 2270, 3853, 15488, 25856, 20464, 9232, 1006, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 15488, 25856, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 15488, 25856, 1011, 1028, 4198, 1006, 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...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php
HidesAttributes.makeHidden
public function makeHidden($attributes) { $attributes = (array) $attributes; $this->visible = array_diff($this->visible, $attributes); $this->hidden = array_unique(array_merge($this->hidden, $attributes)); return $this; }
php
public function makeHidden($attributes) { $attributes = (array) $attributes; $this->visible = array_diff($this->visible, $attributes); $this->hidden = array_unique(array_merge($this->hidden, $attributes)); return $this; }
[ "public", "function", "makeHidden", "(", "$", "attributes", ")", "{", "$", "attributes", "=", "(", "array", ")", "$", "attributes", ";", "$", "this", "->", "visible", "=", "array_diff", "(", "$", "this", "->", "visible", ",", "$", "attributes", ")", ";...
Make the given, typically visible, attributes hidden. @param array|string $attributes @return $this
[ "Make", "the", "given", "typically", "visible", "attributes", "hidden", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php#L116-L125
train
Make the attributes hidden
[ 30522, 2270, 3853, 2191, 27511, 4181, 1006, 1002, 12332, 1007, 1063, 1002, 12332, 1027, 1006, 9140, 1007, 1002, 12332, 1025, 1002, 2023, 1011, 1028, 5710, 1027, 9140, 1035, 4487, 4246, 1006, 1002, 2023, 1011, 1028, 5710, 1010, 1002, 12332, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HtmlDumper.php
HtmlDumper.setStyles
public function setStyles(array $styles) { $this->headerIsDumped = false; $this->styles = $styles + $this->styles; }
php
public function setStyles(array $styles) { $this->headerIsDumped = false; $this->styles = $styles + $this->styles; }
[ "public", "function", "setStyles", "(", "array", "$", "styles", ")", "{", "$", "this", "->", "headerIsDumped", "=", "false", ";", "$", "this", "->", "styles", "=", "$", "styles", "+", "$", "this", "->", "styles", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php#L91-L95
train
Set the styles of the page
[ 30522, 2270, 3853, 4520, 27983, 2015, 1006, 9140, 1002, 6782, 1007, 1063, 1002, 2023, 1011, 1028, 20346, 2483, 8566, 8737, 2098, 1027, 6270, 1025, 1002, 2023, 1011, 1028, 6782, 1027, 1002, 6782, 1009, 1002, 2023, 1011, 1028, 6782, 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...
laravel/framework
src/Illuminate/Routing/UrlGenerator.php
UrlGenerator.routeUrl
protected function routeUrl() { if (! $this->routeGenerator) { $this->routeGenerator = new RouteUrlGenerator($this, $this->request); } return $this->routeGenerator; }
php
protected function routeUrl() { if (! $this->routeGenerator) { $this->routeGenerator = new RouteUrlGenerator($this, $this->request); } return $this->routeGenerator; }
[ "protected", "function", "routeUrl", "(", ")", "{", "if", "(", "!", "$", "this", "->", "routeGenerator", ")", "{", "$", "this", "->", "routeGenerator", "=", "new", "RouteUrlGenerator", "(", "$", "this", ",", "$", "this", "->", "request", ")", ";", "}",...
Get the Route URL generator instance. @return \Illuminate\Routing\RouteUrlGenerator
[ "Get", "the", "Route", "URL", "generator", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L548-L555
train
Get Route Url Generator
[ 30522, 5123, 3853, 2799, 3126, 2140, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2799, 6914, 6906, 4263, 1007, 1063, 1002, 2023, 1011, 1028, 2799, 6914, 6906, 4263, 1027, 2047, 2799, 3126, 28875, 3678, 8844, 1006, 1002, 202...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...