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
symfony/symfony
src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php
SessionTokenStorage.clear
public function clear() { foreach (array_keys($this->session->all()) as $key) { if (0 === strpos($key, $this->namespace.'/')) { $this->session->remove($key); } } }
php
public function clear() { foreach (array_keys($this->session->all()) as $key) { if (0 === strpos($key, $this->namespace.'/')) { $this->session->remove($key); } } }
[ "public", "function", "clear", "(", ")", "{", "foreach", "(", "array_keys", "(", "$", "this", "->", "session", "->", "all", "(", ")", ")", "as", "$", "key", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "key", ",", "$", "this", "->", "na...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php#L99-L106
train
Clear all session data
[ 30522, 2270, 3853, 3154, 1006, 1007, 1063, 18921, 6776, 1006, 9140, 1035, 6309, 1006, 1002, 2023, 1011, 1028, 5219, 1011, 1028, 2035, 1006, 1007, 1007, 2004, 1002, 3145, 1007, 1063, 2065, 1006, 30524, 1005, 1007, 1007, 1063, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Helpers/LogViewer.php
LogViewer.parse
public function parse($line) { if( !is_string($line) || strlen($line) === 0) { return array(); } preg_match($this->pattern, $line, $data); if (!isset($data['date'])) { return array(); } preg_match('/(.*)- Trace:(.*)/', $data['message'], $matches); if (is_array($matches) && isset($matches[1])) { $data['message'] = trim($matches[1]); $data['trace'] = trim($matches[2]); } return array( 'date' => \DateTime::createFromFormat('Y-m-d H:i:s', $data['date']), 'logger' => $data['logger'], 'level' => $data['level'], 'message' => $data['message'], 'trace' => isset($data['trace']) ? $this->parseTrace($data['trace']) : null, 'context' => json_decode($data['context'], true), 'extra' => json_decode($data['extra'], true) ); }
php
public function parse($line) { if( !is_string($line) || strlen($line) === 0) { return array(); } preg_match($this->pattern, $line, $data); if (!isset($data['date'])) { return array(); } preg_match('/(.*)- Trace:(.*)/', $data['message'], $matches); if (is_array($matches) && isset($matches[1])) { $data['message'] = trim($matches[1]); $data['trace'] = trim($matches[2]); } return array( 'date' => \DateTime::createFromFormat('Y-m-d H:i:s', $data['date']), 'logger' => $data['logger'], 'level' => $data['level'], 'message' => $data['message'], 'trace' => isset($data['trace']) ? $this->parseTrace($data['trace']) : null, 'context' => json_decode($data['context'], true), 'extra' => json_decode($data['extra'], true) ); }
[ "public", "function", "parse", "(", "$", "line", ")", "{", "if", "(", "!", "is_string", "(", "$", "line", ")", "||", "strlen", "(", "$", "line", ")", "===", "0", ")", "{", "return", "array", "(", ")", ";", "}", "preg_match", "(", "$", "this", "...
Parse a monolog row into array bits @param string $line @return array
[ "Parse", "a", "monolog", "row", "into", "array", "bits" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L109-L134
train
Parse the line into an array
[ 30522, 2270, 3853, 11968, 3366, 1006, 1002, 2240, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 2240, 1007, 1064, 1064, 2358, 20927, 2078, 1006, 1002, 2240, 1007, 1027, 1027, 1027, 1014, 1007, 1063, 2709, 9140, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php
ArgumentMetadataFactory.getType
private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function) { if (!$type = $parameter->getType()) { return; } $name = $type->getName(); $lcName = strtolower($name); if ('self' !== $lcName && 'parent' !== $lcName) { return $name; } if (!$function instanceof \ReflectionMethod) { return; } if ('self' === $lcName) { return $function->getDeclaringClass()->name; } if ($parent = $function->getDeclaringClass()->getParentClass()) { return $parent->name; } }
php
private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function) { if (!$type = $parameter->getType()) { return; } $name = $type->getName(); $lcName = strtolower($name); if ('self' !== $lcName && 'parent' !== $lcName) { return $name; } if (!$function instanceof \ReflectionMethod) { return; } if ('self' === $lcName) { return $function->getDeclaringClass()->name; } if ($parent = $function->getDeclaringClass()->getParentClass()) { return $parent->name; } }
[ "private", "function", "getType", "(", "\\", "ReflectionParameter", "$", "parameter", ",", "\\", "ReflectionFunctionAbstract", "$", "function", ")", "{", "if", "(", "!", "$", "type", "=", "$", "parameter", "->", "getType", "(", ")", ")", "{", "return", ";"...
Returns an associated type to the given parameter if available. @param \ReflectionParameter $parameter @return string|null
[ "Returns", "an", "associated", "type", "to", "the", "given", "parameter", "if", "available", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php#L50-L70
train
Get type of parameter
[ 30522, 2797, 3853, 2131, 13874, 1006, 1032, 9185, 28689, 22828, 30524, 2709, 1025, 1065, 1002, 2171, 1027, 1002, 2828, 1011, 1028, 2131, 18442, 1006, 1007, 1025, 1002, 29215, 18442, 1027, 2358, 5339, 12898, 13777, 1006, 1002, 2171, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/RoutingExtension.php
RoutingExtension.getPath
public function getPath($name, $parameters = [], $relative = false) { return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); }
php
public function getPath($name, $parameters = [], $relative = false) { return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); }
[ "public", "function", "getPath", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "relative", "=", "false", ")", "{", "return", "$", "this", "->", "generator", "->", "generate", "(", "$", "name", ",", "$", "parameters", ",", "$", ...
@param string $name @param array $parameters @param bool $relative @return string
[ "@param", "string", "$name", "@param", "array", "$parameters", "@param", "bool", "$relative" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php#L55-L58
train
Returns a path for the given name
[ 30522, 2270, 3853, 2131, 15069, 1006, 1002, 2171, 1010, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 5816, 1027, 6270, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 13103, 1011, 1028, 9699, 1006, 1002, 2171, 1010, 1002, 11709, 1010, 1002, 5816, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Smtp.php
Zend_Mail_Transport_Smtp._sendMail
public function _sendMail() { // If sending multiple messages per session use existing adapter if (!($this->_connection instanceof Zend_Mail_Protocol_Smtp)) { // Check if authentication is required and determine required class $connectionClass = 'Zend_Mail_Protocol_Smtp'; if ($this->_auth) { $connectionClass .= '_Auth_' . ucwords($this->_auth); } if (!class_exists($connectionClass)) { // require_once 'Zend/Loader.php'; Zend_Loader::loadClass($connectionClass); } $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config)); $this->_connection->connect(); $this->_connection->helo($this->_name); } else { // Reset connection to ensure reliable transaction $this->_connection->rset(); } // Set sender email address $this->_connection->mail($this->_mail->getReturnPath()); // Set recipient forward paths foreach ($this->_mail->getRecipients() as $recipient) { $this->_connection->rcpt($recipient); } // Issue DATA command to client $this->_connection->data($this->header . Zend_Mime::LINEEND . $this->body); }
php
public function _sendMail() { // If sending multiple messages per session use existing adapter if (!($this->_connection instanceof Zend_Mail_Protocol_Smtp)) { // Check if authentication is required and determine required class $connectionClass = 'Zend_Mail_Protocol_Smtp'; if ($this->_auth) { $connectionClass .= '_Auth_' . ucwords($this->_auth); } if (!class_exists($connectionClass)) { // require_once 'Zend/Loader.php'; Zend_Loader::loadClass($connectionClass); } $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config)); $this->_connection->connect(); $this->_connection->helo($this->_name); } else { // Reset connection to ensure reliable transaction $this->_connection->rset(); } // Set sender email address $this->_connection->mail($this->_mail->getReturnPath()); // Set recipient forward paths foreach ($this->_mail->getRecipients() as $recipient) { $this->_connection->rcpt($recipient); } // Issue DATA command to client $this->_connection->data($this->header . Zend_Mime::LINEEND . $this->body); }
[ "public", "function", "_sendMail", "(", ")", "{", "// If sending multiple messages per session use existing adapter", "if", "(", "!", "(", "$", "this", "->", "_connection", "instanceof", "Zend_Mail_Protocol_Smtp", ")", ")", "{", "// Check if authentication is required and det...
Send an email via the SMTP connection protocol The connection via the protocol adapter is made just-in-time to allow a developer to add a custom adapter if required before mail is sent. @return void @todo Rename this to sendMail, it's a public method...
[ "Send", "an", "email", "via", "the", "SMTP", "connection", "protocol" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Transport/Smtp.php#L185-L216
train
Send the message to the server
[ 30522, 2270, 3853, 1035, 4604, 21397, 1006, 1007, 1063, 1013, 1013, 2065, 6016, 3674, 7696, 2566, 5219, 2224, 4493, 15581, 2121, 2065, 1006, 999, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 6013, 11253, 16729, 2094, 1035, 5653, 1035, 8778, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CustomPiwikJs/API.php
API.doesIncludePluginTrackersAutomatically
public function doesIncludePluginTrackersAutomatically() { Piwik::checkUserHasSomeAdminAccess(); try { $updater = StaticContainer::get('Piwik\Plugins\CustomPiwikJs\TrackerUpdater'); $updater->checkWillSucceed(); return true; } catch (AccessDeniedException $e) { return false; } catch (\Exception $e) { return false; } }
php
public function doesIncludePluginTrackersAutomatically() { Piwik::checkUserHasSomeAdminAccess(); try { $updater = StaticContainer::get('Piwik\Plugins\CustomPiwikJs\TrackerUpdater'); $updater->checkWillSucceed(); return true; } catch (AccessDeniedException $e) { return false; } catch (\Exception $e) { return false; } }
[ "public", "function", "doesIncludePluginTrackersAutomatically", "(", ")", "{", "Piwik", "::", "checkUserHasSomeAdminAccess", "(", ")", ";", "try", "{", "$", "updater", "=", "StaticContainer", "::", "get", "(", "'Piwik\\Plugins\\CustomPiwikJs\\TrackerUpdater'", ")", ";",...
Detects whether plugin trackers will be automatically added to piwik.js or not. If not, the plugin tracker files need to be loaded manually. @return bool
[ "Detects", "whether", "plugin", "trackers", "will", "be", "automatically", "added", "to", "piwik", ".", "js", "or", "not", ".", "If", "not", "the", "plugin", "tracker", "files", "need", "to", "be", "loaded", "manually", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CustomPiwikJs/API.php#L27-L40
train
Returns true if the plugin trackers automatically should be included in the page.
[ 30522, 2270, 3853, 2515, 2378, 20464, 12672, 24759, 15916, 18447, 22648, 11451, 4887, 20389, 12070, 3973, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 14045, 4215, 22311, 9468, 7971, 1006, 1007, 1025, 3046, 1063, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.getCurrentRoute
public static function getCurrentRoute() { if (!static::$currentRoute) { $uri = Grav::instance()['uri']; static::$currentRoute = RouteFactory::createFromParts($uri->toArray()); } return static::$currentRoute; }
php
public static function getCurrentRoute() { if (!static::$currentRoute) { $uri = Grav::instance()['uri']; static::$currentRoute = RouteFactory::createFromParts($uri->toArray()); } return static::$currentRoute; }
[ "public", "static", "function", "getCurrentRoute", "(", ")", "{", "if", "(", "!", "static", "::", "$", "currentRoute", ")", "{", "$", "uri", "=", "Grav", "::", "instance", "(", ")", "[", "'uri'", "]", ";", "static", "::", "$", "currentRoute", "=", "R...
Returns current route. @return \Grav\Framework\Route\Route
[ "Returns", "current", "route", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L668-L676
train
Get current route
[ 30522, 2270, 10763, 3853, 2131, 10841, 14343, 3372, 22494, 2618, 1006, 1007, 1063, 2065, 1006, 999, 10763, 1024, 1024, 1002, 2783, 22494, 2618, 1007, 1063, 1002, 24471, 2072, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 244...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Sqlsrv.php
Zend_Db_Adapter_Sqlsrv.limit
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); } if ($offset == 0) { $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $count . ' ', $sql); } else { $orderby = stristr($sql, 'ORDER BY'); if (!$orderby) { $over = 'ORDER BY (SELECT 0)'; } else { $over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby); } // Remove ORDER BY clause from $sql $sql = preg_replace('/\s+ORDER BY(.*)/', '', $sql); // Add ORDER BY clause as an argument for ROW_NUMBER() $sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl"; $start = $offset + 1; $end = $offset + $count; $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end"; } return $sql; }
php
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); } if ($offset == 0) { $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $count . ' ', $sql); } else { $orderby = stristr($sql, 'ORDER BY'); if (!$orderby) { $over = 'ORDER BY (SELECT 0)'; } else { $over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby); } // Remove ORDER BY clause from $sql $sql = preg_replace('/\s+ORDER BY(.*)/', '', $sql); // Add ORDER BY clause as an argument for ROW_NUMBER() $sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl"; $start = $offset + 1; $end = $offset + $count; $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end"; } return $sql; }
[ "public", "function", "limit", "(", "$", "sql", ",", "$", "count", ",", "$", "offset", "=", "0", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "<=", "0", ")", "{", "// require_once 'Zend/Db/Adapter/Excep...
Adds an adapter-specific LIMIT clause to the SELECT statement. @param string $sql @param integer $count @param integer $offset OPTIONAL @return string @throws Zend_Db_Adapter_Sqlsrv_Exception
[ "Adds", "an", "adapter", "-", "specific", "LIMIT", "clause", "to", "the", "SELECT", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Sqlsrv.php#L600-L639
train
Limit the number of records in the table
[ 30522, 2270, 3853, 5787, 1006, 1002, 29296, 1010, 1002, 4175, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1002, 4175, 1027, 20014, 10175, 1006, 1002, 4175, 1007, 1025, 2065, 1006, 1002, 4175, 1026, 1027, 1014, 1007, 1063, 1013, 1013, 5478, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/FormConfigBuilder.php
FormConfigBuilder.setMapped
public function setMapped($mapped) { if ($this->locked) { throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } $this->mapped = (bool) $mapped; return $this; }
php
public function setMapped($mapped) { if ($this->locked) { throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } $this->mapped = (bool) $mapped; return $this; }
[ "public", "function", "setMapped", "(", "$", "mapped", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "BadMethodCallException", "(", "'FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface insta...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormConfigBuilder.php#L586-L595
train
Set whether the form is mapped or not
[ 30522, 2270, 3853, 2275, 2863, 11469, 1006, 1002, 17715, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 2919, 11368, 6806, 16409, 24164, 2595, 24422, 1006, 1005, 2433, 8663, 8873, 18259, 19231, 4063, 4725, 368...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.php
Zend_Mail.setBodyText
public function setBodyText($txt, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE) { if ($charset === null) { $charset = $this->_charset; } $mp = new Zend_Mime_Part($txt); $mp->encoding = $encoding; $mp->type = Zend_Mime::TYPE_TEXT; $mp->disposition = Zend_Mime::DISPOSITION_INLINE; $mp->charset = $charset; $this->_bodyText = $mp; return $this; }
php
public function setBodyText($txt, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE) { if ($charset === null) { $charset = $this->_charset; } $mp = new Zend_Mime_Part($txt); $mp->encoding = $encoding; $mp->type = Zend_Mime::TYPE_TEXT; $mp->disposition = Zend_Mime::DISPOSITION_INLINE; $mp->charset = $charset; $this->_bodyText = $mp; return $this; }
[ "public", "function", "setBodyText", "(", "$", "txt", ",", "$", "charset", "=", "null", ",", "$", "encoding", "=", "Zend_Mime", "::", "ENCODING_QUOTEDPRINTABLE", ")", "{", "if", "(", "$", "charset", "===", "null", ")", "{", "$", "charset", "=", "$", "t...
Sets the text body for the message. @param string $txt @param string $charset @param string $encoding @return Zend_Mail Provides fluent interface
[ "Sets", "the", "text", "body", "for", "the", "message", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L361-L376
train
Set the body text part of the message
[ 30522, 2270, 3853, 2275, 23684, 18209, 1006, 1002, 19067, 2102, 1010, 1002, 25869, 13462, 1027, 19701, 1010, 1002, 17181, 1027, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 17181, 1035, 9339, 16550, 3085, 1007, 1063, 2065, 1006, 1002, 25869, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Repository.php
Repository.set
public function set($key, $value, $ttl = null) { return $this->put($key, $value, $ttl); }
php
public function set($key, $value, $ttl = null) { return $this->put($key, $value, $ttl); }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", "=", "null", ")", "{", "return", "$", "this", "->", "put", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Repository.php#L227-L230
train
Put a value into the cache
[ 30522, 2270, 3853, 2275, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 23746, 2140, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2404, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 23746, 2140, 1007, 1025, 1065, 102, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Installer.php
Installer.lastErrorMsg
public static function lastErrorMsg() { if (is_string(self::$error)) { return self::$error; } switch (self::$error) { case 0: $msg = 'No Error'; break; case self::EXISTS: $msg = 'The target path "' . self::$target . '" already exists'; break; case self::IS_LINK: $msg = 'The target path "' . self::$target . '" is a symbolic link'; break; case self::NOT_FOUND: $msg = 'The target path "' . self::$target . '" does not appear to exist'; break; case self::NOT_DIRECTORY: $msg = 'The target path "' . self::$target . '" does not appear to be a folder'; break; case self::NOT_GRAV_ROOT: $msg = 'The target path "' . self::$target . '" does not appear to be a Grav instance'; break; case self::ZIP_OPEN_ERROR: $msg = 'Unable to open the package file'; break; case self::ZIP_EXTRACT_ERROR: $msg = 'Unable to extract the package. '; if (self::$error_zip) { switch(self::$error_zip) { case \ZipArchive::ER_EXISTS: $msg .= 'File already exists.'; break; case \ZipArchive::ER_INCONS: $msg .= 'Zip archive inconsistent.'; break; case \ZipArchive::ER_MEMORY: $msg .= 'Memory allocation failure.'; break; case \ZipArchive::ER_NOENT: $msg .= 'No such file.'; break; case \ZipArchive::ER_NOZIP: $msg .= 'Not a zip archive.'; break; case \ZipArchive::ER_OPEN: $msg .= "Can't open file."; break; case \ZipArchive::ER_READ: $msg .= 'Read error.'; break; case \ZipArchive::ER_SEEK: $msg .= 'Seek error.'; break; } } break; case self::INVALID_SOURCE: $msg = 'Invalid source file'; break; default: $msg = 'Unknown Error'; break; } return $msg; }
php
public static function lastErrorMsg() { if (is_string(self::$error)) { return self::$error; } switch (self::$error) { case 0: $msg = 'No Error'; break; case self::EXISTS: $msg = 'The target path "' . self::$target . '" already exists'; break; case self::IS_LINK: $msg = 'The target path "' . self::$target . '" is a symbolic link'; break; case self::NOT_FOUND: $msg = 'The target path "' . self::$target . '" does not appear to exist'; break; case self::NOT_DIRECTORY: $msg = 'The target path "' . self::$target . '" does not appear to be a folder'; break; case self::NOT_GRAV_ROOT: $msg = 'The target path "' . self::$target . '" does not appear to be a Grav instance'; break; case self::ZIP_OPEN_ERROR: $msg = 'Unable to open the package file'; break; case self::ZIP_EXTRACT_ERROR: $msg = 'Unable to extract the package. '; if (self::$error_zip) { switch(self::$error_zip) { case \ZipArchive::ER_EXISTS: $msg .= 'File already exists.'; break; case \ZipArchive::ER_INCONS: $msg .= 'Zip archive inconsistent.'; break; case \ZipArchive::ER_MEMORY: $msg .= 'Memory allocation failure.'; break; case \ZipArchive::ER_NOENT: $msg .= 'No such file.'; break; case \ZipArchive::ER_NOZIP: $msg .= 'Not a zip archive.'; break; case \ZipArchive::ER_OPEN: $msg .= "Can't open file."; break; case \ZipArchive::ER_READ: $msg .= 'Read error.'; break; case \ZipArchive::ER_SEEK: $msg .= 'Seek error.'; break; } } break; case self::INVALID_SOURCE: $msg = 'Invalid source file'; break; default: $msg = 'Unknown Error'; break; } return $msg; }
[ "public", "static", "function", "lastErrorMsg", "(", ")", "{", "if", "(", "is_string", "(", "self", "::", "$", "error", ")", ")", "{", "return", "self", "::", "$", "error", ";", "}", "switch", "(", "self", "::", "$", "error", ")", "{", "case", "0",...
Returns the last error occurred in a string message format @return string The message of the last error
[ "Returns", "the", "last", "error", "occurred", "in", "a", "string", "message", "format" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Installer.php#L438-L522
train
Return the last error message
[ 30522, 2270, 10763, 3853, 2197, 2121, 29165, 5244, 2290, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 2969, 1024, 1024, 1002, 7561, 1007, 1007, 1063, 2709, 2969, 1024, 1024, 1002, 7561, 1025, 1065, 6942, 1006, 2969, 1024, 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...
laravel/framework
src/Illuminate/Cache/DynamoDbStore.php
DynamoDbStore.put
public function put($key, $value, $seconds) { $this->dynamo->putItem([ 'TableName' => $this->table, 'Item' => [ $this->keyAttribute => [ 'S' => $this->prefix.$key, ], $this->valueAttribute => [ $this->type($value) => $this->serialize($value), ], $this->expirationAttribute => [ 'N' => (string) $this->toTimestamp($seconds), ], ], ]); return true; }
php
public function put($key, $value, $seconds) { $this->dynamo->putItem([ 'TableName' => $this->table, 'Item' => [ $this->keyAttribute => [ 'S' => $this->prefix.$key, ], $this->valueAttribute => [ $this->type($value) => $this->serialize($value), ], $this->expirationAttribute => [ 'N' => (string) $this->toTimestamp($seconds), ], ], ]); return true; }
[ "public", "function", "put", "(", "$", "key", ",", "$", "value", ",", "$", "seconds", ")", "{", "$", "this", "->", "dynamo", "->", "putItem", "(", "[", "'TableName'", "=>", "$", "this", "->", "table", ",", "'Item'", "=>", "[", "$", "this", "->", ...
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/DynamoDbStore.php#L192-L210
train
Put an item to the cache
[ 30522, 2270, 3853, 2404, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 3823, 1007, 1063, 1002, 2023, 1011, 1028, 17205, 1011, 1028, 2404, 4221, 2213, 1006, 1031, 1005, 2795, 18442, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 2795, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
build/Burgomaster.php
Burgomaster.recursiveCopy
public function recursiveCopy( $sourceDir, $destDir, $extensions = array('php') ) { if (!realpath($sourceDir)) { throw new \InvalidArgumentException("$sourceDir not found"); } if (!$extensions) { throw new \InvalidArgumentException('$extensions is empty!'); } $sourceDir = realpath($sourceDir); $exts = array_fill_keys($extensions, true); $iter = new \RecursiveDirectoryIterator($sourceDir); $iter = new \RecursiveIteratorIterator($iter); $total = 0; $this->startSection('copy'); $this->debug("Starting to copy files from $sourceDir"); foreach ($iter as $file) { if (isset($exts[$file->getExtension()]) || $file->getBaseName() == 'LICENSE' ) { // Remove the source directory from the destination path $toPath = str_replace($sourceDir, '', (string) $file); $toPath = $destDir . '/' . $toPath; $toPath = str_replace('//', '/', $toPath); $this->deepCopy((string) $file, $toPath); $total++; } } $this->debug("Copied $total files from $sourceDir"); $this->endSection(); }
php
public function recursiveCopy( $sourceDir, $destDir, $extensions = array('php') ) { if (!realpath($sourceDir)) { throw new \InvalidArgumentException("$sourceDir not found"); } if (!$extensions) { throw new \InvalidArgumentException('$extensions is empty!'); } $sourceDir = realpath($sourceDir); $exts = array_fill_keys($extensions, true); $iter = new \RecursiveDirectoryIterator($sourceDir); $iter = new \RecursiveIteratorIterator($iter); $total = 0; $this->startSection('copy'); $this->debug("Starting to copy files from $sourceDir"); foreach ($iter as $file) { if (isset($exts[$file->getExtension()]) || $file->getBaseName() == 'LICENSE' ) { // Remove the source directory from the destination path $toPath = str_replace($sourceDir, '', (string) $file); $toPath = $destDir . '/' . $toPath; $toPath = str_replace('//', '/', $toPath); $this->deepCopy((string) $file, $toPath); $total++; } } $this->debug("Copied $total files from $sourceDir"); $this->endSection(); }
[ "public", "function", "recursiveCopy", "(", "$", "sourceDir", ",", "$", "destDir", ",", "$", "extensions", "=", "array", "(", "'php'", ")", ")", "{", "if", "(", "!", "realpath", "(", "$", "sourceDir", ")", ")", "{", "throw", "new", "\\", "InvalidArgume...
Recursively copy one folder to another. Any LICENSE file is automatically copied. @param string $sourceDir Source directory to copy from @param string $destDir Directory to copy the files to that is relative to the the stage base directory. @param array $extensions File extensions to copy from the $sourceDir. Defaults to "php" files only (e.g., ['php']). @throws \InvalidArgumentException if the source directory is invalid.
[ "Recursively", "copy", "one", "folder", "to", "another", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/build/Burgomaster.php#L160-L197
train
Copy all files from one directory to another
[ 30522, 2270, 3853, 28667, 9236, 3512, 3597, 7685, 1006, 1002, 23184, 4313, 1010, 1002, 4078, 2102, 4305, 2099, 1010, 1002, 14305, 1027, 9140, 1006, 1005, 25718, 1005, 1007, 1007, 1063, 2065, 1006, 999, 2613, 15069, 1006, 1002, 23184, 4313, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
NumberFormatter.getSymbol
public function getSymbol($attr) { return \array_key_exists($this->style, self::$enSymbols) && \array_key_exists($attr, self::$enSymbols[$this->style]) ? self::$enSymbols[$this->style][$attr] : false; }
php
public function getSymbol($attr) { return \array_key_exists($this->style, self::$enSymbols) && \array_key_exists($attr, self::$enSymbols[$this->style]) ? self::$enSymbols[$this->style][$attr] : false; }
[ "public", "function", "getSymbol", "(", "$", "attr", ")", "{", "return", "\\", "array_key_exists", "(", "$", "this", "->", "style", ",", "self", "::", "$", "enSymbols", ")", "&&", "\\", "array_key_exists", "(", "$", "attr", ",", "self", "::", "$", "enS...
Not supported. Returns a formatter symbol value. @param int $attr A symbol specifier, one of the format symbol constants @return bool|string The symbol value or false on error @see http://www.php.net/manual/en/numberformatter.getsymbol.php
[ "Not", "supported", ".", "Returns", "a", "formatter", "symbol", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L461-L464
train
Get symbol value
[ 30522, 2270, 3853, 4152, 24335, 14956, 1006, 1002, 2012, 16344, 1007, 1063, 2709, 1032, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 2023, 1011, 1028, 2806, 1010, 2969, 1024, 1024, 1002, 4372, 6508, 13344, 4877, 1007, 1004, 1004, 1032, 9140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Pages.php
Pages.init
public function init() { $config = $this->grav['config']; $this->ignore_files = $config->get('system.pages.ignore_files'); $this->ignore_folders = $config->get('system.pages.ignore_folders'); $this->ignore_hidden = $config->get('system.pages.ignore_hidden'); $this->instances = []; $this->children = []; $this->routes = []; if (!$this->check_method) { $this->setCheckMethod($config->get('system.cache.check.method', 'file')); } $this->buildPages(); }
php
public function init() { $config = $this->grav['config']; $this->ignore_files = $config->get('system.pages.ignore_files'); $this->ignore_folders = $config->get('system.pages.ignore_folders'); $this->ignore_hidden = $config->get('system.pages.ignore_hidden'); $this->instances = []; $this->children = []; $this->routes = []; if (!$this->check_method) { $this->setCheckMethod($config->get('system.cache.check.method', 'file')); } $this->buildPages(); }
[ "public", "function", "init", "(", ")", "{", "$", "config", "=", "$", "this", "->", "grav", "[", "'config'", "]", ";", "$", "this", "->", "ignore_files", "=", "$", "config", "->", "get", "(", "'system.pages.ignore_files'", ")", ";", "$", "this", "->", ...
Class initialization. Must be called before using this class.
[ "Class", "initialization", ".", "Must", "be", "called", "before", "using", "this", "class", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Pages.php#L240-L256
train
Initialize the page hierarchy
[ 30522, 2270, 3853, 1999, 4183, 1006, 1007, 1063, 1002, 9530, 8873, 2290, 1027, 1002, 2023, 1011, 1028, 24665, 11431, 1031, 1005, 9530, 8873, 2290, 1005, 1033, 1025, 1002, 2023, 1011, 1028, 8568, 1035, 6764, 1027, 1002, 9530, 8873, 2290, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php
JsonLoginFactory.createListener
protected function createListener($container, $id, $config, $userProvider) { $listenerId = $this->getListenerId(); $listener = new ChildDefinition($listenerId); $listener->replaceArgument(3, $id); $listener->replaceArgument(4, isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)) : null); $listener->replaceArgument(5, isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container, $id, $config)) : null); $listener->replaceArgument(6, array_intersect_key($config, $this->options)); $listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]); $listenerId .= '.'.$id; $container->setDefinition($listenerId, $listener); return $listenerId; }
php
protected function createListener($container, $id, $config, $userProvider) { $listenerId = $this->getListenerId(); $listener = new ChildDefinition($listenerId); $listener->replaceArgument(3, $id); $listener->replaceArgument(4, isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)) : null); $listener->replaceArgument(5, isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container, $id, $config)) : null); $listener->replaceArgument(6, array_intersect_key($config, $this->options)); $listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]); $listenerId .= '.'.$id; $container->setDefinition($listenerId, $listener); return $listenerId; }
[ "protected", "function", "createListener", "(", "$", "container", ",", "$", "id", ",", "$", "config", ",", "$", "userProvider", ")", "{", "$", "listenerId", "=", "$", "this", "->", "getListenerId", "(", ")", ";", "$", "listener", "=", "new", "ChildDefini...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php#L84-L98
train
Creates the listener for the session authentication
[ 30522, 5123, 3853, 3443, 9863, 24454, 1006, 1002, 11661, 1010, 1002, 8909, 1010, 1002, 9530, 8873, 2290, 1010, 1002, 5310, 21572, 17258, 2121, 1007, 1063, 1002, 19373, 3593, 1027, 1002, 2023, 1011, 1028, 2131, 9863, 24454, 3593, 1006, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/Mailable.php
Mailable.buildMarkdownView
protected function buildMarkdownView() { $markdown = Container::getInstance()->make(Markdown::class); if (isset($this->theme)) { $markdown->theme($this->theme); } $data = $this->buildViewData(); return [ 'html' => $markdown->render($this->markdown, $data), 'text' => $this->buildMarkdownText($markdown, $data), ]; }
php
protected function buildMarkdownView() { $markdown = Container::getInstance()->make(Markdown::class); if (isset($this->theme)) { $markdown->theme($this->theme); } $data = $this->buildViewData(); return [ 'html' => $markdown->render($this->markdown, $data), 'text' => $this->buildMarkdownText($markdown, $data), ]; }
[ "protected", "function", "buildMarkdownView", "(", ")", "{", "$", "markdown", "=", "Container", "::", "getInstance", "(", ")", "->", "make", "(", "Markdown", "::", "class", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "theme", ")", ")", "{", ...
Build the Markdown view for the message. @return array @throws \ReflectionException
[ "Build", "the", "Markdown", "view", "for", "the", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L256-L270
train
Build Markdown View
[ 30522, 5123, 3853, 3857, 10665, 7698, 8584, 1006, 1007, 1063, 1002, 2928, 7698, 1027, 11661, 1024, 1024, 2131, 7076, 26897, 1006, 1007, 1011, 1028, 2191, 1006, 2928, 7698, 1024, 1024, 2465, 1007, 1025, 2065, 1006, 26354, 3388, 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...
walkor/Workerman
Worker.php
Worker.log
public static function log($msg) { $msg = $msg . "\n"; if (!static::$daemonize) { static::safeEcho($msg); } file_put_contents((string)static::$logFile, date('Y-m-d H:i:s') . ' ' . 'pid:' . (static::$_OS === OS_TYPE_LINUX ? posix_getpid() : 1) . ' ' . $msg, FILE_APPEND | LOCK_EX); }
php
public static function log($msg) { $msg = $msg . "\n"; if (!static::$daemonize) { static::safeEcho($msg); } file_put_contents((string)static::$logFile, date('Y-m-d H:i:s') . ' ' . 'pid:' . (static::$_OS === OS_TYPE_LINUX ? posix_getpid() : 1) . ' ' . $msg, FILE_APPEND | LOCK_EX); }
[ "public", "static", "function", "log", "(", "$", "msg", ")", "{", "$", "msg", "=", "$", "msg", ".", "\"\\n\"", ";", "if", "(", "!", "static", "::", "$", "daemonize", ")", "{", "static", "::", "safeEcho", "(", "$", "msg", ")", ";", "}", "file_put_...
Log. @param string $msg @return void
[ "Log", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L2074-L2082
train
Log a message to the log file
[ 30522, 2270, 10763, 3853, 8833, 1006, 1002, 5796, 2290, 1007, 1063, 1002, 5796, 2290, 1027, 1002, 5796, 2290, 1012, 1000, 1032, 1050, 1000, 1025, 2065, 1006, 999, 10763, 1024, 1024, 1002, 12828, 4697, 1007, 1063, 10763, 1024, 1024, 3647, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Unzip.php
Unzip.factory
public static function factory($name, $filename) { switch ($name) { case 'ZipArchive': if (class_exists('ZipArchive', false)) { return new ZipArchive($filename); } break; case 'tar.gz': return new Tar($filename, 'gz'); case 'tar.bz2': return new Tar($filename, 'bz2'); case 'gz': if (function_exists('gzopen')) { return new Gzip($filename); } break; case 'PclZip': default: return new PclZip($filename); } return new PclZip($filename); }
php
public static function factory($name, $filename) { switch ($name) { case 'ZipArchive': if (class_exists('ZipArchive', false)) { return new ZipArchive($filename); } break; case 'tar.gz': return new Tar($filename, 'gz'); case 'tar.bz2': return new Tar($filename, 'bz2'); case 'gz': if (function_exists('gzopen')) { return new Gzip($filename); } break; case 'PclZip': default: return new PclZip($filename); } return new PclZip($filename); }
[ "public", "static", "function", "factory", "(", "$", "name", ",", "$", "filename", ")", "{", "switch", "(", "$", "name", ")", "{", "case", "'ZipArchive'", ":", "if", "(", "class_exists", "(", "'ZipArchive'", ",", "false", ")", ")", "{", "return", "new"...
Factory method to create an unarchiver @param string $name Name of unarchiver @param string $filename Name of .zip archive @return \Piwik\Decompress\DecompressInterface
[ "Factory", "method", "to", "create", "an", "unarchiver" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Unzip.php#L28-L55
train
Returns an instance of the class that implements the required functionality
[ 30522, 2270, 10763, 3853, 4713, 1006, 1002, 2171, 1010, 1002, 5371, 18442, 1007, 1063, 6942, 1006, 1002, 2171, 1007, 1063, 2553, 1005, 14101, 2906, 5428, 3726, 1005, 1024, 2065, 1006, 2465, 1035, 6526, 1006, 1005, 14101, 2906, 5428, 3726, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
SqlServerGrammar.typeEnum
protected function typeEnum(Fluent $column) { return sprintf( 'nvarchar(255) check ("%s" in (%s))', $column->name, $this->quoteString($column->allowed) ); }
php
protected function typeEnum(Fluent $column) { return sprintf( 'nvarchar(255) check ("%s" in (%s))', $column->name, $this->quoteString($column->allowed) ); }
[ "protected", "function", "typeEnum", "(", "Fluent", "$", "column", ")", "{", "return", "sprintf", "(", "'nvarchar(255) check (\"%s\" in (%s))'", ",", "$", "column", "->", "name", ",", "$", "this", "->", "quoteString", "(", "$", "column", "->", "allowed", ")", ...
Create the column definition for an enumeration type. @param \Illuminate\Support\Fluent $column @return string
[ "Create", "the", "column", "definition", "for", "an", "enumeration", "type", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php#L475-L482
train
Type enum column
[ 30522, 5123, 3853, 2828, 2368, 2819, 1006, 19376, 1002, 5930, 1007, 1063, 2709, 9043, 2546, 1006, 1005, 1050, 10755, 7507, 2099, 1006, 20637, 1007, 4638, 1006, 1000, 1003, 1055, 1000, 1999, 1006, 1003, 1055, 1007, 1007, 1005, 1010, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Association/Apriori.php
Apriori.predictSample
protected function predictSample(array $sample): array { $predicts = array_values(array_filter($this->getRules(), function ($rule) use ($sample) { return $this->equals($rule[self::ARRAY_KEY_ANTECEDENT], $sample); })); return array_map(function ($rule) { return $rule[self::ARRAY_KEY_CONSEQUENT]; }, $predicts); }
php
protected function predictSample(array $sample): array { $predicts = array_values(array_filter($this->getRules(), function ($rule) use ($sample) { return $this->equals($rule[self::ARRAY_KEY_ANTECEDENT], $sample); })); return array_map(function ($rule) { return $rule[self::ARRAY_KEY_CONSEQUENT]; }, $predicts); }
[ "protected", "function", "predictSample", "(", "array", "$", "sample", ")", ":", "array", "{", "$", "predicts", "=", "array_values", "(", "array_filter", "(", "$", "this", "->", "getRules", "(", ")", ",", "function", "(", "$", "rule", ")", "use", "(", ...
@param mixed[] $sample @return mixed[][]
[ "@param", "mixed", "[]", "$sample" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L105-L114
train
Predict the sample
[ 30522, 5123, 3853, 16014, 21559, 10814, 1006, 9140, 1002, 7099, 1007, 1024, 9140, 1063, 1002, 16014, 2015, 1027, 9140, 1035, 5300, 1006, 9140, 1035, 11307, 1006, 1002, 2023, 1011, 1028, 2131, 6820, 4244, 1006, 1007, 1010, 3853, 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/Console/Helper/HelperSet.php
HelperSet.set
public function set(HelperInterface $helper, $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { $this->helpers[$alias] = $helper; } $helper->setHelperSet($this); }
php
public function set(HelperInterface $helper, $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { $this->helpers[$alias] = $helper; } $helper->setHelperSet($this); }
[ "public", "function", "set", "(", "HelperInterface", "$", "helper", ",", "$", "alias", "=", "null", ")", "{", "$", "this", "->", "helpers", "[", "$", "helper", "->", "getName", "(", ")", "]", "=", "$", "helper", ";", "if", "(", "null", "!==", "$", ...
Sets a helper. @param HelperInterface $helper The helper instance @param string $alias An alias
[ "Sets", "a", "helper", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/HelperSet.php#L46-L54
train
Set a helper
[ 30522, 2270, 3853, 2275, 1006, 2393, 23282, 3334, 12172, 1002, 2393, 2121, 1010, 1002, 14593, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2393, 2545, 1031, 1002, 2393, 2121, 1011, 1028, 2131, 18442, 1006, 1007, 1033, 1027, 1002, 2393, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.value
public function value($column) { $result = (array) $this->first([$column]); return count($result) > 0 ? reset($result) : null; }
php
public function value($column) { $result = (array) $this->first([$column]); return count($result) > 0 ? reset($result) : null; }
[ "public", "function", "value", "(", "$", "column", ")", "{", "$", "result", "=", "(", "array", ")", "$", "this", "->", "first", "(", "[", "$", "column", "]", ")", ";", "return", "count", "(", "$", "result", ")", ">", "0", "?", "reset", "(", "$"...
Get a single column's value from the first result of a query. @param string $column @return mixed
[ "Get", "a", "single", "column", "s", "value", "from", "the", "first", "result", "of", "a", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2096-L2101
train
Get value of column
[ 30522, 2270, 3853, 3643, 1006, 1002, 5930, 1007, 1063, 1002, 2765, 1027, 1006, 9140, 1007, 1002, 2023, 1011, 1028, 2034, 1006, 1031, 1002, 5930, 1033, 1007, 1025, 2709, 4175, 1006, 1002, 2765, 1007, 1028, 1014, 1029, 25141, 1006, 1002, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/PrivacyManager/PrivacyManager.php
PrivacyManager.shouldReportBePurged
public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $reportsOlderThan = null) { // if no 'older than' value/date was supplied, use existing config if (is_null($reportsOlderThan)) { // if report deletion is not enabled, the report shouldn't be purged $settings = self::getPurgeDataSettings(); if ($settings['delete_reports_enable'] == 0) { return false; } $reportsOlderThan = $settings['delete_reports_older_than']; } // if a integer was supplied, assume it is the number of months a report must be older than if (!($reportsOlderThan instanceof Date)) { $reportsOlderThan = Date::factory('today')->subMonth(1 + $reportsOlderThan); } return ReportsPurger::shouldReportBePurged( $reportDateYear, $reportDateMonth, $reportsOlderThan); }
php
public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $reportsOlderThan = null) { // if no 'older than' value/date was supplied, use existing config if (is_null($reportsOlderThan)) { // if report deletion is not enabled, the report shouldn't be purged $settings = self::getPurgeDataSettings(); if ($settings['delete_reports_enable'] == 0) { return false; } $reportsOlderThan = $settings['delete_reports_older_than']; } // if a integer was supplied, assume it is the number of months a report must be older than if (!($reportsOlderThan instanceof Date)) { $reportsOlderThan = Date::factory('today')->subMonth(1 + $reportsOlderThan); } return ReportsPurger::shouldReportBePurged( $reportDateYear, $reportDateMonth, $reportsOlderThan); }
[ "public", "static", "function", "shouldReportBePurged", "(", "$", "reportDateYear", ",", "$", "reportDateMonth", ",", "$", "reportsOlderThan", "=", "null", ")", "{", "// if no 'older than' value/date was supplied, use existing config", "if", "(", "is_null", "(", "$", "r...
Returns true if a report with the given year & month should be purged or not. If reportsOlderThan is set to null or not supplied, this function will check if a report should be purged, based on existing configuration. In this case, if delete_reports_enable is set to 0, this function will return false. @param int $reportDateYear The year of the report in question. @param int $reportDateMonth The month of the report in question. @param int|Date $reportsOlderThan If an int, the number of months a report must be older than in order to be purged. If a date, the date a report must be older than in order to be purged. @return bool
[ "Returns", "true", "if", "a", "report", "with", "the", "given", "year", "&", "month", "should", "be", "purged", "or", "not", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/PrivacyManager.php#L488-L508
train
Returns true if the report should be purged
[ 30522, 2270, 10763, 3853, 2323, 2890, 6442, 4783, 5311, 5999, 1006, 1002, 3189, 13701, 29100, 1010, 1002, 3189, 13701, 9629, 2232, 1010, 1002, 4311, 11614, 8743, 4819, 1027, 19701, 1007, 1063, 1013, 1013, 2065, 2053, 1005, 3080, 2084, 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/Adapter/Pdo/Pgsql.php
Zend_Db_Adapter_Pdo_Pgsql.lastSequenceId
public function lastSequenceId($sequenceName) { $this->_connect(); $sequenceName = str_replace($this->getQuoteIdentifierSymbol(), '', (string) $sequenceName); $value = $this->fetchOne("SELECT CURRVAL(" . $this->quote($this->quoteIdentifier($sequenceName, true)) . ")"); return $value; }
php
public function lastSequenceId($sequenceName) { $this->_connect(); $sequenceName = str_replace($this->getQuoteIdentifierSymbol(), '', (string) $sequenceName); $value = $this->fetchOne("SELECT CURRVAL(" . $this->quote($this->quoteIdentifier($sequenceName, true)) . ")"); return $value; }
[ "public", "function", "lastSequenceId", "(", "$", "sequenceName", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "$", "sequenceName", "=", "str_replace", "(", "$", "this", "->", "getQuoteIdentifierSymbol", "(", ")", ",", "''", ",", "(", "string", ...
Return the most recent value from the specified sequence in the database. This is supported only on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2). Other RDBMS brands return null. @param string $sequenceName @return string
[ "Return", "the", "most", "recent", "value", "from", "the", "specified", "sequence", "in", "the", "database", ".", "This", "is", "supported", "only", "on", "RDBMS", "brands", "that", "support", "sequences", "(", "e", ".", "g", ".", "Oracle", "PostgreSQL", "...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Pgsql.php#L281-L289
train
Get last sequence id
[ 30522, 2270, 3853, 16180, 2063, 4226, 5897, 3593, 1006, 1002, 5537, 18442, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 1002, 5537, 18442, 1027, 2358, 2099, 1035, 5672, 1006, 1002, 2023, 1011, 1028, 2131, 28940, 12184, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.clearBCCs
public function clearBCCs() { foreach ($this->bcc as $bcc) { unset($this->all_recipients[strtolower($bcc[0])]); } $this->bcc = []; $this->clearQueuedAddresses('bcc'); }
php
public function clearBCCs() { foreach ($this->bcc as $bcc) { unset($this->all_recipients[strtolower($bcc[0])]); } $this->bcc = []; $this->clearQueuedAddresses('bcc'); }
[ "public", "function", "clearBCCs", "(", ")", "{", "foreach", "(", "$", "this", "->", "bcc", "as", "$", "bcc", ")", "{", "unset", "(", "$", "this", "->", "all_recipients", "[", "strtolower", "(", "$", "bcc", "[", "0", "]", ")", "]", ")", ";", "}",...
Clear all BCC recipients.
[ "Clear", "all", "BCC", "recipients", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3541-L3548
train
Clear all BCC recipients
[ 30522, 2270, 3853, 3154, 9818, 6169, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 4647, 2278, 2004, 1002, 4647, 2278, 1007, 1063, 4895, 13462, 1006, 1002, 2023, 1011, 1028, 2035, 1035, 15991, 1031, 2358, 5339, 12898, 13777, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/POP3.php
POP3.getResponse
protected function getResponse($size = 128) { $response = fgets($this->pop_conn, $size); if ($this->do_debug >= 1) { echo 'Server -> Client: ', $response; } return $response; }
php
protected function getResponse($size = 128) { $response = fgets($this->pop_conn, $size); if ($this->do_debug >= 1) { echo 'Server -> Client: ', $response; } return $response; }
[ "protected", "function", "getResponse", "(", "$", "size", "=", "128", ")", "{", "$", "response", "=", "fgets", "(", "$", "this", "->", "pop_conn", ",", "$", "size", ")", ";", "if", "(", "$", "this", "->", "do_debug", ">=", "1", ")", "{", "echo", ...
Get a response from the POP3 server. @param int $size The maximum number of bytes to retrieve @return string
[ "Get", "a", "response", "from", "the", "POP3", "server", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L327-L335
train
Get response from server
[ 30522, 5123, 3853, 2131, 6072, 26029, 3366, 1006, 1002, 2946, 1027, 11899, 1007, 1063, 1002, 3433, 1027, 1042, 18150, 2015, 1006, 1002, 2023, 1011, 1028, 3769, 1035, 9530, 2078, 1010, 1002, 2946, 1007, 1025, 2065, 1006, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Access.php
Access.checkUserHasViewAccess
public function checkUserHasViewAccess($idSites) { if ($this->hasSuperUserAccess()) { return; } $idSites = $this->getIdSites($idSites); $idSitesAccessible = $this->getSitesIdWithAtLeastViewAccess(); foreach ($idSites as $idsite) { if (!in_array($idsite, $idSitesAccessible)) { throw new NoAccessException(Piwik::translate('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idsite))); } } }
php
public function checkUserHasViewAccess($idSites) { if ($this->hasSuperUserAccess()) { return; } $idSites = $this->getIdSites($idSites); $idSitesAccessible = $this->getSitesIdWithAtLeastViewAccess(); foreach ($idSites as $idsite) { if (!in_array($idsite, $idSitesAccessible)) { throw new NoAccessException(Piwik::translate('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idsite))); } } }
[ "public", "function", "checkUserHasViewAccess", "(", "$", "idSites", ")", "{", "if", "(", "$", "this", "->", "hasSuperUserAccess", "(", ")", ")", "{", "return", ";", "}", "$", "idSites", "=", "$", "this", "->", "getIdSites", "(", "$", "idSites", ")", "...
This method checks that the user has VIEW or ADMIN access for the given list of websites. If the user doesn't have VIEW or ADMIN access for at least one website of the list, we throw an exception. @param int|array|string $idSites List of ID sites to check (integer, array of integers, string comma separated list of integers) @throws \Piwik\NoAccessException If for any of the websites the user doesn't have an VIEW or ADMIN access
[ "This", "method", "checks", "that", "the", "user", "has", "VIEW", "or", "ADMIN", "access", "for", "the", "given", "list", "of", "websites", ".", "If", "the", "user", "doesn", "t", "have", "VIEW", "or", "ADMIN", "access", "for", "at", "least", "one", "w...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Access.php#L523-L537
train
Checks whether the current user has view access to the list of websites.
[ 30522, 2270, 3853, 4638, 20330, 14949, 8584, 6305, 9623, 2015, 1006, 1002, 8909, 28032, 2229, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2038, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 8909, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
PersistentTokenBasedRememberMeServices.processAutoLoginCookie
protected function processAutoLoginCookie(array $cookieParts, Request $request) { if (2 !== \count($cookieParts)) { throw new AuthenticationException('The cookie is invalid.'); } list($series, $tokenValue) = $cookieParts; $persistentToken = $this->tokenProvider->loadTokenBySeries($series); if (!hash_equals($persistentToken->getTokenValue(), $tokenValue)) { throw new CookieTheftException('This token was already used. The account is possibly compromised.'); } if ($persistentToken->getLastUsed()->getTimestamp() + $this->options['lifetime'] < time()) { throw new AuthenticationException('The cookie has expired.'); } $tokenValue = base64_encode(random_bytes(64)); $this->tokenProvider->updateToken($series, $tokenValue, new \DateTime()); $request->attributes->set(self::COOKIE_ATTR_NAME, new Cookie( $this->options['name'], $this->encodeCookie([$series, $tokenValue]), time() + $this->options['lifetime'], $this->options['path'], $this->options['domain'], $this->options['secure'] ?? $request->isSecure(), $this->options['httponly'], false, $this->options['samesite'] ?? null ) ); return $this->getUserProvider($persistentToken->getClass())->loadUserByUsername($persistentToken->getUsername()); }
php
protected function processAutoLoginCookie(array $cookieParts, Request $request) { if (2 !== \count($cookieParts)) { throw new AuthenticationException('The cookie is invalid.'); } list($series, $tokenValue) = $cookieParts; $persistentToken = $this->tokenProvider->loadTokenBySeries($series); if (!hash_equals($persistentToken->getTokenValue(), $tokenValue)) { throw new CookieTheftException('This token was already used. The account is possibly compromised.'); } if ($persistentToken->getLastUsed()->getTimestamp() + $this->options['lifetime'] < time()) { throw new AuthenticationException('The cookie has expired.'); } $tokenValue = base64_encode(random_bytes(64)); $this->tokenProvider->updateToken($series, $tokenValue, new \DateTime()); $request->attributes->set(self::COOKIE_ATTR_NAME, new Cookie( $this->options['name'], $this->encodeCookie([$series, $tokenValue]), time() + $this->options['lifetime'], $this->options['path'], $this->options['domain'], $this->options['secure'] ?? $request->isSecure(), $this->options['httponly'], false, $this->options['samesite'] ?? null ) ); return $this->getUserProvider($persistentToken->getClass())->loadUserByUsername($persistentToken->getUsername()); }
[ "protected", "function", "processAutoLoginCookie", "(", "array", "$", "cookieParts", ",", "Request", "$", "request", ")", "{", "if", "(", "2", "!==", "\\", "count", "(", "$", "cookieParts", ")", ")", "{", "throw", "new", "AuthenticationException", "(", "'The...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php#L60-L94
train
Process the auto login cookie
[ 30522, 5123, 3853, 2832, 4887, 3406, 21197, 2378, 3597, 23212, 2063, 1006, 9140, 1002, 17387, 26950, 1010, 5227, 1002, 5227, 1007, 1063, 2065, 1006, 1016, 999, 1027, 1027, 1032, 4175, 1006, 1002, 17387, 26950, 1007, 1007, 1063, 5466, 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...
laravel/framework
src/Illuminate/Queue/Console/ListFailedCommand.php
ListFailedCommand.parseFailedJob
protected function parseFailedJob(array $failed) { $row = array_values(Arr::except($failed, ['payload', 'exception'])); array_splice($row, 3, 0, $this->extractJobName($failed['payload'])); return $row; }
php
protected function parseFailedJob(array $failed) { $row = array_values(Arr::except($failed, ['payload', 'exception'])); array_splice($row, 3, 0, $this->extractJobName($failed['payload'])); return $row; }
[ "protected", "function", "parseFailedJob", "(", "array", "$", "failed", ")", "{", "$", "row", "=", "array_values", "(", "Arr", "::", "except", "(", "$", "failed", ",", "[", "'payload'", ",", "'exception'", "]", ")", ")", ";", "array_splice", "(", "$", ...
Parse the failed job row. @param array $failed @return array
[ "Parse", "the", "failed", "job", "row", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Console/ListFailedCommand.php#L65-L72
train
Parse failed job
[ 30522, 5123, 3853, 11968, 20106, 17440, 5558, 2497, 1006, 9140, 1002, 3478, 1007, 1063, 1002, 5216, 1027, 9140, 1035, 5300, 1006, 12098, 2099, 1024, 1024, 3272, 1006, 1002, 3478, 1010, 1031, 1005, 18093, 1005, 1010, 1005, 6453, 1005, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Protocol/Imap.php
Zend_Mail_Protocol_Imap.store
public function store(array $flags, $from, $to = null, $mode = null, $silent = true) { $item = 'FLAGS'; if ($mode == '+' || $mode == '-') { $item = $mode . $item; } if ($silent) { $item .= '.SILENT'; } $flags = $this->escapeList($flags); $set = (int)$from; if ($to != null) { $set .= ':' . ($to == INF ? '*' : (int)$to); } $result = $this->requestAndResponse('STORE', array($set, $item, $flags), $silent); if ($silent) { return $result ? true : false; } $tokens = $result; $result = array(); foreach ($tokens as $token) { if ($token[1] != 'FETCH' || $token[2][0] != 'FLAGS') { continue; } $result[$token[0]] = $token[2][1]; } return $result; }
php
public function store(array $flags, $from, $to = null, $mode = null, $silent = true) { $item = 'FLAGS'; if ($mode == '+' || $mode == '-') { $item = $mode . $item; } if ($silent) { $item .= '.SILENT'; } $flags = $this->escapeList($flags); $set = (int)$from; if ($to != null) { $set .= ':' . ($to == INF ? '*' : (int)$to); } $result = $this->requestAndResponse('STORE', array($set, $item, $flags), $silent); if ($silent) { return $result ? true : false; } $tokens = $result; $result = array(); foreach ($tokens as $token) { if ($token[1] != 'FETCH' || $token[2][0] != 'FLAGS') { continue; } $result[$token[0]] = $token[2][1]; } return $result; }
[ "public", "function", "store", "(", "array", "$", "flags", ",", "$", "from", ",", "$", "to", "=", "null", ",", "$", "mode", "=", "null", ",", "$", "silent", "=", "true", ")", "{", "$", "item", "=", "'FLAGS'", ";", "if", "(", "$", "mode", "==", ...
set flags @param array $flags flags to set, add or remove - see $mode @param int $from message for items or start message if $to !== null @param int|null $to if null only one message ($from) is fetched, else it's the last message, INF means last message avaible @param string|null $mode '+' to add flags, '-' to remove flags, everything else sets the flags as given @param bool $silent if false the return values are the new flags for the wanted messages @return bool|array new flags if $silent is false, else true or false depending on success @throws Zend_Mail_Protocol_Exception
[ "set", "flags" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Imap.php#L679-L711
train
Store a record
[ 30522, 2270, 3853, 3573, 1006, 9140, 1002, 9245, 1010, 1002, 2013, 1010, 1002, 2000, 1027, 19701, 1010, 1002, 5549, 1027, 19701, 1010, 1002, 4333, 1027, 2995, 1007, 1063, 1002, 8875, 1027, 1005, 9245, 1005, 1025, 2065, 1006, 1002, 5549, 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/VarExporter/Instantiator.php
Instantiator.instantiate
public static function instantiate(string $class, array $properties = [], array $privateProperties = []) { $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); if (Registry::$cloneable[$class]) { $wrappedInstance = [clone Registry::$prototypes[$class]]; } elseif (Registry::$instantiableWithoutConstructor[$class]) { $wrappedInstance = [$reflector->newInstanceWithoutConstructor()]; } elseif (null === Registry::$prototypes[$class]) { throw new NotInstantiableTypeException($class); } elseif ($reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize'))) { $wrappedInstance = [unserialize('C:'.\strlen($class).':"'.$class.'":0:{}')]; } else { $wrappedInstance = [unserialize('O:'.\strlen($class).':"'.$class.'":0:{}')]; } if ($properties) { $privateProperties[$class] = isset($privateProperties[$class]) ? $properties + $privateProperties[$class] : $properties; } foreach ($privateProperties as $class => $properties) { if (!$properties) { continue; } foreach ($properties as $name => $value) { // because they're also used for "unserialization", hydrators // deal with array of instances, so we need to wrap values $properties[$name] = [$value]; } (Hydrator::$hydrators[$class] ?? Hydrator::getHydrator($class))($properties, $wrappedInstance); } return $wrappedInstance[0]; }
php
public static function instantiate(string $class, array $properties = [], array $privateProperties = []) { $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); if (Registry::$cloneable[$class]) { $wrappedInstance = [clone Registry::$prototypes[$class]]; } elseif (Registry::$instantiableWithoutConstructor[$class]) { $wrappedInstance = [$reflector->newInstanceWithoutConstructor()]; } elseif (null === Registry::$prototypes[$class]) { throw new NotInstantiableTypeException($class); } elseif ($reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize'))) { $wrappedInstance = [unserialize('C:'.\strlen($class).':"'.$class.'":0:{}')]; } else { $wrappedInstance = [unserialize('O:'.\strlen($class).':"'.$class.'":0:{}')]; } if ($properties) { $privateProperties[$class] = isset($privateProperties[$class]) ? $properties + $privateProperties[$class] : $properties; } foreach ($privateProperties as $class => $properties) { if (!$properties) { continue; } foreach ($properties as $name => $value) { // because they're also used for "unserialization", hydrators // deal with array of instances, so we need to wrap values $properties[$name] = [$value]; } (Hydrator::$hydrators[$class] ?? Hydrator::getHydrator($class))($properties, $wrappedInstance); } return $wrappedInstance[0]; }
[ "public", "static", "function", "instantiate", "(", "string", "$", "class", ",", "array", "$", "properties", "=", "[", "]", ",", "array", "$", "privateProperties", "=", "[", "]", ")", "{", "$", "reflector", "=", "Registry", "::", "$", "reflectors", "[", ...
Creates an object and sets its properties without calling its constructor nor any other methods. For example: // creates an empty instance of Foo Instantiator::instantiate(Foo::class); // creates a Foo instance and sets one of its properties Instantiator::instantiate(Foo::class, ['propertyName' => $propertyValue]); // creates a Foo instance and sets a private property defined on its parent Bar class Instantiator::instantiate(Foo::class, [], [ Bar::class => ['privateBarProperty' => $propertyValue], ]); Instances of ArrayObject, ArrayIterator and SplObjectHash can be created by using the special "\0" property name to define their internal value: // creates an SplObjectHash where $info1 is attached to $obj1, etc. Instantiator::instantiate(SplObjectStorage::class, ["\0" => [$obj1, $info1, $obj2, $info2...]]); // creates an ArrayObject populated with $inputArray Instantiator::instantiate(ArrayObject::class, ["\0" => [$inputArray]]); @param string $class The class of the instance to create @param array $properties The properties to set on the instance @param array $privateProperties The private properties to set on the instance, keyed by their declaring class @return object The created instance @throws ExceptionInterface When the instance cannot be created
[ "Creates", "an", "object", "and", "sets", "its", "properties", "without", "calling", "its", "constructor", "nor", "any", "other", "methods", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarExporter/Instantiator.php#L60-L93
train
Instantiates a class
[ 30522, 2270, 10763, 3853, 7107, 13143, 1006, 5164, 1002, 2465, 1010, 9140, 1002, 5144, 1027, 1031, 1033, 1010, 9140, 1002, 2797, 21572, 4842, 7368, 1027, 1031, 1033, 1007, 1063, 1002, 8339, 2953, 1027, 15584, 1024, 1024, 1002, 8339, 5668, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
opencart/opencart
upload/admin/controller/event/language.php
ControllerEventLanguage.after
public function after(&$route, &$args, &$output) { $data = $this->language->get('backup'); if (is_array($data)) { foreach ($data as $key => $value) { $this->language->set($key, $value); } } }
php
public function after(&$route, &$args, &$output) { $data = $this->language->get('backup'); if (is_array($data)) { foreach ($data as $key => $value) { $this->language->set($key, $value); } } }
[ "public", "function", "after", "(", "&", "$", "route", ",", "&", "$", "args", ",", "&", "$", "output", ")", "{", "$", "data", "=", "$", "this", "->", "language", "->", "get", "(", "'backup'", ")", ";", "if", "(", "is_array", "(", "$", "data", "...
2. After controller load restore old language data
[ "2", ".", "After", "controller", "load", "restore", "old", "language", "data" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/admin/controller/event/language.php#L17-L25
train
After action callback
[ 30522, 2270, 3853, 2044, 1006, 1004, 1002, 2799, 1010, 1004, 1002, 12098, 5620, 1010, 1004, 1002, 6434, 1007, 1063, 1002, 2951, 1027, 1002, 2023, 1011, 1028, 2653, 1011, 1028, 2131, 1006, 1005, 10200, 1005, 1007, 1025, 2065, 1006, 2003, 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/DomCrawler/Field/FileFormField.php
FileFormField.setValue
public function setValue($value) { if (null !== $value && is_readable($value)) { $error = UPLOAD_ERR_OK; $size = filesize($value); $info = pathinfo($value); $name = $info['basename']; // copy to a tmp location $tmp = sys_get_temp_dir().'/'.strtr(substr(base64_encode(hash('sha256', uniqid(mt_rand(), true), true)), 0, 7), '/', '_'); if (\array_key_exists('extension', $info)) { $tmp .= '.'.$info['extension']; } if (is_file($tmp)) { unlink($tmp); } copy($value, $tmp); $value = $tmp; } else { $error = UPLOAD_ERR_NO_FILE; $size = 0; $name = ''; $value = ''; } $this->value = ['name' => $name, 'type' => '', 'tmp_name' => $value, 'error' => $error, 'size' => $size]; }
php
public function setValue($value) { if (null !== $value && is_readable($value)) { $error = UPLOAD_ERR_OK; $size = filesize($value); $info = pathinfo($value); $name = $info['basename']; // copy to a tmp location $tmp = sys_get_temp_dir().'/'.strtr(substr(base64_encode(hash('sha256', uniqid(mt_rand(), true), true)), 0, 7), '/', '_'); if (\array_key_exists('extension', $info)) { $tmp .= '.'.$info['extension']; } if (is_file($tmp)) { unlink($tmp); } copy($value, $tmp); $value = $tmp; } else { $error = UPLOAD_ERR_NO_FILE; $size = 0; $name = ''; $value = ''; } $this->value = ['name' => $name, 'type' => '', 'tmp_name' => $value, 'error' => $error, 'size' => $size]; }
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "if", "(", "null", "!==", "$", "value", "&&", "is_readable", "(", "$", "value", ")", ")", "{", "$", "error", "=", "UPLOAD_ERR_OK", ";", "$", "size", "=", "filesize", "(", "$", "value", ...
Sets the value of the field. @param string $value The value of the field
[ "Sets", "the", "value", "of", "the", "field", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Field/FileFormField.php#L53-L79
train
Method to set the value of the field
[ 30522, 2270, 3853, 2275, 10175, 5657, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 3643, 1004, 1004, 2003, 1035, 3191, 3085, 1006, 1002, 3643, 1007, 1007, 1063, 1002, 7561, 1027, 2039, 11066, 1035, 9413, 2099, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MediaLibrary.php
MediaLibrary.moveFolder
public function moveFolder($originalPath, $newPath) { if (Str::lower($originalPath) !== Str::lower($newPath)) { // If there is no risk that the directory was renamed // by just changing the letter case in the name - // copy the directory to the destination path and delete // the source directory. if (!$this->copyFolder($originalPath, $newPath)) { return false; } $this->deleteFolder($originalPath); } else { // If there's a risk that the directory name was updated // by changing the letter case - swap source and destination // using a temporary directory with random name. $tempraryDirPath = $this->generateRandomTmpFolderName(dirname($originalPath)); if (!$this->copyFolder($originalPath, $tempraryDirPath)) { $this->deleteFolder($tempraryDirPath); return false; } $this->deleteFolder($originalPath); return $this->moveFolder($tempraryDirPath, $newPath); } return true; }
php
public function moveFolder($originalPath, $newPath) { if (Str::lower($originalPath) !== Str::lower($newPath)) { // If there is no risk that the directory was renamed // by just changing the letter case in the name - // copy the directory to the destination path and delete // the source directory. if (!$this->copyFolder($originalPath, $newPath)) { return false; } $this->deleteFolder($originalPath); } else { // If there's a risk that the directory name was updated // by changing the letter case - swap source and destination // using a temporary directory with random name. $tempraryDirPath = $this->generateRandomTmpFolderName(dirname($originalPath)); if (!$this->copyFolder($originalPath, $tempraryDirPath)) { $this->deleteFolder($tempraryDirPath); return false; } $this->deleteFolder($originalPath); return $this->moveFolder($tempraryDirPath, $newPath); } return true; }
[ "public", "function", "moveFolder", "(", "$", "originalPath", ",", "$", "newPath", ")", "{", "if", "(", "Str", "::", "lower", "(", "$", "originalPath", ")", "!==", "Str", "::", "lower", "(", "$", "newPath", ")", ")", "{", "// If there is no risk that the d...
Moves a folder. @param string $originalPath Specifies the original path of the folder. @param string $newPath Specifies the new path of the folder. @return boolean
[ "Moves", "a", "folder", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L395-L428
train
Moves a folder to a new location
[ 30522, 2270, 3853, 2693, 10371, 2121, 1006, 1002, 2434, 15069, 1010, 1002, 2047, 15069, 1007, 1063, 2065, 1006, 2358, 2099, 1024, 1024, 2896, 1006, 1002, 2434, 15069, 1007, 999, 1027, 1027, 2358, 2099, 1024, 1024, 2896, 1006, 1002, 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...
octobercms/october
modules/backend/behaviors/UserPreferencesModel.php
UserPreferencesModel.getCacheKey
protected function getCacheKey() { $item = UserPreference::forUser(); $userId = $item->userContext ? $item->userContext->id : 0; return $this->recordCode.'-userpreference-'.$userId; }
php
protected function getCacheKey() { $item = UserPreference::forUser(); $userId = $item->userContext ? $item->userContext->id : 0; return $this->recordCode.'-userpreference-'.$userId; }
[ "protected", "function", "getCacheKey", "(", ")", "{", "$", "item", "=", "UserPreference", "::", "forUser", "(", ")", ";", "$", "userId", "=", "$", "item", "->", "userContext", "?", "$", "item", "->", "userContext", "->", "id", ":", "0", ";", "return",...
Returns a cache key for this record.
[ "Returns", "a", "cache", "key", "for", "this", "record", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/UserPreferencesModel.php#L111-L116
train
Get the cache key for this record
[ 30522, 5123, 3853, 2131, 3540, 5403, 14839, 1006, 1007, 1063, 1002, 8875, 1027, 5310, 28139, 25523, 1024, 1024, 2005, 20330, 1006, 1007, 1025, 1002, 5310, 3593, 1027, 1002, 8875, 1011, 1028, 5310, 8663, 18209, 1029, 1002, 8875, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/ColumnCallbackAddMetadata.php
ColumnCallbackAddMetadata.filter
public function filter($table) { if ($this->applyToSummaryRow) { $rows = $table->getRows(); } else { $rows = $table->getRowsWithoutSummaryRow(); } foreach ($rows as $key => $row) { $parameters = array(); foreach ($this->columnsToRead as $columnsToRead) { $parameters[] = $row->getColumn($columnsToRead); } if (!is_null($this->functionParameters)) { $parameters = array_merge($parameters, $this->functionParameters); } if (!is_null($this->functionToApply)) { $newValue = call_user_func_array($this->functionToApply, $parameters); } else { $newValue = $parameters[0]; } if ($newValue !== false) { $row->addMetadata($this->metadataToAdd, $newValue); } } }
php
public function filter($table) { if ($this->applyToSummaryRow) { $rows = $table->getRows(); } else { $rows = $table->getRowsWithoutSummaryRow(); } foreach ($rows as $key => $row) { $parameters = array(); foreach ($this->columnsToRead as $columnsToRead) { $parameters[] = $row->getColumn($columnsToRead); } if (!is_null($this->functionParameters)) { $parameters = array_merge($parameters, $this->functionParameters); } if (!is_null($this->functionToApply)) { $newValue = call_user_func_array($this->functionToApply, $parameters); } else { $newValue = $parameters[0]; } if ($newValue !== false) { $row->addMetadata($this->metadataToAdd, $newValue); } } }
[ "public", "function", "filter", "(", "$", "table", ")", "{", "if", "(", "$", "this", "->", "applyToSummaryRow", ")", "{", "$", "rows", "=", "$", "table", "->", "getRows", "(", ")", ";", "}", "else", "{", "$", "rows", "=", "$", "table", "->", "get...
See {@link ColumnCallbackAddMetadata}. @param DataTable $table
[ "See", "{", "@link", "ColumnCallbackAddMetadata", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/ColumnCallbackAddMetadata.php#L64-L90
train
Filter the table
[ 30522, 2270, 3853, 11307, 1006, 1002, 2795, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 6611, 13122, 2819, 7849, 12541, 5004, 1007, 1063, 1002, 10281, 1027, 1002, 2795, 1011, 1028, 2131, 10524, 2015, 1006, 1007, 1025, 1065, 2842, 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...
barryvdh/laravel-debugbar
src/Support/Clockwork/ClockworkCollector.php
ClockworkCollector.collect
public function collect() { $request = $this->request; $response = $this->response; $data = [ 'getData' => $request->query->all(), 'postData' => $request->request->all(), 'headers' => $request->headers->all(), 'cookies' => $request->cookies->all(), 'uri' => $request->getRequestUri(), 'method' => $request->getMethod(), 'responseStatus' => $response->getStatusCode(), ]; if ($this->session) { $sessionAttributes = []; foreach ($this->session->all() as $key => $value) { $sessionAttributes[$key] = $value; } $data['sessionData'] = $sessionAttributes; } if (isset($data['postData']['php-auth-pw'])) { $data['postData']['php-auth-pw'] = '******'; } if (isset($data['postData']['PHP_AUTH_PW'])) { $data['postData']['PHP_AUTH_PW'] = '******'; } return $data; }
php
public function collect() { $request = $this->request; $response = $this->response; $data = [ 'getData' => $request->query->all(), 'postData' => $request->request->all(), 'headers' => $request->headers->all(), 'cookies' => $request->cookies->all(), 'uri' => $request->getRequestUri(), 'method' => $request->getMethod(), 'responseStatus' => $response->getStatusCode(), ]; if ($this->session) { $sessionAttributes = []; foreach ($this->session->all() as $key => $value) { $sessionAttributes[$key] = $value; } $data['sessionData'] = $sessionAttributes; } if (isset($data['postData']['php-auth-pw'])) { $data['postData']['php-auth-pw'] = '******'; } if (isset($data['postData']['PHP_AUTH_PW'])) { $data['postData']['PHP_AUTH_PW'] = '******'; } return $data; }
[ "public", "function", "collect", "(", ")", "{", "$", "request", "=", "$", "this", "->", "request", ";", "$", "response", "=", "$", "this", "->", "response", ";", "$", "data", "=", "[", "'getData'", "=>", "$", "request", "->", "query", "->", "all", ...
{@inheritdoc}
[ "{" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/Support/Clockwork/ClockworkCollector.php#L57-L89
train
Collects all the information from the request and response
[ 30522, 2270, 3853, 8145, 1006, 1007, 1063, 1002, 5227, 1027, 1002, 2023, 1011, 1028, 5227, 1025, 1002, 3433, 1027, 1002, 2023, 1011, 1028, 3433, 1025, 1002, 2951, 1027, 1031, 1005, 2131, 2850, 2696, 1005, 1027, 1028, 1002, 5227, 1011, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageFile.php
ImageFile.cacheFile
public function cacheFile($type = 'jpg', $quality = 80, $actual = false, $extras = []) { if ($type === 'guess') { $type = $this->guessType(); } if (!$this->forceCache && !count($this->operations) && $type === $this->guessType()) { return $this->getFilename($this->getFilePath()); } // Computes the hash $this->hash = $this->getHash($type, $quality, $extras); // Seo friendly image names $seofriendly = Grav::instance()['config']->get('system.images.seofriendly', false); if ($seofriendly) { $mini_hash = substr($this->hash, 0, 4) . substr($this->hash, -4); $cacheFile = "{$this->prettyName}-{$mini_hash}"; } else { $cacheFile = "{$this->hash}-{$this->prettyName}"; } $cacheFile .= '.' . $type; // If the files does not exists, save it $image = $this; // Target file should be younger than all the current image // dependencies $conditions = array( 'younger-than' => $this->getDependencies() ); // The generating function $generate = function ($target) use ($image, $type, $quality) { $result = $image->save($target, $type, $quality); if ($result !== $target) { throw new GenerationError($result); } Grav::instance()->fireEvent('onImageMediumSaved', new Event(['image' => $target])); }; // Asking the cache for the cacheFile try { $perms = Grav::instance()['config']->get('system.images.cache_perms', '0755'); $perms = octdec($perms); $file = $this->getCacheSystem()->setDirectoryMode($perms)->getOrCreateFile($cacheFile, $conditions, $generate, $actual); } catch (GenerationError $e) { $file = $e->getNewFile(); } // Nulling the resource $this->getAdapter()->setSource(new Source\File($file)); $this->getAdapter()->deinit(); if ($actual) { return $file; } return $this->getFilename($file); }
php
public function cacheFile($type = 'jpg', $quality = 80, $actual = false, $extras = []) { if ($type === 'guess') { $type = $this->guessType(); } if (!$this->forceCache && !count($this->operations) && $type === $this->guessType()) { return $this->getFilename($this->getFilePath()); } // Computes the hash $this->hash = $this->getHash($type, $quality, $extras); // Seo friendly image names $seofriendly = Grav::instance()['config']->get('system.images.seofriendly', false); if ($seofriendly) { $mini_hash = substr($this->hash, 0, 4) . substr($this->hash, -4); $cacheFile = "{$this->prettyName}-{$mini_hash}"; } else { $cacheFile = "{$this->hash}-{$this->prettyName}"; } $cacheFile .= '.' . $type; // If the files does not exists, save it $image = $this; // Target file should be younger than all the current image // dependencies $conditions = array( 'younger-than' => $this->getDependencies() ); // The generating function $generate = function ($target) use ($image, $type, $quality) { $result = $image->save($target, $type, $quality); if ($result !== $target) { throw new GenerationError($result); } Grav::instance()->fireEvent('onImageMediumSaved', new Event(['image' => $target])); }; // Asking the cache for the cacheFile try { $perms = Grav::instance()['config']->get('system.images.cache_perms', '0755'); $perms = octdec($perms); $file = $this->getCacheSystem()->setDirectoryMode($perms)->getOrCreateFile($cacheFile, $conditions, $generate, $actual); } catch (GenerationError $e) { $file = $e->getNewFile(); } // Nulling the resource $this->getAdapter()->setSource(new Source\File($file)); $this->getAdapter()->deinit(); if ($actual) { return $file; } return $this->getFilename($file); }
[ "public", "function", "cacheFile", "(", "$", "type", "=", "'jpg'", ",", "$", "quality", "=", "80", ",", "$", "actual", "=", "false", ",", "$", "extras", "=", "[", "]", ")", "{", "if", "(", "$", "type", "===", "'guess'", ")", "{", "$", "type", "...
This is the same as the Gregwar Image class except this one fires a Grav Event on creation of new cached file @param string $type the image type @param int $quality the quality (for JPEG) @param bool $actual @param array $extras @return string
[ "This", "is", "the", "same", "as", "the", "Gregwar", "Image", "class", "except", "this", "one", "fires", "a", "Grav", "Event", "on", "creation", "of", "new", "cached", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageFile.php#L43-L106
train
Cache the image file
[ 30522, 2270, 3853, 17053, 8873, 2571, 1006, 1002, 2828, 1027, 1005, 16545, 2290, 1005, 1010, 1002, 3737, 1027, 3770, 1010, 1002, 5025, 1027, 6270, 1010, 1002, 26279, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2828, 1027, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreVisualizations/JqplotDataGenerator.php
JqplotDataGenerator.generate
public function generate($dataTable) { $visualization = new Chart(); if ($dataTable->getRowsCount() > 0) { // if addTotalRow was called in GenerateGraphHTML, add a row containing totals of // different metrics if ($this->properties['add_total_row']) { $dataTable->queueFilter('AddSummaryRow', Piwik::translate('General_Total')); } $dataTable->applyQueuedFilters(); $this->initChartObjectData($dataTable, $visualization); } return $visualization->render(); }
php
public function generate($dataTable) { $visualization = new Chart(); if ($dataTable->getRowsCount() > 0) { // if addTotalRow was called in GenerateGraphHTML, add a row containing totals of // different metrics if ($this->properties['add_total_row']) { $dataTable->queueFilter('AddSummaryRow', Piwik::translate('General_Total')); } $dataTable->applyQueuedFilters(); $this->initChartObjectData($dataTable, $visualization); } return $visualization->render(); }
[ "public", "function", "generate", "(", "$", "dataTable", ")", "{", "$", "visualization", "=", "new", "Chart", "(", ")", ";", "if", "(", "$", "dataTable", "->", "getRowsCount", "(", ")", ">", "0", ")", "{", "// if addTotalRow was called in GenerateGraphHTML, ad...
Generates JSON graph data and returns it. @param DataTable|DataTable\Map $dataTable @return string
[ "Generates", "JSON", "graph", "data", "and", "returns", "it", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreVisualizations/JqplotDataGenerator.php#L78-L94
train
Generate the chart
[ 30522, 2270, 3853, 9699, 1006, 1002, 2951, 10880, 1007, 1063, 1002, 5107, 3989, 1027, 2047, 3673, 1006, 1007, 1025, 2065, 1006, 1002, 2951, 10880, 1011, 1028, 2131, 10524, 9363, 16671, 1006, 1007, 1028, 1014, 1007, 1063, 1013, 1013, 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...
overtrue/wechat
src/OfficialAccount/Broadcasting/Client.php
Client.previewMessage
public function previewMessage(MessageInterface $message, string $reception, $method = self::PREVIEW_BY_OPENID) { $message = (new MessageBuilder())->message($message)->buildForPreview($method, $reception); return $this->preview($message); }
php
public function previewMessage(MessageInterface $message, string $reception, $method = self::PREVIEW_BY_OPENID) { $message = (new MessageBuilder())->message($message)->buildForPreview($method, $reception); return $this->preview($message); }
[ "public", "function", "previewMessage", "(", "MessageInterface", "$", "message", ",", "string", "$", "reception", ",", "$", "method", "=", "self", "::", "PREVIEW_BY_OPENID", ")", "{", "$", "message", "=", "(", "new", "MessageBuilder", "(", ")", ")", "->", ...
@param \EasyWeChat\Kernel\Contracts\MessageInterface $message @param mixed $reception @param string $method @return mixed @throws \EasyWeChat\Kernel\Exceptions\RuntimeException @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "@param", "\\", "EasyWeChat", "\\", "Kernel", "\\", "Contracts", "\\", "MessageInterface", "$message", "@param", "mixed", "$reception", "@param", "string", "$method" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L331-L336
train
Preview a message
[ 30522, 2270, 3853, 19236, 7834, 3736, 3351, 1006, 4471, 18447, 2121, 12172, 1002, 4471, 1010, 5164, 1002, 7684, 1010, 1002, 4118, 1027, 2969, 1024, 1024, 19236, 1035, 2011, 1035, 2330, 3593, 1007, 1063, 1002, 4471, 1027, 1006, 2047, 4471, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Pagination/Paginator.php
Paginator.setItems
protected function setItems($items) { $this->items = $items instanceof Collection ? $items : Collection::make($items); $this->hasMore = $this->items->count() > $this->perPage; $this->items = $this->items->slice(0, $this->perPage); }
php
protected function setItems($items) { $this->items = $items instanceof Collection ? $items : Collection::make($items); $this->hasMore = $this->items->count() > $this->perPage; $this->items = $this->items->slice(0, $this->perPage); }
[ "protected", "function", "setItems", "(", "$", "items", ")", "{", "$", "this", "->", "items", "=", "$", "items", "instanceof", "Collection", "?", "$", "items", ":", "Collection", "::", "make", "(", "$", "items", ")", ";", "$", "this", "->", "hasMore", ...
Set the items for the paginator. @param mixed $items @return void
[ "Set", "the", "items", "for", "the", "paginator", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Pagination/Paginator.php#L67-L74
train
Set the items to be displayed on the page
[ 30522, 5123, 3853, 2275, 4221, 5244, 1006, 1002, 5167, 1007, 1063, 1002, 2023, 1011, 1028, 5167, 1027, 1002, 5167, 6013, 11253, 3074, 1029, 1002, 5167, 1024, 3074, 1024, 1024, 2191, 30524, 1006, 1007, 1028, 1002, 2023, 1011, 1028, 2566, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/KeyGenerateCommand.php
KeyGenerateCommand.setKeyInEnvironmentFile
protected function setKeyInEnvironmentFile($key) { $currentKey = $this->laravel['config']['app.key']; if (strlen($currentKey) !== 0 && (! $this->confirmToProceed())) { return false; } $this->writeNewEnvironmentFileWith($key); return true; }
php
protected function setKeyInEnvironmentFile($key) { $currentKey = $this->laravel['config']['app.key']; if (strlen($currentKey) !== 0 && (! $this->confirmToProceed())) { return false; } $this->writeNewEnvironmentFileWith($key); return true; }
[ "protected", "function", "setKeyInEnvironmentFile", "(", "$", "key", ")", "{", "$", "currentKey", "=", "$", "this", "->", "laravel", "[", "'config'", "]", "[", "'app.key'", "]", ";", "if", "(", "strlen", "(", "$", "currentKey", ")", "!==", "0", "&&", "...
Set the application key in the environment file. @param string $key @return bool
[ "Set", "the", "application", "key", "in", "the", "environment", "file", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/KeyGenerateCommand.php#L72-L83
train
Set the application key in the environment file.
[ 30522, 5123, 3853, 2275, 14839, 21820, 21663, 2239, 3672, 8873, 2571, 1006, 1002, 3145, 1007, 1063, 1002, 2783, 14839, 1027, 1002, 2023, 1011, 1028, 13679, 15985, 1031, 1005, 9530, 8873, 2290, 1005, 1033, 1031, 1005, 10439, 1012, 3145, 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...
symfony/symfony
src/Symfony/Component/Config/Definition/BaseNode.php
BaseNode.finalize
final public function finalize($value) { if ($value !== $placeholders = self::resolvePlaceholderValue($value)) { foreach ($placeholders as $placeholder) { $this->handlingPlaceholder = $value; try { $this->finalize($placeholder); } finally { $this->handlingPlaceholder = null; } } return $value; } $this->doValidateType($value); $value = $this->finalizeValue($value); // Perform validation on the final value if a closure has been set. // The closure is also allowed to return another value. foreach ($this->finalValidationClosures as $closure) { try { $value = $closure($value); } catch (Exception $e) { if ($e instanceof UnsetKeyException && null !== $this->handlingPlaceholder) { continue; } throw $e; } catch (\Exception $e) { throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s', $this->getPath(), $e->getMessage()), $e->getCode(), $e); } } return $value; }
php
final public function finalize($value) { if ($value !== $placeholders = self::resolvePlaceholderValue($value)) { foreach ($placeholders as $placeholder) { $this->handlingPlaceholder = $value; try { $this->finalize($placeholder); } finally { $this->handlingPlaceholder = null; } } return $value; } $this->doValidateType($value); $value = $this->finalizeValue($value); // Perform validation on the final value if a closure has been set. // The closure is also allowed to return another value. foreach ($this->finalValidationClosures as $closure) { try { $value = $closure($value); } catch (Exception $e) { if ($e instanceof UnsetKeyException && null !== $this->handlingPlaceholder) { continue; } throw $e; } catch (\Exception $e) { throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s', $this->getPath(), $e->getMessage()), $e->getCode(), $e); } } return $value; }
[ "final", "public", "function", "finalize", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "$", "placeholders", "=", "self", "::", "resolvePlaceholderValue", "(", "$", "value", ")", ")", "{", "foreach", "(", "$", "placeholders", "as", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/BaseNode.php#L391-L427
train
Finalizes the value and validates it.
[ 30522, 2345, 2270, 3853, 2345, 4697, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 1002, 3643, 999, 1027, 1027, 1002, 2173, 17794, 1027, 2969, 1024, 1024, 10663, 24759, 10732, 14528, 10175, 5657, 1006, 1002, 3643, 1007, 1007, 1063, 18921, 6776,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Protocol/Imap.php
Zend_Mail_Protocol_Imap.sendRequest
public function sendRequest($command, $tokens = array(), &$tag = null) { if (!$tag) { ++$this->_tagCount; $tag = 'TAG' . $this->_tagCount; } $line = $tag . ' ' . $command; foreach ($tokens as $token) { if (is_array($token)) { if (@fputs($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?'); } if (!$this->_assumedNextLine('+ ')) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('cannot send literal string'); } $line = $token[1]; } else { $line .= ' ' . $token; } } if (@fputs($this->_socket, $line . "\r\n") === false) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?'); } }
php
public function sendRequest($command, $tokens = array(), &$tag = null) { if (!$tag) { ++$this->_tagCount; $tag = 'TAG' . $this->_tagCount; } $line = $tag . ' ' . $command; foreach ($tokens as $token) { if (is_array($token)) { if (@fputs($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?'); } if (!$this->_assumedNextLine('+ ')) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('cannot send literal string'); } $line = $token[1]; } else { $line .= ' ' . $token; } } if (@fputs($this->_socket, $line . "\r\n") === false) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?'); } }
[ "public", "function", "sendRequest", "(", "$", "command", ",", "$", "tokens", "=", "array", "(", ")", ",", "&", "$", "tag", "=", "null", ")", "{", "if", "(", "!", "$", "tag", ")", "{", "++", "$", "this", "->", "_tagCount", ";", "$", "tag", "=",...
send a request @param string $command your request command @param array $tokens additional parameters to command, use escapeString() to prepare @param string $tag provide a tag otherwise an autogenerated is returned @return null @throws Zend_Mail_Protocol_Exception
[ "send", "a", "request" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Imap.php#L336-L374
train
Send a request to the server
[ 30522, 2270, 3853, 4604, 2890, 15500, 1006, 1002, 3094, 1010, 1002, 19204, 2015, 1027, 9140, 1006, 1007, 1010, 1004, 1002, 6415, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 6415, 1007, 1063, 1009, 1009, 1002, 2023, 1011, 1028, 1035, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Field/UploadField.php
UploadField.generateSequenceName
protected function generateSequenceName(UploadedFile $file) { $index = 1; $extension = $file->getClientOriginalExtension(); $originalName = $file->getClientOriginalName(); $newName = $originalName.'_'.$index.'.'.$extension; while ($this->storage->exists("{$this->getDirectory()}/$newName")) { $index++; $newName = $originalName.'_'.$index.'.'.$extension; } return $newName; }
php
protected function generateSequenceName(UploadedFile $file) { $index = 1; $extension = $file->getClientOriginalExtension(); $originalName = $file->getClientOriginalName(); $newName = $originalName.'_'.$index.'.'.$extension; while ($this->storage->exists("{$this->getDirectory()}/$newName")) { $index++; $newName = $originalName.'_'.$index.'.'.$extension; } return $newName; }
[ "protected", "function", "generateSequenceName", "(", "UploadedFile", "$", "file", ")", "{", "$", "index", "=", "1", ";", "$", "extension", "=", "$", "file", "->", "getClientOriginalExtension", "(", ")", ";", "$", "originalName", "=", "$", "file", "->", "g...
Generate a sequence name for uploaded file. @param UploadedFile $file @return string
[ "Generate", "a", "sequence", "name", "for", "uploaded", "file", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L359-L372
train
Generate sequence name
[ 30522, 5123, 3853, 19421, 2063, 4226, 5897, 18442, 1006, 21345, 8873, 2571, 1002, 5371, 1007, 1063, 1002, 5950, 1027, 1015, 1025, 1002, 5331, 1027, 1002, 5371, 1011, 1028, 2131, 20464, 11638, 10050, 24965, 10288, 29048, 1006, 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...
symfony/symfony
src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
RecursiveContextualValidator.validateGenericNode
private function validateGenericNode($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) { $context->setNode($value, $object, $metadata, $propertyPath); foreach ($groups as $key => $group) { if ($group instanceof GroupSequence) { $this->stepThroughGroupSequence( $value, $object, $cacheKey, $metadata, $propertyPath, $traversalStrategy, $group, null, $context ); // Skip the group sequence when cascading, as the cascading // logic is already done in stepThroughGroupSequence() unset($groups[$key]); continue; } $this->validateInGroup($value, $cacheKey, $metadata, $group, $context); } if (0 === \count($groups)) { return; } if (null === $value) { return; } $cascadingStrategy = $metadata->getCascadingStrategy(); // Quit unless we cascade if (!($cascadingStrategy & CascadingStrategy::CASCADE)) { return; } // If no specific traversal strategy was requested when this method // was called, use the traversal strategy of the node's metadata if ($traversalStrategy & TraversalStrategy::IMPLICIT) { $traversalStrategy = $metadata->getTraversalStrategy(); } // The $cascadedGroups property is set, if the "Default" group is // overridden by a group sequence // See validateClassNode() $cascadedGroups = null !== $cascadedGroups && \count($cascadedGroups) > 0 ? $cascadedGroups : $groups; if (\is_array($value)) { // Arrays are always traversed, independent of the specified // traversal strategy $this->validateEachObjectIn( $value, $propertyPath, $cascadedGroups, $context ); return; } // If the value is a scalar, pass it anyway, because we want // a NoSuchMetadataException to be thrown in that case $this->validateObject( $value, $propertyPath, $cascadedGroups, $traversalStrategy, $context ); // Currently, the traversal strategy can only be TRAVERSE for a // generic node if the cascading strategy is CASCADE. Thus, traversable // objects will always be handled within validateObject() and there's // nothing more to do here. // see GenericMetadata::addConstraint() }
php
private function validateGenericNode($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) { $context->setNode($value, $object, $metadata, $propertyPath); foreach ($groups as $key => $group) { if ($group instanceof GroupSequence) { $this->stepThroughGroupSequence( $value, $object, $cacheKey, $metadata, $propertyPath, $traversalStrategy, $group, null, $context ); // Skip the group sequence when cascading, as the cascading // logic is already done in stepThroughGroupSequence() unset($groups[$key]); continue; } $this->validateInGroup($value, $cacheKey, $metadata, $group, $context); } if (0 === \count($groups)) { return; } if (null === $value) { return; } $cascadingStrategy = $metadata->getCascadingStrategy(); // Quit unless we cascade if (!($cascadingStrategy & CascadingStrategy::CASCADE)) { return; } // If no specific traversal strategy was requested when this method // was called, use the traversal strategy of the node's metadata if ($traversalStrategy & TraversalStrategy::IMPLICIT) { $traversalStrategy = $metadata->getTraversalStrategy(); } // The $cascadedGroups property is set, if the "Default" group is // overridden by a group sequence // See validateClassNode() $cascadedGroups = null !== $cascadedGroups && \count($cascadedGroups) > 0 ? $cascadedGroups : $groups; if (\is_array($value)) { // Arrays are always traversed, independent of the specified // traversal strategy $this->validateEachObjectIn( $value, $propertyPath, $cascadedGroups, $context ); return; } // If the value is a scalar, pass it anyway, because we want // a NoSuchMetadataException to be thrown in that case $this->validateObject( $value, $propertyPath, $cascadedGroups, $traversalStrategy, $context ); // Currently, the traversal strategy can only be TRAVERSE for a // generic node if the cascading strategy is CASCADE. Thus, traversable // objects will always be handled within validateObject() and there's // nothing more to do here. // see GenericMetadata::addConstraint() }
[ "private", "function", "validateGenericNode", "(", "$", "value", ",", "$", "object", ",", "$", "cacheKey", ",", "MetadataInterface", "$", "metadata", "=", "null", ",", "$", "propertyPath", ",", "array", "$", "groups", ",", "$", "cascadedGroups", ",", "$", ...
Validates a node that is not a class node. Currently, two such node types exist: - property nodes, which consist of the value of an object's property together with a {@link PropertyMetadataInterface} instance - generic nodes, which consist of a value and some arbitrary constraints defined in a {@link MetadataInterface} container In both cases, the value is validated against all constraints defined in the passed metadata object. Then, if the value is an instance of {@link \Traversable} and the selected traversal strategy permits it, the value is traversed and each nested object validated against its own constraints. If the value is an array, it is traversed regardless of the given strategy. @param mixed $value The validated value @param object|null $object The current object @param string $cacheKey The key for caching the validated value @param MetadataInterface $metadata The metadata of the value @param string $propertyPath The property path leading to the value @param (string|GroupSequence)[] $groups The groups in which the value should be validated @param string[]|null $cascadedGroups The groups in which cascaded objects should be validated @param int $traversalStrategy The strategy used for traversing the value @param ExecutionContextInterface $context The current execution context @see TraversalStrategy
[ "Validates", "a", "node", "that", "is", "not", "a", "class", "node", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php#L619-L702
train
Validates a generic node
[ 30522, 2797, 3853, 9398, 3686, 6914, 22420, 3630, 3207, 1006, 1002, 3643, 1010, 1002, 4874, 1010, 1002, 17053, 14839, 1010, 27425, 18447, 2121, 12172, 1002, 27425, 1027, 19701, 1010, 1002, 3200, 15069, 1010, 9140, 1002, 2967, 1010, 1002, 16...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.presentOrRuleIsImplicit
protected function presentOrRuleIsImplicit($rule, $attribute, $value) { if (is_string($value) && trim($value) === '') { return $this->isImplicit($rule); } return $this->validatePresent($attribute, $value) || $this->isImplicit($rule); }
php
protected function presentOrRuleIsImplicit($rule, $attribute, $value) { if (is_string($value) && trim($value) === '') { return $this->isImplicit($rule); } return $this->validatePresent($attribute, $value) || $this->isImplicit($rule); }
[ "protected", "function", "presentOrRuleIsImplicit", "(", "$", "rule", ",", "$", "attribute", ",", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", "&&", "trim", "(", "$", "value", ")", "===", "''", ")", "{", "return", "$", "thi...
Determine if the field is present, or the rule implies required. @param object|string $rule @param string $attribute @param mixed $value @return bool
[ "Determine", "if", "the", "field", "is", "present", "or", "the", "rule", "implies", "required", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L492-L500
train
Check if the present or implicit rule is implicit
[ 30522, 5123, 3853, 2556, 2953, 6820, 23057, 5332, 8737, 10415, 4183, 1006, 1002, 3627, 1010, 1002, 17961, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 3643, 1007, 1004, 1004, 12241, 1006, 1002, 3643, 1007, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/twig/DebugExtension.php
DebugExtension.evalObjLabel
protected function evalObjLabel($variable) { $class = get_class($variable); $label = class_basename($variable); if ($variable instanceof ComponentBase) { $label = '<strong>Component</strong>'; } elseif ($variable instanceof Collection) { $label = 'Collection('.$variable->count().')'; } elseif ($variable instanceof Paginator) { $label = 'Paged Collection('.$variable->count().')'; } elseif ($variable instanceof Model) { $label = 'Model'; } return '<abbr title="'.e($class).'">'.$label.'</abbr>'; }
php
protected function evalObjLabel($variable) { $class = get_class($variable); $label = class_basename($variable); if ($variable instanceof ComponentBase) { $label = '<strong>Component</strong>'; } elseif ($variable instanceof Collection) { $label = 'Collection('.$variable->count().')'; } elseif ($variable instanceof Paginator) { $label = 'Paged Collection('.$variable->count().')'; } elseif ($variable instanceof Model) { $label = 'Model'; } return '<abbr title="'.e($class).'">'.$label.'</abbr>'; }
[ "protected", "function", "evalObjLabel", "(", "$", "variable", ")", "{", "$", "class", "=", "get_class", "(", "$", "variable", ")", ";", "$", "label", "=", "class_basename", "(", "$", "variable", ")", ";", "if", "(", "$", "variable", "instanceof", "Compo...
Evaluate an object type for label @param object $variable @return string
[ "Evaluate", "an", "object", "type", "for", "label" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/DebugExtension.php#L316-L335
train
Evaluate object label
[ 30522, 5123, 3853, 9345, 4135, 2497, 3501, 20470, 2884, 1006, 1002, 8023, 1007, 1063, 1002, 2465, 1027, 2131, 1035, 2465, 1006, 1002, 8023, 1007, 1025, 1002, 3830, 1027, 2465, 1035, 2918, 18442, 1006, 1002, 8023, 1007, 1025, 2065, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Collection.php
Collection.getQueueableClass
public function getQueueableClass() { if ($this->isEmpty()) { return; } $class = get_class($this->first()); $this->each(function ($model) use ($class) { if (get_class($model) !== $class) { throw new LogicException('Queueing collections with multiple model types is not supported.'); } }); return $class; }
php
public function getQueueableClass() { if ($this->isEmpty()) { return; } $class = get_class($this->first()); $this->each(function ($model) use ($class) { if (get_class($model) !== $class) { throw new LogicException('Queueing collections with multiple model types is not supported.'); } }); return $class; }
[ "public", "function", "getQueueableClass", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "$", "class", "=", "get_class", "(", "$", "this", "->", "first", "(", ")", ")", ";", "$", "this", "->", "ea...
Get the type of the entities being queued. @return string|null @throws \LogicException
[ "Get", "the", "type", "of", "the", "entities", "being", "queued", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Collection.php#L516-L531
train
Get the queueable class of the model
[ 30522, 2270, 3853, 2131, 4226, 5657, 3085, 26266, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 2465, 1027, 2131, 1035, 2465, 1006, 1002, 2023, 1011, 1028, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.relationsNestedUnder
protected function relationsNestedUnder($relation) { $nested = []; // We are basically looking for any relationships that are nested deeper than // the given top-level relationship. We will just check for any relations // that start with the given top relations and adds them to our arrays. foreach ($this->eagerLoad as $name => $constraints) { if ($this->isNestedUnder($relation, $name)) { $nested[substr($name, strlen($relation.'.'))] = $constraints; } } return $nested; }
php
protected function relationsNestedUnder($relation) { $nested = []; // We are basically looking for any relationships that are nested deeper than // the given top-level relationship. We will just check for any relations // that start with the given top relations and adds them to our arrays. foreach ($this->eagerLoad as $name => $constraints) { if ($this->isNestedUnder($relation, $name)) { $nested[substr($name, strlen($relation.'.'))] = $constraints; } } return $nested; }
[ "protected", "function", "relationsNestedUnder", "(", "$", "relation", ")", "{", "$", "nested", "=", "[", "]", ";", "// We are basically looking for any relationships that are nested deeper than", "// the given top-level relationship. We will just check for any relations", "// that s...
Get the deeply nested relations for a given top-level relation. @param string $relation @return array
[ "Get", "the", "deeply", "nested", "relations", "for", "a", "given", "top", "-", "level", "relation", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L608-L622
train
Returns the nested constraints for the given top - level relationship.
[ 30522, 5123, 3853, 4262, 5267, 3064, 20824, 1006, 1002, 7189, 1007, 1063, 1002, 9089, 2098, 1027, 1031, 1033, 1025, 1013, 1013, 2057, 2024, 10468, 2559, 2005, 2151, 6550, 2008, 2024, 9089, 2098, 6748, 2084, 1013, 1013, 1996, 2445, 2327, 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/Redis/Connections/PhpRedisConnection.php
PhpRedisConnection.evalsha
public function evalsha($script, $numkeys, ...$arguments) { return $this->command('evalsha', [ $this->script('load', $script), $arguments, $numkeys, ]); }
php
public function evalsha($script, $numkeys, ...$arguments) { return $this->command('evalsha', [ $this->script('load', $script), $arguments, $numkeys, ]); }
[ "public", "function", "evalsha", "(", "$", "script", ",", "$", "numkeys", ",", "...", "$", "arguments", ")", "{", "return", "$", "this", "->", "command", "(", "'evalsha'", ",", "[", "$", "this", "->", "script", "(", "'load'", ",", "$", "script", ")",...
Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. @param string $script @param int $numkeys @param mixed $arguments @return mixed
[ "Evaluate", "a", "LUA", "script", "serverside", "from", "the", "SHA1", "hash", "of", "the", "script", "instead", "of", "the", "script", "itself", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L330-L335
train
Evaluate a SHA1 hash of a string or array of strings.
[ 30522, 2270, 3853, 9345, 4877, 3270, 1006, 1002, 5896, 1010, 1002, 16371, 2213, 14839, 2015, 1010, 1012, 1012, 1012, 1002, 9918, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 3094, 1006, 1005, 9345, 4877, 3270, 1005, 1010, 1031, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php
ContainerParametersResourceChecker.isFresh
public function isFresh(ResourceInterface $resource, $timestamp) { foreach ($resource->getParameters() as $key => $value) { if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { return false; } } return true; }
php
public function isFresh(ResourceInterface $resource, $timestamp) { foreach ($resource->getParameters() as $key => $value) { if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { return false; } } return true; }
[ "public", "function", "isFresh", "(", "ResourceInterface", "$", "resource", ",", "$", "timestamp", ")", "{", "foreach", "(", "$", "resource", "->", "getParameters", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "$", "this", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php#L42-L51
train
Fresh method that checks if container is fresh
[ 30522, 2270, 3853, 2003, 19699, 9953, 1006, 7692, 18447, 2121, 12172, 1002, 7692, 1010, 1002, 2335, 15464, 2361, 1007, 1063, 18921, 6776, 1006, 1002, 7692, 1011, 1028, 2131, 28689, 22828, 2015, 1006, 1007, 2004, 1002, 3145, 1027, 1028, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form.php
Form.registerBuiltinFields
public static function registerBuiltinFields() { $map = [ 'button' => Field\Button::class, 'checkbox' => Field\Checkbox::class, 'color' => Field\Color::class, 'currency' => Field\Currency::class, 'date' => Field\Date::class, 'dateRange' => Field\DateRange::class, 'datetime' => Field\Datetime::class, 'dateTimeRange' => Field\DatetimeRange::class, 'datetimeRange' => Field\DatetimeRange::class, 'decimal' => Field\Decimal::class, 'display' => Field\Display::class, 'divider' => Field\Divide::class, 'divide' => Field\Divide::class, 'embeds' => Field\Embeds::class, 'editor' => Field\Editor::class, 'email' => Field\Email::class, 'file' => Field\File::class, 'hasMany' => Field\HasMany::class, 'hidden' => Field\Hidden::class, 'id' => Field\Id::class, 'image' => Field\Image::class, 'ip' => Field\Ip::class, 'map' => Field\Map::class, 'mobile' => Field\Mobile::class, 'month' => Field\Month::class, 'multipleSelect' => Field\MultipleSelect::class, 'number' => Field\Number::class, 'password' => Field\Password::class, 'radio' => Field\Radio::class, 'rate' => Field\Rate::class, 'select' => Field\Select::class, 'slider' => Field\Slider::class, 'switch' => Field\SwitchField::class, 'text' => Field\Text::class, 'textarea' => Field\Textarea::class, 'time' => Field\Time::class, 'timeRange' => Field\TimeRange::class, 'url' => Field\Url::class, 'year' => Field\Year::class, 'html' => Field\Html::class, 'tags' => Field\Tags::class, 'icon' => Field\Icon::class, 'multipleFile' => Field\MultipleFile::class, 'multipleImage' => Field\MultipleImage::class, 'captcha' => Field\Captcha::class, 'listbox' => Field\Listbox::class, 'table' => Field\Table::class, ]; foreach ($map as $abstract => $class) { static::extend($abstract, $class); } }
php
public static function registerBuiltinFields() { $map = [ 'button' => Field\Button::class, 'checkbox' => Field\Checkbox::class, 'color' => Field\Color::class, 'currency' => Field\Currency::class, 'date' => Field\Date::class, 'dateRange' => Field\DateRange::class, 'datetime' => Field\Datetime::class, 'dateTimeRange' => Field\DatetimeRange::class, 'datetimeRange' => Field\DatetimeRange::class, 'decimal' => Field\Decimal::class, 'display' => Field\Display::class, 'divider' => Field\Divide::class, 'divide' => Field\Divide::class, 'embeds' => Field\Embeds::class, 'editor' => Field\Editor::class, 'email' => Field\Email::class, 'file' => Field\File::class, 'hasMany' => Field\HasMany::class, 'hidden' => Field\Hidden::class, 'id' => Field\Id::class, 'image' => Field\Image::class, 'ip' => Field\Ip::class, 'map' => Field\Map::class, 'mobile' => Field\Mobile::class, 'month' => Field\Month::class, 'multipleSelect' => Field\MultipleSelect::class, 'number' => Field\Number::class, 'password' => Field\Password::class, 'radio' => Field\Radio::class, 'rate' => Field\Rate::class, 'select' => Field\Select::class, 'slider' => Field\Slider::class, 'switch' => Field\SwitchField::class, 'text' => Field\Text::class, 'textarea' => Field\Textarea::class, 'time' => Field\Time::class, 'timeRange' => Field\TimeRange::class, 'url' => Field\Url::class, 'year' => Field\Year::class, 'html' => Field\Html::class, 'tags' => Field\Tags::class, 'icon' => Field\Icon::class, 'multipleFile' => Field\MultipleFile::class, 'multipleImage' => Field\MultipleImage::class, 'captcha' => Field\Captcha::class, 'listbox' => Field\Listbox::class, 'table' => Field\Table::class, ]; foreach ($map as $abstract => $class) { static::extend($abstract, $class); } }
[ "public", "static", "function", "registerBuiltinFields", "(", ")", "{", "$", "map", "=", "[", "'button'", "=>", "Field", "\\", "Button", "::", "class", ",", "'checkbox'", "=>", "Field", "\\", "Checkbox", "::", "class", ",", "'color'", "=>", "Field", "\\", ...
Register builtin fields. @return void
[ "Register", "builtin", "fields", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1392-L1447
train
Register builtin fields
[ 30522, 2270, 10763, 3853, 4236, 8569, 4014, 7629, 15155, 1006, 1007, 1063, 1002, 4949, 1027, 1031, 1005, 6462, 1005, 1027, 1028, 2492, 1032, 6462, 1024, 1024, 2465, 1010, 1005, 4638, 8758, 1005, 1027, 1028, 2492, 1032, 4638, 8758, 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...
octobercms/october
modules/backend/classes/NavigationManager.php
NavigationManager.getContextSidenavPartial
public function getContextSidenavPartial($owner, $mainMenuItemCode) { $key = $owner.$mainMenuItemCode; return $this->contextSidenavPartials[$key] ?? null; }
php
public function getContextSidenavPartial($owner, $mainMenuItemCode) { $key = $owner.$mainMenuItemCode; return $this->contextSidenavPartials[$key] ?? null; }
[ "public", "function", "getContextSidenavPartial", "(", "$", "owner", ",", "$", "mainMenuItemCode", ")", "{", "$", "key", "=", "$", "owner", ".", "$", "mainMenuItemCode", ";", "return", "$", "this", "->", "contextSidenavPartials", "[", "$", "key", "]", "??", ...
Returns the side navigation partial for a specific main menu previously registered with the registerContextSidenavPartial() method. @param string $owner Specifies the navigation owner in the format Vendor/Module. @param string $mainMenuItemCode Specifies the main menu item code. @return mixed Returns the partial name or null.
[ "Returns", "the", "side", "navigation", "partial", "for", "a", "specific", "main", "menu", "previously", "registered", "with", "the", "registerContextSidenavPartial", "()", "method", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L465-L470
train
Get context sidenav partial
[ 30522, 2270, 3853, 2131, 8663, 18209, 7363, 2532, 2615, 19362, 20925, 1006, 1002, 3954, 1010, 1002, 2364, 3549, 14663, 6633, 16044, 1007, 1063, 1002, 3145, 1027, 1002, 3954, 1012, 1002, 2364, 3549, 14663, 6633, 16044, 1025, 2709, 1002, 2023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php
PhpSerializer.decode
public function decode(array $encodedEnvelope): Envelope { if (empty($encodedEnvelope['body'])) { throw new MessageDecodingFailedException('Encoded envelope should have at least a "body".'); } $serializeEnvelope = stripslashes($encodedEnvelope['body']); return $this->safelyUnserialize($serializeEnvelope); }
php
public function decode(array $encodedEnvelope): Envelope { if (empty($encodedEnvelope['body'])) { throw new MessageDecodingFailedException('Encoded envelope should have at least a "body".'); } $serializeEnvelope = stripslashes($encodedEnvelope['body']); return $this->safelyUnserialize($serializeEnvelope); }
[ "public", "function", "decode", "(", "array", "$", "encodedEnvelope", ")", ":", "Envelope", "{", "if", "(", "empty", "(", "$", "encodedEnvelope", "[", "'body'", "]", ")", ")", "{", "throw", "new", "MessageDecodingFailedException", "(", "'Encoded envelope should ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php#L27-L36
train
Decodes an array containing a envelope into a Envelope object
[ 30522, 2270, 3853, 21933, 3207, 1006, 9140, 1002, 12359, 2368, 15985, 17635, 1007, 1024, 11255, 1063, 2065, 1006, 4064, 1006, 1002, 12359, 2368, 15985, 17635, 1031, 1005, 2303, 1005, 1033, 1007, 1007, 1063, 5466, 2047, 4471, 3207, 3597, 466...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/FormConfigBuilder.php
FormConfigBuilder.setCompound
public function setCompound($compound) { if ($this->locked) { throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } $this->compound = (bool) $compound; return $this; }
php
public function setCompound($compound) { if ($this->locked) { throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } $this->compound = (bool) $compound; return $this; }
[ "public", "function", "setCompound", "(", "$", "compound", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "BadMethodCallException", "(", "'FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface i...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormConfigBuilder.php#L628-L637
train
Set whether or not the form should be compound or not.
[ 30522, 2270, 3853, 2275, 9006, 6873, 8630, 1006, 1002, 7328, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 2919, 11368, 6806, 16409, 24164, 2595, 24422, 1006, 1005, 2433, 8663, 8873, 18259, 19231, 4063, 4725,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TwoLevels.php
Zend_Cache_Backend_TwoLevels.remove
public function remove($id) { $boolFast = $this->_fastBackend->remove($id); $boolSlow = $this->_slowBackend->remove($id); return $boolFast && $boolSlow; }
php
public function remove($id) { $boolFast = $this->_fastBackend->remove($id); $boolSlow = $this->_slowBackend->remove($id); return $boolFast && $boolSlow; }
[ "public", "function", "remove", "(", "$", "id", ")", "{", "$", "boolFast", "=", "$", "this", "->", "_fastBackend", "->", "remove", "(", "$", "id", ")", ";", "$", "boolSlow", "=", "$", "this", "->", "_slowBackend", "->", "remove", "(", "$", "id", ")...
Remove a cache record @param string $id Cache id @return boolean True if no problem
[ "Remove", "a", "cache", "record" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/TwoLevels.php#L259-L264
train
Remove a record from the cache
[ 30522, 2270, 3853, 6366, 1006, 1002, 8909, 1007, 1063, 1002, 22017, 10270, 14083, 1027, 1002, 2023, 1011, 1028, 1035, 3435, 5963, 10497, 1011, 1028, 6366, 1006, 1002, 8909, 1007, 1025, 1002, 22017, 4877, 8261, 1027, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/Twig.php
Twig.processString
public function processString($string, array $vars = []) { // override the twig header vars for local resolution $this->grav->fireEvent('onTwigStringVariables'); $vars += $this->twig_vars; $name = '@Var:' . $string; $this->setTemplate($name, $string); try { $output = $this->twig->render($name, $vars); } catch (\Twig_Error_Loader $e) { throw new \RuntimeException($e->getRawMessage(), 404, $e); } return $output; }
php
public function processString($string, array $vars = []) { // override the twig header vars for local resolution $this->grav->fireEvent('onTwigStringVariables'); $vars += $this->twig_vars; $name = '@Var:' . $string; $this->setTemplate($name, $string); try { $output = $this->twig->render($name, $vars); } catch (\Twig_Error_Loader $e) { throw new \RuntimeException($e->getRawMessage(), 404, $e); } return $output; }
[ "public", "function", "processString", "(", "$", "string", ",", "array", "$", "vars", "=", "[", "]", ")", "{", "// override the twig header vars for local resolution", "$", "this", "->", "grav", "->", "fireEvent", "(", "'onTwigStringVariables'", ")", ";", "$", "...
Process a Twig template directly by using a Twig string and optional array of variables @param string $string string to render. @param array $vars Optional variables @return string
[ "Process", "a", "Twig", "template", "directly", "by", "using", "a", "Twig", "string", "and", "optional", "array", "of", "variables" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/Twig.php#L333-L349
train
processString - render a string
[ 30522, 2270, 3853, 2832, 3367, 4892, 1006, 1002, 5164, 1010, 9140, 1002, 13075, 2015, 1027, 1031, 1033, 1007, 1063, 1013, 1013, 2058, 15637, 1996, 1056, 16279, 20346, 13075, 2015, 2005, 2334, 5813, 1002, 2023, 1011, 1028, 24665, 11431, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php
GuardsAttributes.fillableFromArray
protected function fillableFromArray(array $attributes) { if (count($this->getFillable()) > 0 && ! static::$unguarded) { return array_intersect_key($attributes, array_flip($this->getFillable())); } return $attributes; }
php
protected function fillableFromArray(array $attributes) { if (count($this->getFillable()) > 0 && ! static::$unguarded) { return array_intersect_key($attributes, array_flip($this->getFillable())); } return $attributes; }
[ "protected", "function", "fillableFromArray", "(", "array", "$", "attributes", ")", "{", "if", "(", "count", "(", "$", "this", "->", "getFillable", "(", ")", ")", ">", "0", "&&", "!", "static", "::", "$", "unguarded", ")", "{", "return", "array_intersect...
Get the fillable attributes of a given array. @param array $attributes @return array
[ "Get", "the", "fillable", "attributes", "of", "a", "given", "array", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php#L185-L192
train
Fillable Array From Array
[ 30522, 5123, 3853, 6039, 3085, 19699, 9626, 11335, 2100, 1006, 9140, 1002, 12332, 1007, 1063, 2065, 1006, 4175, 1006, 1002, 2023, 1011, 1028, 2131, 8873, 4571, 3468, 1006, 1007, 1007, 1028, 1014, 1004, 1004, 999, 10763, 1024, 1024, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/VarExporter/VarExporter.php
VarExporter.export
public static function export($value, bool &$isStaticValue = null): string { $isStaticValue = true; if (!\is_object($value) && !(\is_array($value) && $value) && !$value instanceof \__PHP_Incomplete_Class && !\is_resource($value)) { return Exporter::export($value); } $objectsPool = new \SplObjectStorage(); $refsPool = []; $objectsCount = 0; try { $value = Exporter::prepare([$value], $objectsPool, $refsPool, $objectsCount, $isStaticValue)[0]; } finally { $references = []; foreach ($refsPool as $i => $v) { if ($v[0]->count) { $references[1 + $i] = $v[2]; } $v[0] = $v[1]; } } if ($isStaticValue) { return Exporter::export($value); } $classes = []; $values = []; $states = []; foreach ($objectsPool as $i => $v) { list(, $classes[], $values[], $wakeup) = $objectsPool[$v]; if (0 < $wakeup) { $states[$wakeup] = $i; } elseif (0 > $wakeup) { $states[-$wakeup] = [$i, array_pop($values)]; $values[] = []; } } ksort($states); $wakeups = [null]; foreach ($states as $k => $v) { if (\is_array($v)) { $wakeups[-$v[0]] = $v[1]; } else { $wakeups[] = $v; } } if (null === $wakeups[0]) { unset($wakeups[0]); } $properties = []; foreach ($values as $i => $vars) { foreach ($vars as $class => $values) { foreach ($values as $name => $v) { $properties[$class][$name][$i] = $v; } } } if ($classes || $references) { $value = new Hydrator(new Registry($classes), $references ? new Values($references) : null, $properties, $value, $wakeups); } else { $isStaticValue = true; } return Exporter::export($value); }
php
public static function export($value, bool &$isStaticValue = null): string { $isStaticValue = true; if (!\is_object($value) && !(\is_array($value) && $value) && !$value instanceof \__PHP_Incomplete_Class && !\is_resource($value)) { return Exporter::export($value); } $objectsPool = new \SplObjectStorage(); $refsPool = []; $objectsCount = 0; try { $value = Exporter::prepare([$value], $objectsPool, $refsPool, $objectsCount, $isStaticValue)[0]; } finally { $references = []; foreach ($refsPool as $i => $v) { if ($v[0]->count) { $references[1 + $i] = $v[2]; } $v[0] = $v[1]; } } if ($isStaticValue) { return Exporter::export($value); } $classes = []; $values = []; $states = []; foreach ($objectsPool as $i => $v) { list(, $classes[], $values[], $wakeup) = $objectsPool[$v]; if (0 < $wakeup) { $states[$wakeup] = $i; } elseif (0 > $wakeup) { $states[-$wakeup] = [$i, array_pop($values)]; $values[] = []; } } ksort($states); $wakeups = [null]; foreach ($states as $k => $v) { if (\is_array($v)) { $wakeups[-$v[0]] = $v[1]; } else { $wakeups[] = $v; } } if (null === $wakeups[0]) { unset($wakeups[0]); } $properties = []; foreach ($values as $i => $vars) { foreach ($vars as $class => $values) { foreach ($values as $name => $v) { $properties[$class][$name][$i] = $v; } } } if ($classes || $references) { $value = new Hydrator(new Registry($classes), $references ? new Values($references) : null, $properties, $value, $wakeups); } else { $isStaticValue = true; } return Exporter::export($value); }
[ "public", "static", "function", "export", "(", "$", "value", ",", "bool", "&", "$", "isStaticValue", "=", "null", ")", ":", "string", "{", "$", "isStaticValue", "=", "true", ";", "if", "(", "!", "\\", "is_object", "(", "$", "value", ")", "&&", "!", ...
Exports a serializable PHP value to PHP code. @param mixed $value The value to export @param bool &$isStaticValue Set to true after execution if the provided value is static, false otherwise @return string The value exported as PHP code @throws ExceptionInterface When the provided value cannot be serialized
[ "Exports", "a", "serializable", "PHP", "value", "to", "PHP", "code", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarExporter/VarExporter.php#L42-L113
train
Exports the value as a string
[ 30522, 2270, 10763, 3853, 9167, 1006, 1002, 3643, 1010, 22017, 2140, 1004, 1002, 26354, 29336, 2594, 10175, 5657, 1027, 19701, 1007, 1024, 5164, 1063, 1002, 26354, 29336, 2594, 10175, 5657, 1027, 2995, 1025, 2065, 1006, 999, 1032, 2003, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Container.php
Container.compile
public function compile() { $this->parameterBag->resolve(); $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); $this->compiled = true; }
php
public function compile() { $this->parameterBag->resolve(); $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); $this->compiled = true; }
[ "public", "function", "compile", "(", ")", "{", "$", "this", "->", "parameterBag", "->", "resolve", "(", ")", ";", "$", "this", "->", "parameterBag", "=", "new", "FrozenParameterBag", "(", "$", "this", "->", "parameterBag", "->", "all", "(", ")", ")", ...
Compiles the container. This method does two things: * Parameter values are resolved; * The parameter bag is frozen.
[ "Compiles", "the", "container", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Container.php#L72-L79
train
Compiles the parameters into a single string
[ 30522, 2270, 3853, 4012, 22090, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 16381, 16078, 1011, 1028, 10663, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 16381, 16078, 1027, 2047, 7708, 28689, 22828, 16078, 1006, 1002, 2023, 1011, 1028, 16381, 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...
barryvdh/laravel-debugbar
src/migrations/2014_12_01_120000_create_phpdebugbar_storage_table.php
CreatePhpdebugbarStorageTable.up
public function up() { Schema::create('phpdebugbar', function (Blueprint $table) { $table->string('id'); $table->longText('data'); $table->string('meta_utime'); $table->dateTime('meta_datetime'); $table->string('meta_uri'); $table->string('meta_ip'); $table->string('meta_method'); $table->primary('id'); $table->index('meta_utime'); $table->index('meta_datetime'); $table->index('meta_uri'); $table->index('meta_ip'); $table->index('meta_method'); }); }
php
public function up() { Schema::create('phpdebugbar', function (Blueprint $table) { $table->string('id'); $table->longText('data'); $table->string('meta_utime'); $table->dateTime('meta_datetime'); $table->string('meta_uri'); $table->string('meta_ip'); $table->string('meta_method'); $table->primary('id'); $table->index('meta_utime'); $table->index('meta_datetime'); $table->index('meta_uri'); $table->index('meta_ip'); $table->index('meta_method'); }); }
[ "public", "function", "up", "(", ")", "{", "Schema", "::", "create", "(", "'phpdebugbar'", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "$", "table", "->", "string", "(", "'id'", ")", ";", "$", "table", "->", "longText", "(", "'data'", ...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/migrations/2014_12_01_120000_create_phpdebugbar_storage_table.php#L13-L31
train
Upgrades the table schema to the debugbar table
[ 30522, 2270, 3853, 2039, 1006, 1007, 1063, 8040, 28433, 1024, 1024, 3443, 1006, 1005, 25718, 3207, 8569, 18259, 2906, 1005, 1010, 3853, 1006, 2630, 16550, 1002, 2795, 1007, 1063, 1002, 2795, 1011, 1028, 5164, 1006, 1005, 8909, 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...
laravel/framework
src/Illuminate/Cache/TaggedCache.php
TaggedCache.putMany
public function putMany(array $values, $ttl = null) { if ($ttl === null) { return $this->putManyForever($values); } return $this->putManyAlias($values, $ttl); }
php
public function putMany(array $values, $ttl = null) { if ($ttl === null) { return $this->putManyForever($values); } return $this->putManyAlias($values, $ttl); }
[ "public", "function", "putMany", "(", "array", "$", "values", ",", "$", "ttl", "=", "null", ")", "{", "if", "(", "$", "ttl", "===", "null", ")", "{", "return", "$", "this", "->", "putManyForever", "(", "$", "values", ")", ";", "}", "return", "$", ...
Store multiple items in the cache for a given number of seconds. @param array $values @param int|null $ttl @return bool
[ "Store", "multiple", "items", "in", "the", "cache", "for", "a", "given", "number", "of", "seconds", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/TaggedCache.php#L41-L48
train
Put many values into the buffer
[ 30522, 2270, 3853, 2404, 2386, 2100, 1006, 9140, 1002, 5300, 1010, 1002, 23746, 2140, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 23746, 2140, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2404, 2386, 2100, 29278, 22507,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Config/ConfigFileFinder.php
ConfigFileFinder.detectRecursive
protected function detectRecursive($folder, $pattern, $levels) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_dir($folder)) { // Find all system and user configuration files. $options = [ 'levels' => $levels, 'compare' => 'Filename', 'pattern' => $pattern, 'filters' => [ 'pre-key' => $this->base, 'key' => $pattern, 'value' => function (\RecursiveDirectoryIterator $file) use ($path) { return ['file' => "{$path}/{$file->getSubPathname()}", 'modified' => $file->getMTime()]; } ], 'key' => 'SubPathname' ]; $list = Folder::all($folder, $options); ksort($list); } else { $list = []; } return [$path => $list]; }
php
protected function detectRecursive($folder, $pattern, $levels) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_dir($folder)) { // Find all system and user configuration files. $options = [ 'levels' => $levels, 'compare' => 'Filename', 'pattern' => $pattern, 'filters' => [ 'pre-key' => $this->base, 'key' => $pattern, 'value' => function (\RecursiveDirectoryIterator $file) use ($path) { return ['file' => "{$path}/{$file->getSubPathname()}", 'modified' => $file->getMTime()]; } ], 'key' => 'SubPathname' ]; $list = Folder::all($folder, $options); ksort($list); } else { $list = []; } return [$path => $list]; }
[ "protected", "function", "detectRecursive", "(", "$", "folder", ",", "$", "pattern", ",", "$", "levels", ")", "{", "$", "path", "=", "trim", "(", "Folder", "::", "getRelativePath", "(", "$", "folder", ")", ",", "'/'", ")", ";", "if", "(", "is_dir", "...
Detects all directories with a configuration file and returns them with last modification time. @param string $folder Location to look up from. @param string $pattern Pattern to match the file. Pattern will also be removed from the key. @param int $levels Maximum number of recursive directories. @return array @internal
[ "Detects", "all", "directories", "with", "a", "configuration", "file", "and", "returns", "them", "with", "last", "modification", "time", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L156-L184
train
Detects recursive files in a given folder
[ 30522, 5123, 3853, 11487, 2890, 10841, 2869, 3512, 1006, 1002, 19622, 1010, 1002, 5418, 1010, 1002, 3798, 1007, 1063, 1002, 4130, 1027, 12241, 1006, 19622, 1024, 1024, 2131, 16570, 8082, 15069, 1006, 1002, 19622, 1007, 1010, 1005, 1013, 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...
symfony/symfony
src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
ArrayNodeDefinition.canBeDisabled
public function canBeDisabled() { $this ->addDefaultsIfNotSet() ->treatFalseLike(['enabled' => false]) ->treatTrueLike(['enabled' => true]) ->treatNullLike(['enabled' => true]) ->children() ->booleanNode('enabled') ->defaultTrue() ; return $this; }
php
public function canBeDisabled() { $this ->addDefaultsIfNotSet() ->treatFalseLike(['enabled' => false]) ->treatTrueLike(['enabled' => true]) ->treatNullLike(['enabled' => true]) ->children() ->booleanNode('enabled') ->defaultTrue() ; return $this; }
[ "public", "function", "canBeDisabled", "(", ")", "{", "$", "this", "->", "addDefaultsIfNotSet", "(", ")", "->", "treatFalseLike", "(", "[", "'enabled'", "=>", "false", "]", ")", "->", "treatTrueLike", "(", "[", "'enabled'", "=>", "true", "]", ")", "->", ...
Adds an "enabled" boolean to enable the current section. By default, the section is enabled. @return $this
[ "Adds", "an", "enabled", "boolean", "to", "enable", "the", "current", "section", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L304-L317
train
This method is used to allow the user to disable the user s settings.
[ 30522, 2270, 3853, 2064, 8270, 14268, 23242, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 5587, 3207, 7011, 11314, 5332, 2546, 17048, 13462, 1006, 1007, 1011, 1028, 7438, 7011, 4877, 20806, 3489, 1006, 1031, 1005, 9124, 1005, 1027, 1028, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
MockArraySessionStorage.regenerate
public function regenerate($destroy = false, $lifetime = null) { if (!$this->started) { $this->start(); } $this->metadataBag->stampNew($lifetime); $this->id = $this->generateId(); return true; }
php
public function regenerate($destroy = false, $lifetime = null) { if (!$this->started) { $this->start(); } $this->metadataBag->stampNew($lifetime); $this->id = $this->generateId(); return true; }
[ "public", "function", "regenerate", "(", "$", "destroy", "=", "false", ",", "$", "lifetime", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "started", ")", "{", "$", "this", "->", "start", "(", ")", ";", "}", "$", "this", "->", "metada...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php#L97-L107
train
Regenerates the ID
[ 30522, 2270, 3853, 19723, 24454, 3686, 1006, 1002, 6033, 1027, 6270, 1010, 1002, 6480, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2318, 1007, 1063, 1002, 2023, 1011, 1028, 2707, 1006, 1007, 1025, 1065, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.migrateModule
public function migrateModule($module) { $this->migrator->run(base_path() . '/modules/'.strtolower($module).'/database/migrations'); $this->note($module); foreach ($this->migrator->getNotes() as $note) { $this->note(' - '.$note); } return $this; }
php
public function migrateModule($module) { $this->migrator->run(base_path() . '/modules/'.strtolower($module).'/database/migrations'); $this->note($module); foreach ($this->migrator->getNotes() as $note) { $this->note(' - '.$note); } return $this; }
[ "public", "function", "migrateModule", "(", "$", "module", ")", "{", "$", "this", "->", "migrator", "->", "run", "(", "base_path", "(", ")", ".", "'/modules/'", ".", "strtolower", "(", "$", "module", ")", ".", "'/database/migrations'", ")", ";", "$", "th...
Run migrations on a single module @param string $module Module name @return self
[ "Run", "migrations", "on", "a", "single", "module" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L406-L417
train
Runs migrations for a module
[ 30522, 2270, 3853, 22806, 5302, 8566, 2571, 1006, 1002, 11336, 1007, 1063, 1002, 2023, 1011, 1028, 19117, 16259, 1011, 1028, 2448, 1006, 2918, 1035, 4130, 1006, 1007, 1012, 1005, 1013, 14184, 1013, 1005, 1012, 2358, 5339, 12898, 13777, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/Php.php
Php.getInfo
public function getInfo() { $desc = Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Php1') . '<br/><br/>' . Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Php2', array('<strong>', '</strong>', '<strong>', '</strong>')); $installDocs = '<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_163">' . Piwik::translate('UserCountry_HowToInstallGeoIPDatabases') . '</a>'; $availableDatabaseTypes = array(); if (self::getPathToGeoIpDatabase(array('GeoIPCity.dat', 'GeoLiteCity.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_City'); } if (self::getPathToGeoIpDatabase(array('GeoIPRegion.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Region'); } if (self::getPathToGeoIpDatabase(array('GeoIPCountry.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Country'); } if (self::getPathToGeoIpDatabase(array('GeoIPISP.dat')) !== false) { $availableDatabaseTypes[] = 'ISP'; } if (self::getPathToGeoIpDatabase(array('GeoIPOrg.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Organization'); } if (!empty($availableDatabaseTypes)) { $extraMessage = '<strong>' . Piwik::translate('General_Note') . '</strong>:&nbsp;' . Piwik::translate('UserCountry_GeoIPImplHasAccessTo') . ':&nbsp;<strong>' . implode(', ', $availableDatabaseTypes) . '</strong>.'; } else { $extraMessage = '<strong>' . Piwik::translate('General_Note') . '</strong>:&nbsp;' . Piwik::translate('UserCountry_GeoIPNoDatabaseFound') . '<strong>'; } return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'install_docs' => $installDocs, 'extra_message' => $extraMessage, 'order' => 12); }
php
public function getInfo() { $desc = Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Php1') . '<br/><br/>' . Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Php2', array('<strong>', '</strong>', '<strong>', '</strong>')); $installDocs = '<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_163">' . Piwik::translate('UserCountry_HowToInstallGeoIPDatabases') . '</a>'; $availableDatabaseTypes = array(); if (self::getPathToGeoIpDatabase(array('GeoIPCity.dat', 'GeoLiteCity.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_City'); } if (self::getPathToGeoIpDatabase(array('GeoIPRegion.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Region'); } if (self::getPathToGeoIpDatabase(array('GeoIPCountry.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Country'); } if (self::getPathToGeoIpDatabase(array('GeoIPISP.dat')) !== false) { $availableDatabaseTypes[] = 'ISP'; } if (self::getPathToGeoIpDatabase(array('GeoIPOrg.dat')) !== false) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Organization'); } if (!empty($availableDatabaseTypes)) { $extraMessage = '<strong>' . Piwik::translate('General_Note') . '</strong>:&nbsp;' . Piwik::translate('UserCountry_GeoIPImplHasAccessTo') . ':&nbsp;<strong>' . implode(', ', $availableDatabaseTypes) . '</strong>.'; } else { $extraMessage = '<strong>' . Piwik::translate('General_Note') . '</strong>:&nbsp;' . Piwik::translate('UserCountry_GeoIPNoDatabaseFound') . '<strong>'; } return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'install_docs' => $installDocs, 'extra_message' => $extraMessage, 'order' => 12); }
[ "public", "function", "getInfo", "(", ")", "{", "$", "desc", "=", "Piwik", "::", "translate", "(", "'UserCountry_GeoIpLocationProviderDesc_Php1'", ")", ".", "'<br/><br/>'", ".", "Piwik", "::", "translate", "(", "'UserCountry_GeoIpLocationProviderDesc_Php2'", ",", "arr...
Returns information about this location provider. Contains an id, title & description: array( 'id' => 'geoip_php', 'title' => '...', 'description' => '...' ); @return array
[ "Returns", "information", "about", "this", "location", "provider", ".", "Contains", "an", "id", "title", "&", "description", ":" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/Php.php#L322-L363
train
Returns the info about the country
[ 30522, 2270, 3853, 2131, 2378, 14876, 1006, 1007, 1063, 1002, 4078, 2278, 1027, 14255, 9148, 2243, 1024, 1024, 17637, 1006, 1005, 5310, 3597, 16671, 2854, 1035, 20248, 11514, 4135, 10719, 21572, 17258, 2121, 6155, 2278, 1035, 25718, 2487, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Protocols/Http.php
Http.sessionId
public static function sessionId($id = null) { if (PHP_SAPI != 'cli') { return $id ? session_id($id) : session_id(); } if (static::sessionStarted() && HttpCache::$instance->sessionFile) { return str_replace('ses_', '', basename(HttpCache::$instance->sessionFile)); } return ''; }
php
public static function sessionId($id = null) { if (PHP_SAPI != 'cli') { return $id ? session_id($id) : session_id(); } if (static::sessionStarted() && HttpCache::$instance->sessionFile) { return str_replace('ses_', '', basename(HttpCache::$instance->sessionFile)); } return ''; }
[ "public", "static", "function", "sessionId", "(", "$", "id", "=", "null", ")", "{", "if", "(", "PHP_SAPI", "!=", "'cli'", ")", "{", "return", "$", "id", "?", "session_id", "(", "$", "id", ")", ":", "session_id", "(", ")", ";", "}", "if", "(", "st...
sessionId @param string $id @return string|null
[ "sessionId" ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Http.php#L379-L388
train
Returns the session id
[ 30522, 2270, 10763, 3853, 5219, 3593, 1006, 1002, 8909, 1027, 19701, 1007, 1063, 2065, 1006, 25718, 1035, 20066, 2072, 999, 1027, 1005, 18856, 2072, 1005, 1007, 1063, 2709, 1002, 8909, 1029, 5219, 1035, 8909, 1006, 1002, 8909, 1007, 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...
dompdf/dompdf
lib/Cpdf.php
Cpdf.encryptInit
function encryptInit($id) { $tmp = $this->encryptionKey; $hex = dechex($id); if (mb_strlen($hex, '8bit') < 6) { $hex = substr('000000', 0, 6 - mb_strlen($hex, '8bit')) . $hex; } $tmp .= chr(hexdec(substr($hex, 4, 2))) . chr(hexdec(substr($hex, 2, 2))) . chr(hexdec(substr($hex, 0, 2))) . chr(0) . chr(0) ; $key = $this->md5_16($tmp); $this->ARC4_init(substr($key, 0, 10)); }
php
function encryptInit($id) { $tmp = $this->encryptionKey; $hex = dechex($id); if (mb_strlen($hex, '8bit') < 6) { $hex = substr('000000', 0, 6 - mb_strlen($hex, '8bit')) . $hex; } $tmp .= chr(hexdec(substr($hex, 4, 2))) . chr(hexdec(substr($hex, 2, 2))) . chr(hexdec(substr($hex, 0, 2))) . chr(0) . chr(0) ; $key = $this->md5_16($tmp); $this->ARC4_init(substr($key, 0, 10)); }
[ "function", "encryptInit", "(", "$", "id", ")", "{", "$", "tmp", "=", "$", "this", "->", "encryptionKey", ";", "$", "hex", "=", "dechex", "(", "$", "id", ")", ";", "if", "(", "mb_strlen", "(", "$", "hex", ",", "'8bit'", ")", "<", "6", ")", "{",...
initialize the encryption for processing a particular object @param $id
[ "initialize", "the", "encryption", "for", "processing", "a", "particular", "object" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L2131-L2146
train
Initialize the ARC4 section of the header
[ 30522, 3853, 4372, 26775, 22571, 7629, 4183, 1006, 1002, 8909, 1007, 1063, 1002, 1056, 8737, 1027, 1002, 2023, 1011, 1028, 21999, 14839, 1025, 1002, 2002, 2595, 1027, 11703, 5369, 2595, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 16914, 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/Redis/Connections/PhpRedisConnection.php
PhpRedisConnection.zunionstore
public function zunionstore($output, $keys, $options = []) { return $this->command('zUnion', [$output, $keys, $options['weights'] ?? null, $options['aggregate'] ?? 'sum', ]); }
php
public function zunionstore($output, $keys, $options = []) { return $this->command('zUnion', [$output, $keys, $options['weights'] ?? null, $options['aggregate'] ?? 'sum', ]); }
[ "public", "function", "zunionstore", "(", "$", "output", ",", "$", "keys", ",", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "command", "(", "'zUnion'", ",", "[", "$", "output", ",", "$", "keys", ",", "$", "options", "[", ...
Find the union between sets and store in a new set. @param string $output @param array $keys @param array $options @return int
[ "Find", "the", "union", "between", "sets", "and", "store", "in", "a", "new", "set", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L284-L290
train
ZUnionStore - Uses the zunion command.
[ 30522, 2270, 3853, 16950, 27678, 23808, 5686, 1006, 1002, 6434, 1010, 1002, 6309, 1010, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 3094, 1006, 1005, 16950, 27678, 2078, 1005, 1010, 1031, 1002, 6434, 1010, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Cache.php
Cache.setCacheGeneral
public static function setCacheGeneral($value) { $cache = self::getCache(); return $cache->save(self::$cacheIdGeneral, $value, self::getTtl()); }
php
public static function setCacheGeneral($value) { $cache = self::getCache(); return $cache->save(self::$cacheIdGeneral, $value, self::getTtl()); }
[ "public", "static", "function", "setCacheGeneral", "(", "$", "value", ")", "{", "$", "cache", "=", "self", "::", "getCache", "(", ")", ";", "return", "$", "cache", "->", "save", "(", "self", "::", "$", "cacheIdGeneral", ",", "$", "value", ",", "self", ...
Store data in general (global cache) @param mixed $value @return bool
[ "Store", "data", "in", "general", "(", "global", "cache", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Cache.php#L177-L182
train
Cache General Value
[ 30522, 2270, 10763, 3853, 2275, 3540, 5403, 6914, 21673, 1006, 1002, 3643, 1007, 1063, 1002, 17053, 1027, 2969, 1024, 1024, 2131, 3540, 5403, 1006, 1007, 1025, 2709, 1002, 17053, 1011, 1028, 3828, 1006, 2969, 1024, 1024, 1002, 17053, 13623,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Composite/Form.php
Form.render
public function render(): string { $formCode = '<form>'; foreach ($this->elements as $element) { $formCode .= $element->render(); } $formCode .= '</form>'; return $formCode; }
php
public function render(): string { $formCode = '<form>'; foreach ($this->elements as $element) { $formCode .= $element->render(); } $formCode .= '</form>'; return $formCode; }
[ "public", "function", "render", "(", ")", ":", "string", "{", "$", "formCode", "=", "'<form>'", ";", "foreach", "(", "$", "this", "->", "elements", "as", "$", "element", ")", "{", "$", "formCode", ".=", "$", "element", "->", "render", "(", ")", ";", ...
runs through all elements and calls render() on them, then returns the complete representation of the form. from the outside, one will not see this and the form will act like a single object instance @return string
[ "runs", "through", "all", "elements", "and", "calls", "render", "()", "on", "them", "then", "returns", "the", "complete", "representation", "of", "the", "form", "." ]
5f5649b57ea94471e20b54eb439c6368dea07886
https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/Structural/Composite/Form.php#L24-L35
train
Render the form
[ 30522, 2270, 3853, 17552, 1006, 1007, 1024, 5164, 1063, 1002, 2433, 16044, 1027, 1005, 1026, 2433, 1028, 1005, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 3787, 2004, 1002, 5783, 1007, 1063, 1002, 2433, 16044, 1012, 1027, 1002, 5783, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SiteUrls.php
SiteUrls.groupUrlsByHost
public function groupUrlsByHost($siteUrls) { if (empty($siteUrls)) { return array(); } $allUrls = array(); foreach ($siteUrls as $idSite => $urls) { $idSite = (int) $idSite; foreach ($urls as $url) { $urlParsed = @parse_url($url); if ($urlParsed === false || !isset($urlParsed['host'])) { continue; } $host = $this->toCanonicalHost($urlParsed['host']); $path = $this->getCanonicalPathFromParsedUrl($urlParsed); if (!isset($allUrls[$host])) { $allUrls[$host] = array(); } if (!isset($allUrls[$host][$path])) { $allUrls[$host][$path] = array(); } if (!in_array($idSite, $allUrls[$host][$path])) { $allUrls[$host][$path][] = $idSite; } } } foreach ($allUrls as $host => $paths) { uksort($paths, array($this, 'sortByPathDepth')); $allUrls[$host] = $paths; } return $allUrls; }
php
public function groupUrlsByHost($siteUrls) { if (empty($siteUrls)) { return array(); } $allUrls = array(); foreach ($siteUrls as $idSite => $urls) { $idSite = (int) $idSite; foreach ($urls as $url) { $urlParsed = @parse_url($url); if ($urlParsed === false || !isset($urlParsed['host'])) { continue; } $host = $this->toCanonicalHost($urlParsed['host']); $path = $this->getCanonicalPathFromParsedUrl($urlParsed); if (!isset($allUrls[$host])) { $allUrls[$host] = array(); } if (!isset($allUrls[$host][$path])) { $allUrls[$host][$path] = array(); } if (!in_array($idSite, $allUrls[$host][$path])) { $allUrls[$host][$path][] = $idSite; } } } foreach ($allUrls as $host => $paths) { uksort($paths, array($this, 'sortByPathDepth')); $allUrls[$host] = $paths; } return $allUrls; }
[ "public", "function", "groupUrlsByHost", "(", "$", "siteUrls", ")", "{", "if", "(", "empty", "(", "$", "siteUrls", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "allUrls", "=", "array", "(", ")", ";", "foreach", "(", "$", "siteUrls", "...
Groups all URLs by host, path and idsite. @param array $urls An array containing URLs by idsite, eg array(array($idSite = 1 => array('apache.piwik', 'apache2.piwik'), 2 => array(), ...)) as returned by {@link getAllCachedSiteUrls()} and {@link getAllSiteUrls} @return array All urls grouped by host => path => idSites. Path having the most '/' will be listed first array( 'apache.piwik' => array( '/test/two' => $idsite = array(3), '/test' => $idsite = array(1), '/' => $idsite = array(2), ), 'test.apache.piwik' => array( '/test/two' => $idsite = array(3), '/test' => $idsite = array(1), '/' => $idsite = array(2, 3), ), );
[ "Groups", "all", "URLs", "by", "host", "path", "and", "idsite", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SiteUrls.php#L43-L83
train
Group URLs by host
[ 30522, 2270, 3853, 2177, 3126, 4877, 3762, 15006, 2102, 1006, 1002, 2609, 3126, 4877, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2609, 3126, 4877, 1007, 1007, 1063, 2709, 9140, 1006, 1007, 1025, 1065, 1002, 2035, 3126, 4877, 1027, 9140, 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/Archive/DataTableFactory.php
DataTableFactory.make
public function make($index, $resultIndices) { $keyMetadata = $this->getDefaultMetadata(); if (empty($resultIndices)) { // for numeric data, if there's no index (and thus only 1 site & period in the query), // we want to display every queried metric name if (empty($index) && $this->isNumericDataType() ) { $index = $this->defaultRow; } $dataTable = $this->createDataTable($index, $keyMetadata); } else { $dataTable = $this->createDataTableMapFromIndex($index, $resultIndices, $keyMetadata); } return $dataTable; }
php
public function make($index, $resultIndices) { $keyMetadata = $this->getDefaultMetadata(); if (empty($resultIndices)) { // for numeric data, if there's no index (and thus only 1 site & period in the query), // we want to display every queried metric name if (empty($index) && $this->isNumericDataType() ) { $index = $this->defaultRow; } $dataTable = $this->createDataTable($index, $keyMetadata); } else { $dataTable = $this->createDataTableMapFromIndex($index, $resultIndices, $keyMetadata); } return $dataTable; }
[ "public", "function", "make", "(", "$", "index", ",", "$", "resultIndices", ")", "{", "$", "keyMetadata", "=", "$", "this", "->", "getDefaultMetadata", "(", ")", ";", "if", "(", "empty", "(", "$", "resultIndices", ")", ")", "{", "// for numeric data, if th...
Creates a DataTable|Set instance using an index of archive data. @param array $index @see DataCollection @param array $resultIndices an array mapping metadata names with pretty metadata labels. @return DataTable|DataTable\Map
[ "Creates", "a", "DataTable|Set", "instance", "using", "an", "index", "of", "archive", "data", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataTableFactory.php#L163-L182
train
Create DataTable from index and resultIndices
[ 30522, 2270, 3853, 2191, 1006, 1002, 5950, 1010, 1002, 2765, 22254, 23522, 1007, 1063, 1002, 3145, 11368, 8447, 2696, 1027, 1002, 2023, 1011, 1028, 2131, 3207, 7011, 11314, 11368, 8447, 2696, 1006, 1007, 1025, 2065, 1006, 4064, 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/VarDumper/Dumper/CliDumper.php
CliDumper.hasColorSupport
private function hasColorSupport($stream) { if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { return false; } if ('Hyper' === getenv('TERM_PROGRAM')) { return true; } if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } if (\function_exists('stream_isatty')) { return @stream_isatty($stream); } if (\function_exists('posix_isatty')) { return @posix_isatty($stream); } $stat = @fstat($stream); // Check if formatted mode is S_IFCHR return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; }
php
private function hasColorSupport($stream) { if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { return false; } if ('Hyper' === getenv('TERM_PROGRAM')) { return true; } if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } if (\function_exists('stream_isatty')) { return @stream_isatty($stream); } if (\function_exists('posix_isatty')) { return @posix_isatty($stream); } $stat = @fstat($stream); // Check if formatted mode is S_IFCHR return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; }
[ "private", "function", "hasColorSupport", "(", "$", "stream", ")", "{", "if", "(", "!", "\\", "is_resource", "(", "$", "stream", ")", "||", "'stream'", "!==", "get_resource_type", "(", "$", "stream", ")", ")", "{", "return", "false", ";", "}", "if", "(...
Returns true if the stream supports colorization. Reference: Composer\XdebugHandler\Process::supportsColor https://github.com/composer/xdebug-handler @param mixed $stream A CLI output stream @return bool
[ "Returns", "true", "if", "the", "stream", "supports", "colorization", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/CliDumper.php#L575-L604
train
Returns true if the stream has color support
[ 30522, 2797, 3853, 2038, 18717, 6342, 9397, 11589, 1006, 1002, 5460, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 7692, 1006, 1002, 5460, 1007, 1064, 1064, 1005, 5460, 1005, 999, 1027, 1027, 2131, 1035, 7692, 1035, 2828, 1006, 1002, 546...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/EmailAddress.php
Zend_Validate_EmailAddress._validateLocalPart
private function _validateLocalPart() { // First try to match the local part on the common dot-atom format $result = false; // Dot-atom characters are: 1*atext *("." 1*atext) // atext: ALPHA / DIGIT / and "!", "#", "$", "%", "&", "'", "*", // "+", "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~" $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e'; if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->_localPart)) { $result = true; } else { // Try quoted string format // Quoted-string characters are: DQUOTE *([FWS] qtext/quoted-pair) [FWS] DQUOTE // qtext: Non white space controls, and the rest of the US-ASCII characters not // including "\" or the quote character $noWsCtl = '\x01-\x08\x0b\x0c\x0e-\x1f\x7f'; $qtext = $noWsCtl . '\x21\x23-\x5b\x5d-\x7e'; $ws = '\x20\x09'; if (preg_match('/^\x22([' . $ws . $qtext . '])*[$ws]?\x22$/', $this->_localPart)) { $result = true; } else { $this->_error(self::DOT_ATOM); $this->_error(self::QUOTED_STRING); $this->_error(self::INVALID_LOCAL_PART); } } return $result; }
php
private function _validateLocalPart() { // First try to match the local part on the common dot-atom format $result = false; // Dot-atom characters are: 1*atext *("." 1*atext) // atext: ALPHA / DIGIT / and "!", "#", "$", "%", "&", "'", "*", // "+", "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~" $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e'; if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->_localPart)) { $result = true; } else { // Try quoted string format // Quoted-string characters are: DQUOTE *([FWS] qtext/quoted-pair) [FWS] DQUOTE // qtext: Non white space controls, and the rest of the US-ASCII characters not // including "\" or the quote character $noWsCtl = '\x01-\x08\x0b\x0c\x0e-\x1f\x7f'; $qtext = $noWsCtl . '\x21\x23-\x5b\x5d-\x7e'; $ws = '\x20\x09'; if (preg_match('/^\x22([' . $ws . $qtext . '])*[$ws]?\x22$/', $this->_localPart)) { $result = true; } else { $this->_error(self::DOT_ATOM); $this->_error(self::QUOTED_STRING); $this->_error(self::INVALID_LOCAL_PART); } } return $result; }
[ "private", "function", "_validateLocalPart", "(", ")", "{", "// First try to match the local part on the common dot-atom format", "$", "result", "=", "false", ";", "// Dot-atom characters are: 1*atext *(\".\" 1*atext)", "// atext: ALPHA / DIGIT / and \"!\", \"#\", \"$\", \"%\", \"&\", \"'\...
Internal method to validate the local part of the email address @return boolean
[ "Internal", "method", "to", "validate", "the", "local", "part", "of", "the", "email", "address" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/EmailAddress.php#L405-L435
train
Validate local part
[ 30522, 2797, 3853, 1035, 9398, 3686, 4135, 9289, 19362, 2102, 1006, 1007, 1063, 1013, 1013, 2034, 3046, 2000, 2674, 1996, 2334, 2112, 2006, 1996, 2691, 11089, 1011, 13787, 4289, 1002, 2765, 1027, 6270, 1025, 1013, 1013, 11089, 1011, 13787, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Loader/IniFileLoader.php
IniFileLoader.phpize
private function phpize($value) { // trim on the right as comments removal keep whitespaces if ($value !== $v = rtrim($value)) { $value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v; } $lowercaseValue = strtolower($value); switch (true) { case \defined($value): return \constant($value); case 'yes' === $lowercaseValue || 'on' === $lowercaseValue: return true; case 'no' === $lowercaseValue || 'off' === $lowercaseValue || 'none' === $lowercaseValue: return false; case isset($value[1]) && ( ("'" === $value[0] && "'" === $value[\strlen($value) - 1]) || ('"' === $value[0] && '"' === $value[\strlen($value) - 1]) ): // quoted string return substr($value, 1, -1); default: return XmlUtils::phpize($value); } }
php
private function phpize($value) { // trim on the right as comments removal keep whitespaces if ($value !== $v = rtrim($value)) { $value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v; } $lowercaseValue = strtolower($value); switch (true) { case \defined($value): return \constant($value); case 'yes' === $lowercaseValue || 'on' === $lowercaseValue: return true; case 'no' === $lowercaseValue || 'off' === $lowercaseValue || 'none' === $lowercaseValue: return false; case isset($value[1]) && ( ("'" === $value[0] && "'" === $value[\strlen($value) - 1]) || ('"' === $value[0] && '"' === $value[\strlen($value) - 1]) ): // quoted string return substr($value, 1, -1); default: return XmlUtils::phpize($value); } }
[ "private", "function", "phpize", "(", "$", "value", ")", "{", "// trim on the right as comments removal keep whitespaces", "if", "(", "$", "value", "!==", "$", "v", "=", "rtrim", "(", "$", "value", ")", ")", "{", "$", "value", "=", "'\"\"'", "===", "substr_r...
Note that the following features are not supported: * strings with escaped quotes are not supported "foo\"bar"; * string concatenation ("foo" "bar").
[ "Note", "that", "the", "following", "features", "are", "not", "supported", ":", "*", "strings", "with", "escaped", "quotes", "are", "not", "supported", "foo", "\\", "bar", ";", "*", "string", "concatenation", "(", "foo", "bar", ")", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php#L70-L94
train
phpize the value of the attribute
[ 30522, 2797, 3853, 25718, 4697, 1006, 1002, 3643, 1007, 1063, 1013, 1013, 12241, 2006, 1996, 2157, 2004, 7928, 8208, 2562, 12461, 15327, 2015, 2065, 1006, 1002, 3643, 999, 1027, 1027, 1002, 1058, 1027, 19387, 20026, 1006, 1002, 3643, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Plugin.php
Plugin.getMissingDependenciesAsString
public function getMissingDependenciesAsString($piwikVersion = null) { if ($this->requiresInternetConnection() && !SettingsPiwik::isInternetEnabled()) { return Piwik::translate('CorePluginsAdmin_PluginRequiresInternet'); } if (empty($this->pluginInformation['require'])) { return ''; } $dependency = $this->makeDependency($piwikVersion); $missingDependencies = $dependency->getMissingDependencies($this->pluginInformation['require']); if(empty($missingDependencies)) { return ''; } $causedBy = array(); foreach ($missingDependencies as $dependency) { $causedBy[] = ucfirst($dependency['requirement']) . ' ' . $dependency['causedBy']; } return Piwik::translate("CorePluginsAdmin_PluginRequirement", array( $this->getPluginName(), implode(', ', $causedBy) )); }
php
public function getMissingDependenciesAsString($piwikVersion = null) { if ($this->requiresInternetConnection() && !SettingsPiwik::isInternetEnabled()) { return Piwik::translate('CorePluginsAdmin_PluginRequiresInternet'); } if (empty($this->pluginInformation['require'])) { return ''; } $dependency = $this->makeDependency($piwikVersion); $missingDependencies = $dependency->getMissingDependencies($this->pluginInformation['require']); if(empty($missingDependencies)) { return ''; } $causedBy = array(); foreach ($missingDependencies as $dependency) { $causedBy[] = ucfirst($dependency['requirement']) . ' ' . $dependency['causedBy']; } return Piwik::translate("CorePluginsAdmin_PluginRequirement", array( $this->getPluginName(), implode(', ', $causedBy) )); }
[ "public", "function", "getMissingDependenciesAsString", "(", "$", "piwikVersion", "=", "null", ")", "{", "if", "(", "$", "this", "->", "requiresInternetConnection", "(", ")", "&&", "!", "SettingsPiwik", "::", "isInternetEnabled", "(", ")", ")", "{", "return", ...
Returns a string (translated) describing the missing requirements for this plugin and the given Piwik version @param string $piwikVersion @return string "AnonymousPiwikUsageMeasurement requires PIWIK >=3.0.0"
[ "Returns", "a", "string", "(", "translated", ")", "describing", "the", "missing", "requirements", "for", "this", "plugin", "and", "the", "given", "Piwik", "version" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin.php#L451-L477
train
Returns the missing dependencies as a string
[ 30522, 2270, 3853, 2131, 15630, 7741, 3207, 11837, 4181, 9243, 12054, 18886, 3070, 1006, 1002, 14255, 9148, 2243, 27774, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5942, 18447, 11795, 3388, 8663, 2638, 7542, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Element/Input.php
HTML_QuickForm2_Element_Input.getFrozenHtml
protected function getFrozenHtml() { $value = $this->getAttribute('value'); return (('' != $value)? htmlspecialchars($value, ENT_QUOTES, self::getOption('charset')): '&nbsp;') . $this->getPersistentContent(); }
php
protected function getFrozenHtml() { $value = $this->getAttribute('value'); return (('' != $value)? htmlspecialchars($value, ENT_QUOTES, self::getOption('charset')): '&nbsp;') . $this->getPersistentContent(); }
[ "protected", "function", "getFrozenHtml", "(", ")", "{", "$", "value", "=", "$", "this", "->", "getAttribute", "(", "'value'", ")", ";", "return", "(", "(", "''", "!=", "$", "value", ")", "?", "htmlspecialchars", "(", "$", "value", ",", "ENT_QUOTES", "...
Returns the field's value without HTML tags @return string
[ "Returns", "the", "field", "s", "value", "without", "HTML", "tags" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element/Input.php#L107-L112
train
Returns the frozen HTML code of the field
[ 30522, 5123, 3853, 2131, 19699, 18153, 2368, 11039, 19968, 1006, 1007, 1063, 1002, 3643, 1027, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 2618, 1006, 1005, 3643, 1005, 1007, 1025, 2709, 1006, 1006, 1005, 1005, 999, 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/Ldap/Adapter/ExtLdap/ConnectionOptions.php
ConnectionOptions.getOption
public static function getOption($name) { // Convert $constantName = self::getOptionName($name); if (!\defined($constantName)) { throw new LdapException(sprintf('Unknown option "%s".', $name)); } return \constant($constantName); }
php
public static function getOption($name) { // Convert $constantName = self::getOptionName($name); if (!\defined($constantName)) { throw new LdapException(sprintf('Unknown option "%s".', $name)); } return \constant($constantName); }
[ "public", "static", "function", "getOption", "(", "$", "name", ")", "{", "// Convert", "$", "constantName", "=", "self", "::", "getOptionName", "(", "$", "name", ")", ";", "if", "(", "!", "\\", "defined", "(", "$", "constantName", ")", ")", "{", "throw...
Fetches an option's corresponding constant value from an option name. The option name can either be in snake or camel case. @param string $name @return int @throws LdapException
[ "Fetches", "an", "option", "s", "corresponding", "constant", "value", "from", "an", "option", "name", ".", "The", "option", "name", "can", "either", "be", "in", "snake", "or", "camel", "case", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php#L63-L73
train
Get the constant value of an option
[ 30522, 2270, 10763, 3853, 2131, 7361, 3508, 1006, 1002, 2171, 1007, 1063, 1013, 1013, 10463, 1002, 5377, 18442, 1027, 2969, 1024, 1024, 2131, 7361, 3508, 18442, 1006, 1002, 2171, 1007, 1025, 2065, 1006, 999, 1032, 4225, 1006, 1002, 5377, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php
NamespacedAttributeBag.&
protected function &resolveAttributePath($name, $writeContext = false) { $array = &$this->attributes; $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name; // Check if there is anything to do, else return if (!$name) { return $array; } $parts = explode($this->namespaceCharacter, $name); if (\count($parts) < 2) { if (!$writeContext) { return $array; } $array[$parts[0]] = []; return $array; } unset($parts[\count($parts) - 1]); foreach ($parts as $part) { if (null !== $array && !\array_key_exists($part, $array)) { if (!$writeContext) { $null = null; return $null; } $array[$part] = []; } $array = &$array[$part]; } return $array; }
php
protected function &resolveAttributePath($name, $writeContext = false) { $array = &$this->attributes; $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name; // Check if there is anything to do, else return if (!$name) { return $array; } $parts = explode($this->namespaceCharacter, $name); if (\count($parts) < 2) { if (!$writeContext) { return $array; } $array[$parts[0]] = []; return $array; } unset($parts[\count($parts) - 1]); foreach ($parts as $part) { if (null !== $array && !\array_key_exists($part, $array)) { if (!$writeContext) { $null = null; return $null; } $array[$part] = []; } $array = &$array[$part]; } return $array; }
[ "protected", "function", "&", "resolveAttributePath", "(", "$", "name", ",", "$", "writeContext", "=", "false", ")", "{", "$", "array", "=", "&", "$", "this", "->", "attributes", ";", "$", "name", "=", "(", "0", "===", "strpos", "(", "$", "name", ","...
Resolves a path in attributes property and returns it as a reference. This method allows structured namespacing of session attributes. @param string $name Key name @param bool $writeContext Write context, default false @return array
[ "Resolves", "a", "path", "in", "attributes", "property", "and", "returns", "it", "as", "a", "reference", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php#L102-L140
train
Resolve attribute path
[ 30522, 5123, 3853, 1004, 10663, 19321, 3089, 8569, 2618, 15069, 30524, 1027, 1027, 1027, 2358, 14536, 2891, 1006, 1002, 2171, 1010, 1002, 2023, 1011, 1028, 3415, 15327, 7507, 22648, 3334, 1007, 1007, 1029, 4942, 3367, 2099, 1006, 1002, 2171...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/formwidgets/PermissionEditor.php
PermissionEditor.prepareVars
public function prepareVars() { if ($this->formField->disabled) { $this->previewMode = true; } $permissionsData = $this->formField->getValueFromData($this->model); if (!is_array($permissionsData)) { $permissionsData = []; } $this->vars['checkboxMode'] = $this->getControlMode() === 'checkbox'; $this->vars['permissions'] = $this->getFilteredPermissions(); $this->vars['baseFieldName'] = $this->getFieldName(); $this->vars['permissionsData'] = $permissionsData; $this->vars['field'] = $this->formField; }
php
public function prepareVars() { if ($this->formField->disabled) { $this->previewMode = true; } $permissionsData = $this->formField->getValueFromData($this->model); if (!is_array($permissionsData)) { $permissionsData = []; } $this->vars['checkboxMode'] = $this->getControlMode() === 'checkbox'; $this->vars['permissions'] = $this->getFilteredPermissions(); $this->vars['baseFieldName'] = $this->getFieldName(); $this->vars['permissionsData'] = $permissionsData; $this->vars['field'] = $this->formField; }
[ "public", "function", "prepareVars", "(", ")", "{", "if", "(", "$", "this", "->", "formField", "->", "disabled", ")", "{", "$", "this", "->", "previewMode", "=", "true", ";", "}", "$", "permissionsData", "=", "$", "this", "->", "formField", "->", "getV...
Prepares the list data
[ "Prepares", "the", "list", "data" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/PermissionEditor.php#L43-L59
train
Prepares the variables for the view
[ 30522, 2270, 3853, 7374, 10755, 2015, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2433, 3790, 1011, 1028, 9776, 1007, 1063, 1002, 2023, 1011, 1028, 19236, 5302, 3207, 1027, 2995, 1025, 1065, 1002, 6656, 16150, 6790, 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/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php
RouterCacheWarmer.warmUp
public function warmUp($cacheDir) { $router = $this->container->get('router'); if ($router instanceof WarmableInterface) { $router->warmUp($cacheDir); return; } @trigger_error(sprintf('Passing a %s without implementing %s is deprecated since Symfony 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED); }
php
public function warmUp($cacheDir) { $router = $this->container->get('router'); if ($router instanceof WarmableInterface) { $router->warmUp($cacheDir); return; } @trigger_error(sprintf('Passing a %s without implementing %s is deprecated since Symfony 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED); }
[ "public", "function", "warmUp", "(", "$", "cacheDir", ")", "{", "$", "router", "=", "$", "this", "->", "container", "->", "get", "(", "'router'", ")", ";", "if", "(", "$", "router", "instanceof", "WarmableInterface", ")", "{", "$", "router", "->", "war...
Warms up the cache. @param string $cacheDir The cache directory
[ "Warms", "up", "the", "cache", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php#L42-L53
train
Warms up the cache directory.
[ 30522, 2270, 3853, 4010, 6279, 1006, 1002, 17053, 4305, 2099, 1007, 1063, 1002, 2799, 2099, 1027, 1002, 2023, 1011, 1028, 11661, 1011, 1028, 2131, 1006, 1005, 2799, 2099, 1005, 1007, 1025, 2065, 1006, 1002, 2799, 2099, 6013, 11253, 4010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SegmentEditor/API.php
API.delete
public function delete($idSegment) { $segment = $this->getSegmentOrFail($idSegment); $this->checkUserCanEditOrDeleteSegment($segment); /** * Triggered before a segment is deleted or made invisible. * * This event can be used by plugins to throw an exception * or do something else. * * @param int $idSegment The ID of the segment being deleted. */ Piwik::postEvent('SegmentEditor.deactivate', array($idSegment)); $this->getModel()->deleteSegment($idSegment); return true; }
php
public function delete($idSegment) { $segment = $this->getSegmentOrFail($idSegment); $this->checkUserCanEditOrDeleteSegment($segment); /** * Triggered before a segment is deleted or made invisible. * * This event can be used by plugins to throw an exception * or do something else. * * @param int $idSegment The ID of the segment being deleted. */ Piwik::postEvent('SegmentEditor.deactivate', array($idSegment)); $this->getModel()->deleteSegment($idSegment); return true; }
[ "public", "function", "delete", "(", "$", "idSegment", ")", "{", "$", "segment", "=", "$", "this", "->", "getSegmentOrFail", "(", "$", "idSegment", ")", ";", "$", "this", "->", "checkUserCanEditOrDeleteSegment", "(", "$", "segment", ")", ";", "/**\n ...
Deletes a stored segment. @param $idSegment @return bool
[ "Deletes", "a", "stored", "segment", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/API.php#L192-L210
train
Delete a segment
[ 30522, 2270, 3853, 3972, 12870, 1006, 1002, 8909, 3366, 21693, 4765, 1007, 1063, 1002, 6903, 1027, 1002, 2023, 1011, 1028, 4152, 13910, 23065, 12881, 12502, 1006, 1002, 8909, 3366, 21693, 4765, 1007, 1025, 1002, 2023, 1011, 1028, 4638, 2033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.addDataTable
public function addDataTable(DataTable $tableToSum) { foreach ($this->getDataTables() as $childTable) { $childTable->addDataTable($tableToSum); } }
php
public function addDataTable(DataTable $tableToSum) { foreach ($this->getDataTables() as $childTable) { $childTable->addDataTable($tableToSum); } }
[ "public", "function", "addDataTable", "(", "DataTable", "$", "tableToSum", ")", "{", "foreach", "(", "$", "this", "->", "getDataTables", "(", ")", "as", "$", "childTable", ")", "{", "$", "childTable", "->", "addDataTable", "(", "$", "tableToSum", ")", ";",...
Sums a DataTable to all the tables in this array. _Note: Will only add `$tableToSum` if the childTable has some rows._ See {@link Piwik\DataTable::addDataTable()}. @param DataTable $tableToSum
[ "Sums", "a", "DataTable", "to", "all", "the", "tables", "in", "this", "array", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Map.php#L460-L465
train
Adds a DataTable to all child tables of this table
[ 30522, 2270, 3853, 5587, 2850, 29336, 3085, 1006, 2951, 10880, 1002, 13855, 2891, 2819, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 2850, 29336, 3085, 2015, 1006, 1007, 2004, 1002, 2775, 10880, 1007, 1063, 1002, 2775, 10880...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Form.php
Form.getViewData
public function getViewData() { if ($this->inheritData) { if (!$this->parent) { throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); } return $this->parent->getViewData(); } if (!$this->defaultDataSet) { if ($this->lockSetData) { throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getViewData() if the form data has not already been set.'); } $this->setData($this->config->getData()); } return $this->viewData; }
php
public function getViewData() { if ($this->inheritData) { if (!$this->parent) { throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); } return $this->parent->getViewData(); } if (!$this->defaultDataSet) { if ($this->lockSetData) { throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getViewData() if the form data has not already been set.'); } $this->setData($this->config->getData()); } return $this->viewData; }
[ "public", "function", "getViewData", "(", ")", "{", "if", "(", "$", "this", "->", "inheritData", ")", "{", "if", "(", "!", "$", "this", "->", "parent", ")", "{", "throw", "new", "RuntimeException", "(", "'The form is configured to inherit its parent\\'s data, bu...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L440-L459
train
Get the view data
[ 30522, 2270, 3853, 2131, 8584, 2850, 2696, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 22490, 2850, 2696, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6687, 1007, 1063, 5466, 2047, 2448, 7292, 10288, 24422, 1006, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Traits/PhpFilesTrait.php
PhpFilesTrait.doFetch
protected function doFetch(array $ids) { if ($this->appendOnly) { $now = 0; $missingIds = []; } else { $now = time(); $missingIds = $ids; $ids = []; } $values = []; begin: foreach ($ids as $id) { if (null === $value = $this->values[$id] ?? null) { $missingIds[] = $id; } elseif ('N;' === $value) { $values[$id] = null; } elseif ($value instanceof \Closure) { $values[$id] = $value(); } else { $values[$id] = $value; } if (!$this->appendOnly) { unset($this->values[$id]); } } if (!$missingIds) { return $values; } set_error_handler($this->includeHandler); try { foreach ($missingIds as $k => $id) { try { $file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id); list($expiresAt, $this->values[$id]) = include $file; if ($now >= $expiresAt) { unset($this->values[$id], $missingIds[$k]); } } catch (\ErrorException $e) { unset($missingIds[$k]); } } } finally { restore_error_handler(); } $ids = $missingIds; $missingIds = []; goto begin; }
php
protected function doFetch(array $ids) { if ($this->appendOnly) { $now = 0; $missingIds = []; } else { $now = time(); $missingIds = $ids; $ids = []; } $values = []; begin: foreach ($ids as $id) { if (null === $value = $this->values[$id] ?? null) { $missingIds[] = $id; } elseif ('N;' === $value) { $values[$id] = null; } elseif ($value instanceof \Closure) { $values[$id] = $value(); } else { $values[$id] = $value; } if (!$this->appendOnly) { unset($this->values[$id]); } } if (!$missingIds) { return $values; } set_error_handler($this->includeHandler); try { foreach ($missingIds as $k => $id) { try { $file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id); list($expiresAt, $this->values[$id]) = include $file; if ($now >= $expiresAt) { unset($this->values[$id], $missingIds[$k]); } } catch (\ErrorException $e) { unset($missingIds[$k]); } } } finally { restore_error_handler(); } $ids = $missingIds; $missingIds = []; goto begin; }
[ "protected", "function", "doFetch", "(", "array", "$", "ids", ")", "{", "if", "(", "$", "this", "->", "appendOnly", ")", "{", "$", "now", "=", "0", ";", "$", "missingIds", "=", "[", "]", ";", "}", "else", "{", "$", "now", "=", "time", "(", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php#L77-L129
train
Fetch the values from the cache
[ 30522, 5123, 3853, 2079, 7959, 10649, 1006, 9140, 1002, 8909, 2015, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 10439, 10497, 2239, 2135, 1007, 1063, 1002, 2085, 1027, 1014, 1025, 1002, 4394, 9821, 1027, 1031, 1033, 1025, 1065, 2842, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Filesystem/Filesystem.php
Filesystem.chown
public function chown($files, $user, $recursive = false) { foreach ($this->toIterable($files) as $file) { if ($recursive && is_dir($file) && !is_link($file)) { $this->chown(new \FilesystemIterator($file), $user, true); } if (is_link($file) && \function_exists('lchown')) { if (true !== @lchown($file, $user)) { throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } } else { if (true !== @chown($file, $user)) { throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } } } }
php
public function chown($files, $user, $recursive = false) { foreach ($this->toIterable($files) as $file) { if ($recursive && is_dir($file) && !is_link($file)) { $this->chown(new \FilesystemIterator($file), $user, true); } if (is_link($file) && \function_exists('lchown')) { if (true !== @lchown($file, $user)) { throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } } else { if (true !== @chown($file, $user)) { throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } } } }
[ "public", "function", "chown", "(", "$", "files", ",", "$", "user", ",", "$", "recursive", "=", "false", ")", "{", "foreach", "(", "$", "this", "->", "toIterable", "(", "$", "files", ")", "as", "$", "file", ")", "{", "if", "(", "$", "recursive", ...
Change the owner of an array of files or directories. @param string|iterable $files A filename, an array of files, or a \Traversable instance to change owner @param string $user The new owner user name @param bool $recursive Whether change the owner recursively or not @throws IOException When the change fails
[ "Change", "the", "owner", "of", "an", "array", "of", "files", "or", "directories", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Filesystem/Filesystem.php#L220-L236
train
Change ownership of files or directories
[ 30522, 2270, 3853, 20209, 2078, 1006, 1002, 6764, 1010, 1002, 5310, 1010, 1002, 28667, 9236, 3512, 1027, 6270, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2000, 21646, 3085, 1006, 1002, 6764, 1007, 2004, 1002, 5371, 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
libs/HTML/QuickForm2/Container.php
HTML_QuickForm2_Container.validate
protected function validate() { $valid = parent::validate(); foreach ($this as $child) { $valid = $child->validate() && $valid; } return $valid; }
php
protected function validate() { $valid = parent::validate(); foreach ($this as $child) { $valid = $child->validate() && $valid; } return $valid; }
[ "protected", "function", "validate", "(", ")", "{", "$", "valid", "=", "parent", "::", "validate", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "child", ")", "{", "$", "valid", "=", "$", "child", "->", "validate", "(", ")", "&&", "$", "...
Performs the server-side validation This method also calls validate() on all contained elements. @return boolean Whether the container and all contained elements are valid
[ "Performs", "the", "server", "-", "side", "validation" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Container.php#L375-L382
train
Validate the children of this node
[ 30522, 5123, 3853, 9398, 3686, 1006, 1007, 1063, 1002, 9398, 1027, 6687, 1024, 1024, 9398, 3686, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 2004, 1002, 2775, 1007, 1063, 1002, 9398, 1027, 1002, 2775, 1011, 30524, 2709, 1002, 9398, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/twig/Extension.php
Extension.getTokenParsers
public function getTokenParsers() { return [ new PageTokenParser, new PartialTokenParser, new ContentTokenParser, new PutTokenParser, new PlaceholderTokenParser, new DefaultTokenParser, new FrameworkTokenParser, new ComponentTokenParser, new FlashTokenParser, new ScriptsTokenParser, new StylesTokenParser, ]; }
php
public function getTokenParsers() { return [ new PageTokenParser, new PartialTokenParser, new ContentTokenParser, new PutTokenParser, new PlaceholderTokenParser, new DefaultTokenParser, new FrameworkTokenParser, new ComponentTokenParser, new FlashTokenParser, new ScriptsTokenParser, new StylesTokenParser, ]; }
[ "public", "function", "getTokenParsers", "(", ")", "{", "return", "[", "new", "PageTokenParser", ",", "new", "PartialTokenParser", ",", "new", "ContentTokenParser", ",", "new", "PutTokenParser", ",", "new", "PlaceholderTokenParser", ",", "new", "DefaultTokenParser", ...
Returns a list of token parsers this extensions provides. @return array An array of token parsers
[ "Returns", "a", "list", "of", "token", "parsers", "this", "extensions", "provides", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Extension.php#L66-L81
train
Returns all the token parsers
[ 30522, 2270, 3853, 2131, 18715, 2368, 19362, 8043, 2015, 1006, 1007, 1063, 2709, 1031, 2047, 3931, 18715, 2368, 19362, 8043, 1010, 2047, 7704, 18715, 2368, 19362, 8043, 1010, 2047, 4180, 18715, 2368, 19362, 8043, 1010, 2047, 2404, 18715, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MailManager.php
MailManager.renderTwig
protected function renderTwig($content, $data = []) { if ($this->isTwigStarted) { return Twig::parse($content, $data); } $this->startTwig(); $result = Twig::parse($content, $data); $this->stopTwig(); return $result; }
php
protected function renderTwig($content, $data = []) { if ($this->isTwigStarted) { return Twig::parse($content, $data); } $this->startTwig(); $result = Twig::parse($content, $data); $this->stopTwig(); return $result; }
[ "protected", "function", "renderTwig", "(", "$", "content", ",", "$", "data", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "isTwigStarted", ")", "{", "return", "Twig", "::", "parse", "(", "$", "content", ",", "$", "data", ")", ";", "}", ...
Internal helper for rendering Twig
[ "Internal", "helper", "for", "rendering", "Twig" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MailManager.php#L277-L290
train
Renders Twig.
[ 30522, 5123, 3853, 17552, 2102, 16279, 1006, 1002, 4180, 1010, 1002, 2951, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 21541, 16279, 14117, 3064, 1007, 1063, 2709, 1056, 16279, 1024, 1024, 11968, 3366, 1006, 1002, 4180...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Writable/Maildir.php
Zend_Mail_Storage_Writable_Maildir.checkQuota
public function checkQuota($detailedResponse = false, $forceRecalc = false) { $result = $this->_calculateQuota($forceRecalc); return $detailedResponse ? $result : $result['over_quota']; }
php
public function checkQuota($detailedResponse = false, $forceRecalc = false) { $result = $this->_calculateQuota($forceRecalc); return $detailedResponse ? $result : $result['over_quota']; }
[ "public", "function", "checkQuota", "(", "$", "detailedResponse", "=", "false", ",", "$", "forceRecalc", "=", "false", ")", "{", "$", "result", "=", "$", "this", "->", "_calculateQuota", "(", "$", "forceRecalc", ")", ";", "return", "$", "detailedResponse", ...
check if storage is currently over quota @param bool $detailedResponse return known data of quota and current size and message count @see _calculateQuota() @return bool|array over quota state or detailed response
[ "check", "if", "storage", "is", "currently", "over", "quota" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Writable/Maildir.php#L1045-L1048
train
Checks if the quota of the current page is over.
[ 30522, 2270, 3853, 4638, 28940, 17287, 1006, 1002, 6851, 6072, 26029, 3366, 1027, 6270, 1010, 1002, 2486, 2890, 9289, 2278, 1027, 6270, 1007, 1063, 1002, 2765, 1027, 1002, 2023, 1011, 1028, 1035, 18422, 28940, 17287, 1006, 1002, 2486, 2890,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/TemplateMessage/Client.php
Client.formatMessage
protected function formatMessage(array $data = []) { $params = array_merge($this->message, $data); foreach ($params as $key => $value) { if (in_array($key, $this->required, true) && empty($value) && empty($this->message[$key])) { throw new InvalidArgumentException(sprintf('Attribute "%s" can not be empty!', $key)); } $params[$key] = empty($value) ? $this->message[$key] : $value; } $params['data'] = $this->formatData($params['data'] ?? []); return $params; }
php
protected function formatMessage(array $data = []) { $params = array_merge($this->message, $data); foreach ($params as $key => $value) { if (in_array($key, $this->required, true) && empty($value) && empty($this->message[$key])) { throw new InvalidArgumentException(sprintf('Attribute "%s" can not be empty!', $key)); } $params[$key] = empty($value) ? $this->message[$key] : $value; } $params['data'] = $this->formatData($params['data'] ?? []); return $params; }
[ "protected", "function", "formatMessage", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "params", "=", "array_merge", "(", "$", "this", "->", "message", ",", "$", "data", ")", ";", "foreach", "(", "$", "params", "as", "$", "key", "=>", "...
@param array $data @return array @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
[ "@param", "array", "$data" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/TemplateMessage/Client.php#L156-L171
train
Format the message
[ 30522, 5123, 3853, 4289, 7834, 3736, 3351, 1006, 9140, 1002, 2951, 1027, 1031, 1033, 1007, 1063, 1002, 11498, 5244, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1011, 1028, 4471, 1010, 1002, 2951, 1007, 1025, 18921, 6776, 1006, 1002, 11498, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Scheduler/Schedule/Schedule.php
Schedule.factory
public static function factory($periodType, $periodDay = false) { switch ($periodType) { case 'hourly': return new Hourly(); case 'daily': return new Daily(); case 'weekly': $result = new Weekly(); if ($periodDay !== false) { $result->setDay($periodDay); } return $result; case 'monthly': $result = new Monthly($periodDay); if ($periodDay !== false) { if (is_int($periodDay)) { $result->setDay($periodDay); } else { $result->setDayOfWeekFromString($periodDay); } } return $result; default: throw new Exception("Unsupported scheduled period type: '$periodType'. Supported values are" . " 'hourly', 'daily', 'weekly' or 'monthly'."); } }
php
public static function factory($periodType, $periodDay = false) { switch ($periodType) { case 'hourly': return new Hourly(); case 'daily': return new Daily(); case 'weekly': $result = new Weekly(); if ($periodDay !== false) { $result->setDay($periodDay); } return $result; case 'monthly': $result = new Monthly($periodDay); if ($periodDay !== false) { if (is_int($periodDay)) { $result->setDay($periodDay); } else { $result->setDayOfWeekFromString($periodDay); } } return $result; default: throw new Exception("Unsupported scheduled period type: '$periodType'. Supported values are" . " 'hourly', 'daily', 'weekly' or 'monthly'."); } }
[ "public", "static", "function", "factory", "(", "$", "periodType", ",", "$", "periodDay", "=", "false", ")", "{", "switch", "(", "$", "periodType", ")", "{", "case", "'hourly'", ":", "return", "new", "Hourly", "(", ")", ";", "case", "'daily'", ":", "re...
Returns a new Schedule instance using a string description of the scheduled period type and a string description of the day within the period to execute the task on. @param string $periodType The scheduled period type. Can be `'hourly'`, `'daily'`, `'weekly'`, or `'monthly'`. @param bool|false|int|string $periodDay A string describing the day within the scheduled period to execute the task on. Only valid for week and month periods. If `'weekly'` is supplied for `$periodType`, this should be a day of the week, for example, `'monday'` or `'tuesday'`. If `'monthly'` is supplied for `$periodType`, this can be a numeric day in the month or a day in one week of the month. For example, `12`, `23`, `'first sunday'` or `'fourth tuesday'`. @return Hourly|Daily|Weekly|Monthly @throws Exception @api
[ "Returns", "a", "new", "Schedule", "instance", "using", "a", "string", "description", "of", "the", "scheduled", "period", "type", "and", "a", "string", "description", "of", "the", "day", "within", "the", "period", "to", "execute", "the", "task", "on", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Scheduler/Schedule/Schedule.php#L196-L223
train
Returns a scheduled period object.
[ 30522, 2270, 10763, 3853, 4713, 1006, 1002, 2558, 13874, 1010, 1002, 2558, 10259, 1027, 6270, 1007, 1063, 6942, 1006, 1002, 2558, 13874, 1007, 1063, 2553, 1005, 21462, 1005, 1024, 2709, 2047, 21462, 1006, 1007, 1025, 2553, 1005, 3679, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/HeaderUtils.php
HeaderUtils.toString
public static function toString(array $assoc, string $separator): string { $parts = []; foreach ($assoc as $name => $value) { if (true === $value) { $parts[] = $name; } else { $parts[] = $name.'='.self::quote($value); } } return implode($separator.' ', $parts); }
php
public static function toString(array $assoc, string $separator): string { $parts = []; foreach ($assoc as $name => $value) { if (true === $value) { $parts[] = $name; } else { $parts[] = $name.'='.self::quote($value); } } return implode($separator.' ', $parts); }
[ "public", "static", "function", "toString", "(", "array", "$", "assoc", ",", "string", "$", "separator", ")", ":", "string", "{", "$", "parts", "=", "[", "]", ";", "foreach", "(", "$", "assoc", "as", "$", "name", "=>", "$", "value", ")", "{", "if",...
Joins an associative array into a string for use in an HTTP header. The key and value of each entry are joined with "=", and all entries are joined with the specified separator and an additional space (for readability). Values are quoted if necessary. Example: HeaderUtils::toString(["foo" => "abc", "bar" => true, "baz" => "a b c"], ",") // => 'foo=abc, bar, baz="a b c"'
[ "Joins", "an", "associative", "array", "into", "a", "string", "for", "use", "in", "an", "HTTP", "header", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/HeaderUtils.php#L108-L120
train
Returns the string representation of the array
[ 30522, 2270, 10763, 3853, 2000, 3367, 4892, 1006, 9140, 1002, 4632, 10085, 1010, 5164, 1002, 19802, 25879, 2953, 1007, 1024, 5164, 1063, 1002, 3033, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 4632, 10085, 2004, 1002, 2171, 1027, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
XmlDumper.addServiceAlias
private function addServiceAlias($alias, Alias $id, \DOMElement $parent) { $service = $this->document->createElement('service'); $service->setAttribute('id', $alias); $service->setAttribute('alias', $id); if (!$id->isPrivate()) { $service->setAttribute('public', $id->isPublic() ? 'true' : 'false'); } if ($id->isDeprecated()) { $deprecated = $this->document->createElement('deprecated'); $deprecated->appendChild($this->document->createTextNode($id->getDeprecationMessage('%alias_id%'))); $service->appendChild($deprecated); } $parent->appendChild($service); }
php
private function addServiceAlias($alias, Alias $id, \DOMElement $parent) { $service = $this->document->createElement('service'); $service->setAttribute('id', $alias); $service->setAttribute('alias', $id); if (!$id->isPrivate()) { $service->setAttribute('public', $id->isPublic() ? 'true' : 'false'); } if ($id->isDeprecated()) { $deprecated = $this->document->createElement('deprecated'); $deprecated->appendChild($this->document->createTextNode($id->getDeprecationMessage('%alias_id%'))); $service->appendChild($deprecated); } $parent->appendChild($service); }
[ "private", "function", "addServiceAlias", "(", "$", "alias", ",", "Alias", "$", "id", ",", "\\", "DOMElement", "$", "parent", ")", "{", "$", "service", "=", "$", "this", "->", "document", "->", "createElement", "(", "'service'", ")", ";", "$", "service",...
Adds a service alias. @param string $alias @param Alias $id @param \DOMElement $parent
[ "Adds", "a", "service", "alias", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php#L225-L242
train
Adds service alias to the parent node
[ 30522, 2797, 3853, 9909, 2121, 7903, 15879, 7951, 1006, 1002, 14593, 1010, 14593, 1002, 8909, 1010, 1032, 8514, 16930, 4765, 1002, 6687, 1007, 1063, 1002, 2326, 1027, 1002, 2023, 1011, 1028, 6254, 1011, 1028, 3443, 12260, 3672, 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...
z-song/laravel-admin
src/Controllers/UserController.php
UserController.detail
protected function detail($id) { $userModel = config('admin.database.users_model'); $show = new Show($userModel::findOrFail($id)); $show->id('ID'); $show->username(trans('admin.username')); $show->name(trans('admin.name')); $show->roles(trans('admin.roles'))->as(function ($roles) { return $roles->pluck('name'); })->label(); $show->permissions(trans('admin.permissions'))->as(function ($permission) { return $permission->pluck('name'); })->label(); $show->created_at(trans('admin.created_at')); $show->updated_at(trans('admin.updated_at')); return $show; }
php
protected function detail($id) { $userModel = config('admin.database.users_model'); $show = new Show($userModel::findOrFail($id)); $show->id('ID'); $show->username(trans('admin.username')); $show->name(trans('admin.name')); $show->roles(trans('admin.roles'))->as(function ($roles) { return $roles->pluck('name'); })->label(); $show->permissions(trans('admin.permissions'))->as(function ($permission) { return $permission->pluck('name'); })->label(); $show->created_at(trans('admin.created_at')); $show->updated_at(trans('admin.updated_at')); return $show; }
[ "protected", "function", "detail", "(", "$", "id", ")", "{", "$", "userModel", "=", "config", "(", "'admin.database.users_model'", ")", ";", "$", "show", "=", "new", "Show", "(", "$", "userModel", "::", "findOrFail", "(", "$", "id", ")", ")", ";", "$",...
Make a show builder. @param mixed $id @return Show
[ "Make", "a", "show", "builder", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/UserController.php#L112-L131
train
Detail show.
[ 30522, 5123, 3853, 6987, 1006, 1002, 8909, 1007, 1063, 1002, 5310, 5302, 9247, 1027, 9530, 8873, 2290, 1006, 1005, 4748, 10020, 1012, 7809, 1012, 5198, 1035, 2944, 1005, 1007, 1025, 1002, 2265, 1027, 2047, 2265, 1006, 1002, 5310, 5302, 92...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...