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/Config/Loader/DelegatingLoader.php
DelegatingLoader.load
public function load($resource, $type = null) { if (false === $loader = $this->resolver->resolve($resource, $type)) { throw new LoaderLoadException($resource, null, null, null, $type); } return $loader->load($resource, $type); }
php
public function load($resource, $type = null) { if (false === $loader = $this->resolver->resolve($resource, $type)) { throw new LoaderLoadException($resource, null, null, null, $type); } return $loader->load($resource, $type); }
[ "public", "function", "load", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "if", "(", "false", "===", "$", "loader", "=", "$", "this", "->", "resolver", "->", "resolve", "(", "$", "resource", ",", "$", "type", ")", ")", "{", "th...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Loader/DelegatingLoader.php#L34-L41
train
Load a resource and type
[ 30522, 2270, 3853, 7170, 1006, 1002, 7692, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 2065, 1006, 6270, 1027, 1027, 1027, 1002, 7170, 2121, 1027, 1002, 2023, 1011, 1028, 10663, 2099, 1011, 1028, 10663, 1006, 1002, 7692, 1010, 1002, 2828, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Connectors/PostgresConnector.php
PostgresConnector.connect
public function connect(array $config) { // First we'll create the basic DSN and connection instance connecting to the // using the configuration option specified by the developer. We will also // set the default character set on the connections to UTF-8 by default. $connection = $this->createConnection( $this->getDsn($config), $config, $this->getOptions($config) ); $this->configureEncoding($connection, $config); // Next, we will check to see if a timezone has been specified in this config // and if it has we will issue a statement to modify the timezone with the // database. Setting this DB timezone is an optional configuration item. $this->configureTimezone($connection, $config); $this->configureSchema($connection, $config); // Postgres allows an application_name to be set by the user and this name is // used to when monitoring the application with pg_stat_activity. So we'll // determine if the option has been specified and run a statement if so. $this->configureApplicationName($connection, $config); return $connection; }
php
public function connect(array $config) { // First we'll create the basic DSN and connection instance connecting to the // using the configuration option specified by the developer. We will also // set the default character set on the connections to UTF-8 by default. $connection = $this->createConnection( $this->getDsn($config), $config, $this->getOptions($config) ); $this->configureEncoding($connection, $config); // Next, we will check to see if a timezone has been specified in this config // and if it has we will issue a statement to modify the timezone with the // database. Setting this DB timezone is an optional configuration item. $this->configureTimezone($connection, $config); $this->configureSchema($connection, $config); // Postgres allows an application_name to be set by the user and this name is // used to when monitoring the application with pg_stat_activity. So we'll // determine if the option has been specified and run a statement if so. $this->configureApplicationName($connection, $config); return $connection; }
[ "public", "function", "connect", "(", "array", "$", "config", ")", "{", "// First we'll create the basic DSN and connection instance connecting to the", "// using the configuration option specified by the developer. We will also", "// set the default character set on the connections to UTF-8 b...
Establish a database connection. @param array $config @return \PDO
[ "Establish", "a", "database", "connection", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/PostgresConnector.php#L27-L51
train
Connects to the database and sets the character set on the connection.
[ 30522, 2270, 3853, 7532, 1006, 9140, 1002, 9530, 8873, 2290, 1007, 1063, 1013, 1013, 2034, 2057, 1005, 2222, 3443, 1996, 3937, 16233, 2078, 1998, 4434, 6013, 7176, 2000, 1996, 1013, 1013, 2478, 1996, 9563, 5724, 9675, 2011, 1996, 9722, 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/Controller/Page.php
HTML_QuickForm2_Controller_Page.populateFormOnce
final public function populateFormOnce() { if (!$this->_formPopulated) { if (!empty($this->controller) && $this->controller->propagateId()) { $this->form->addElement( 'hidden', HTML_QuickForm2_Controller::KEY_ID, array('id' => HTML_QuickForm2_Controller::KEY_ID) )->setValue($this->controller->getId()); } $this->populateForm(); $this->_formPopulated = true; } }
php
final public function populateFormOnce() { if (!$this->_formPopulated) { if (!empty($this->controller) && $this->controller->propagateId()) { $this->form->addElement( 'hidden', HTML_QuickForm2_Controller::KEY_ID, array('id' => HTML_QuickForm2_Controller::KEY_ID) )->setValue($this->controller->getId()); } $this->populateForm(); $this->_formPopulated = true; } }
[ "final", "public", "function", "populateFormOnce", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_formPopulated", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "controller", ")", "&&", "$", "this", "->", "controller", "->", "propagate...
Wrapper around populateForm() ensuring that it is only called once
[ "Wrapper", "around", "populateForm", "()", "ensuring", "that", "it", "is", "only", "called", "once" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller/Page.php#L215-L227
train
Populates the form only if the controller has been set
[ 30522, 2345, 2270, 3853, 3769, 9869, 14192, 2239, 3401, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2433, 16340, 8898, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 11486, 1007, 1004, 1004, 1002, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/API/DataTableManipulator.php
DataTableManipulator.getApiMethodForSubtable
protected function getApiMethodForSubtable($request) { if (!$this->apiMethodForSubtable) { if (!empty($request['idSite'])) { $idSite = $request['idSite']; } else { $idSite = 'all'; } $apiParameters = array(); $entityNames = StaticContainer::get('entities.idNames'); foreach ($entityNames as $idName) { if (!empty($request[$idName])) { $apiParameters[$idName] = $request[$idName]; } } $meta = API::getInstance()->getMetadata($idSite, $this->apiModule, $this->apiMethod, $apiParameters); if (empty($meta) && array_key_exists('idGoal', $apiParameters)) { unset($apiParameters['idGoal']); $meta = API::getInstance()->getMetadata($idSite, $this->apiModule, $this->apiMethod, $apiParameters); } if (empty($meta)) { throw new Exception(sprintf( "The DataTable cannot be manipulated: Metadata for report %s.%s could not be found. You can define the metadata in a hook, see example at: https://developer.matomo.org/api-reference/events#apigetreportmetadata", $this->apiModule, $this->apiMethod )); } if (isset($meta[0]['actionToLoadSubTables'])) { $this->apiMethodForSubtable = $meta[0]['actionToLoadSubTables']; } else { $this->apiMethodForSubtable = $this->apiMethod; } } return $this->apiMethodForSubtable; }
php
protected function getApiMethodForSubtable($request) { if (!$this->apiMethodForSubtable) { if (!empty($request['idSite'])) { $idSite = $request['idSite']; } else { $idSite = 'all'; } $apiParameters = array(); $entityNames = StaticContainer::get('entities.idNames'); foreach ($entityNames as $idName) { if (!empty($request[$idName])) { $apiParameters[$idName] = $request[$idName]; } } $meta = API::getInstance()->getMetadata($idSite, $this->apiModule, $this->apiMethod, $apiParameters); if (empty($meta) && array_key_exists('idGoal', $apiParameters)) { unset($apiParameters['idGoal']); $meta = API::getInstance()->getMetadata($idSite, $this->apiModule, $this->apiMethod, $apiParameters); } if (empty($meta)) { throw new Exception(sprintf( "The DataTable cannot be manipulated: Metadata for report %s.%s could not be found. You can define the metadata in a hook, see example at: https://developer.matomo.org/api-reference/events#apigetreportmetadata", $this->apiModule, $this->apiMethod )); } if (isset($meta[0]['actionToLoadSubTables'])) { $this->apiMethodForSubtable = $meta[0]['actionToLoadSubTables']; } else { $this->apiMethodForSubtable = $this->apiMethod; } } return $this->apiMethodForSubtable; }
[ "protected", "function", "getApiMethodForSubtable", "(", "$", "request", ")", "{", "if", "(", "!", "$", "this", "->", "apiMethodForSubtable", ")", "{", "if", "(", "!", "empty", "(", "$", "request", "[", "'idSite'", "]", ")", ")", "{", "$", "idSite", "=...
Extract the API method for loading subtables from the meta data @throws Exception @return string
[ "Extract", "the", "API", "method", "for", "loading", "subtables", "from", "the", "meta", "data" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DataTableManipulator.php#L146-L184
train
Returns the api method for subtable
[ 30522, 5123, 3853, 2131, 9331, 14428, 2705, 7716, 29278, 6342, 19279, 3085, 1006, 1002, 5227, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 17928, 11368, 6806, 20952, 5668, 12083, 10880, 1007, 1063, 2065, 1006, 999, 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/Security/Core/Authorization/AccessDecisionManager.php
AccessDecisionManager.decideUnanimous
private function decideUnanimous(TokenInterface $token, array $attributes, $object = null) { $grant = 0; foreach ($this->voters as $voter) { foreach ($attributes as $attribute) { $result = $voter->vote($token, $object, [$attribute]); switch ($result) { case VoterInterface::ACCESS_GRANTED: ++$grant; break; case VoterInterface::ACCESS_DENIED: return false; default: break; } } } // no deny votes if ($grant > 0) { return true; } return $this->allowIfAllAbstainDecisions; }
php
private function decideUnanimous(TokenInterface $token, array $attributes, $object = null) { $grant = 0; foreach ($this->voters as $voter) { foreach ($attributes as $attribute) { $result = $voter->vote($token, $object, [$attribute]); switch ($result) { case VoterInterface::ACCESS_GRANTED: ++$grant; break; case VoterInterface::ACCESS_DENIED: return false; default: break; } } } // no deny votes if ($grant > 0) { return true; } return $this->allowIfAllAbstainDecisions; }
[ "private", "function", "decideUnanimous", "(", "TokenInterface", "$", "token", ",", "array", "$", "attributes", ",", "$", "object", "=", "null", ")", "{", "$", "grant", "=", "0", ";", "foreach", "(", "$", "this", "->", "voters", "as", "$", "voter", ")"...
Grants access if only grant (or abstain) votes were received. If all voters abstained from voting, the decision will be based on the allowIfAllAbstainDecisions property value (defaults to false).
[ "Grants", "access", "if", "only", "grant", "(", "or", "abstain", ")", "votes", "were", "received", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php#L150-L178
train
Decides whether a token has unanimous access
[ 30522, 2797, 3853, 5630, 9521, 3490, 27711, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1010, 9140, 1002, 12332, 1010, 1002, 4874, 1027, 19701, 1007, 1063, 1002, 3946, 1027, 1014, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 7206, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Authentication/DefaultAuthenticationSuccessHandler.php
DefaultAuthenticationSuccessHandler.onAuthenticationSuccess
public function onAuthenticationSuccess(Request $request, TokenInterface $token) { return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); }
php
public function onAuthenticationSuccess(Request $request, TokenInterface $token) { return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); }
[ "public", "function", "onAuthenticationSuccess", "(", "Request", "$", "request", ",", "TokenInterface", "$", "token", ")", "{", "return", "$", "this", "->", "httpUtils", "->", "createRedirectResponse", "(", "$", "request", ",", "$", "this", "->", "determineTarge...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php#L55-L58
train
This method is called when an authentication is successful. It returns a redirect response to the target URL.
[ 30522, 2270, 3853, 2006, 4887, 10760, 16778, 10719, 6342, 9468, 7971, 1006, 5227, 1002, 5227, 1010, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 8299, 21823, 4877, 1011, 1028, 3443, 5596, 7442, 6593, 607...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Cookie/CookieJar.php
CookieJar.removeCookieIfEmpty
private function removeCookieIfEmpty(SetCookie $cookie) { $cookieValue = $cookie->getValue(); if ($cookieValue === null || $cookieValue === '') { $this->clear( $cookie->getDomain(), $cookie->getPath(), $cookie->getName() ); } }
php
private function removeCookieIfEmpty(SetCookie $cookie) { $cookieValue = $cookie->getValue(); if ($cookieValue === null || $cookieValue === '') { $this->clear( $cookie->getDomain(), $cookie->getPath(), $cookie->getName() ); } }
[ "private", "function", "removeCookieIfEmpty", "(", "SetCookie", "$", "cookie", ")", "{", "$", "cookieValue", "=", "$", "cookie", "->", "getValue", "(", ")", ";", "if", "(", "$", "cookieValue", "===", "null", "||", "$", "cookieValue", "===", "''", ")", "{...
If a cookie already exists and the server asks to set it again with a null value, the cookie must be deleted. @param SetCookie $cookie
[ "If", "a", "cookie", "already", "exists", "and", "the", "server", "asks", "to", "set", "it", "again", "with", "a", "null", "value", "the", "cookie", "must", "be", "deleted", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/CookieJar.php#L303-L313
train
Remove cookie if value is null or empty
[ 30522, 2797, 3853, 6366, 3597, 23212, 7416, 7959, 27718, 2100, 1006, 2275, 3597, 23212, 2063, 1002, 17387, 1007, 1063, 1002, 17387, 10175, 5657, 30524, 2065, 1006, 1002, 17387, 10175, 5657, 1027, 1027, 1027, 19701, 1064, 1064, 1002, 17387, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Rule.php
Rule.in
public static function in($values) { if ($values instanceof Arrayable) { $values = $values->toArray(); } return new Rules\In(is_array($values) ? $values : func_get_args()); }
php
public static function in($values) { if ($values instanceof Arrayable) { $values = $values->toArray(); } return new Rules\In(is_array($values) ? $values : func_get_args()); }
[ "public", "static", "function", "in", "(", "$", "values", ")", "{", "if", "(", "$", "values", "instanceof", "Arrayable", ")", "{", "$", "values", "=", "$", "values", "->", "toArray", "(", ")", ";", "}", "return", "new", "Rules", "\\", "In", "(", "i...
Get an in constraint builder instance. @param \Illuminate\Contracts\Support\Arrayable|array|string $values @return \Illuminate\Validation\Rules\In
[ "Get", "an", "in", "constraint", "builder", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Rule.php#L41-L48
train
Returns a new RuleSet containing only the values that are in the array
[ 30522, 2270, 10763, 3853, 1999, 1006, 1002, 5300, 1007, 1063, 2065, 1006, 1002, 5300, 6013, 11253, 9140, 3085, 1007, 1063, 1002, 5300, 1027, 1002, 5300, 1011, 1028, 2000, 2906, 9447, 1006, 1007, 1025, 1065, 2709, 2047, 3513, 1032, 1999, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement/Db2.php
Zend_Db_Statement_Db2._prepare
public function _prepare($sql) { $connection = $this->_adapter->getConnection(); // db2_prepare on i5 emits errors, these need to be // suppressed so that proper exceptions can be thrown $this->_stmt = @db2_prepare($connection, $sql); if (!$this->_stmt) { /** * @see Zend_Db_Statement_Db2_Exception */ // require_once 'Zend/Db/Statement/Db2/Exception.php'; throw new Zend_Db_Statement_Db2_Exception( db2_stmt_errormsg(), db2_stmt_error() ); } }
php
public function _prepare($sql) { $connection = $this->_adapter->getConnection(); // db2_prepare on i5 emits errors, these need to be // suppressed so that proper exceptions can be thrown $this->_stmt = @db2_prepare($connection, $sql); if (!$this->_stmt) { /** * @see Zend_Db_Statement_Db2_Exception */ // require_once 'Zend/Db/Statement/Db2/Exception.php'; throw new Zend_Db_Statement_Db2_Exception( db2_stmt_errormsg(), db2_stmt_error() ); } }
[ "public", "function", "_prepare", "(", "$", "sql", ")", "{", "$", "connection", "=", "$", "this", "->", "_adapter", "->", "getConnection", "(", ")", ";", "// db2_prepare on i5 emits errors, these need to be", "// suppressed so that proper exceptions can be thrown", "$", ...
Prepare a statement handle. @param string $sql @return void @throws Zend_Db_Statement_Db2_Exception
[ "Prepare", "a", "statement", "handle", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Db2.php#L56-L74
train
Prepare statement for execution
[ 30522, 2270, 3853, 1035, 7374, 1006, 1002, 29296, 1007, 1063, 1002, 4434, 1027, 1002, 2023, 1011, 1028, 1035, 15581, 2121, 1011, 1028, 2131, 8663, 2638, 7542, 1006, 1007, 1025, 1013, 1013, 16962, 2475, 1035, 7374, 2006, 1045, 2629, 12495, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/RouteCollectionBuilder.php
RouteCollectionBuilder.build
public function build() { $routeCollection = new RouteCollection(); foreach ($this->routes as $name => $route) { if ($route instanceof Route) { $route->setDefaults(array_merge($this->defaults, $route->getDefaults())); $route->setOptions(array_merge($this->options, $route->getOptions())); foreach ($this->requirements as $key => $val) { if (!$route->hasRequirement($key)) { $route->setRequirement($key, $val); } } if (null !== $this->prefix) { $route->setPath('/'.$this->prefix.$route->getPath()); } if (!$route->getHost()) { $route->setHost($this->host); } if (!$route->getCondition()) { $route->setCondition($this->condition); } if (!$route->getSchemes()) { $route->setSchemes($this->schemes); } if (!$route->getMethods()) { $route->setMethods($this->methods); } // auto-generate the route name if it's been marked if ('_unnamed_route_' === substr($name, 0, 15)) { $name = $this->generateRouteName($route); } $routeCollection->add($name, $route); } else { /* @var self $route */ $subCollection = $route->build(); $subCollection->addPrefix($this->prefix); $routeCollection->addCollection($subCollection); } } foreach ($this->resources as $resource) { $routeCollection->addResource($resource); } return $routeCollection; }
php
public function build() { $routeCollection = new RouteCollection(); foreach ($this->routes as $name => $route) { if ($route instanceof Route) { $route->setDefaults(array_merge($this->defaults, $route->getDefaults())); $route->setOptions(array_merge($this->options, $route->getOptions())); foreach ($this->requirements as $key => $val) { if (!$route->hasRequirement($key)) { $route->setRequirement($key, $val); } } if (null !== $this->prefix) { $route->setPath('/'.$this->prefix.$route->getPath()); } if (!$route->getHost()) { $route->setHost($this->host); } if (!$route->getCondition()) { $route->setCondition($this->condition); } if (!$route->getSchemes()) { $route->setSchemes($this->schemes); } if (!$route->getMethods()) { $route->setMethods($this->methods); } // auto-generate the route name if it's been marked if ('_unnamed_route_' === substr($name, 0, 15)) { $name = $this->generateRouteName($route); } $routeCollection->add($name, $route); } else { /* @var self $route */ $subCollection = $route->build(); $subCollection->addPrefix($this->prefix); $routeCollection->addCollection($subCollection); } } foreach ($this->resources as $resource) { $routeCollection->addResource($resource); } return $routeCollection; }
[ "public", "function", "build", "(", ")", "{", "$", "routeCollection", "=", "new", "RouteCollection", "(", ")", ";", "foreach", "(", "$", "this", "->", "routes", "as", "$", "name", "=>", "$", "route", ")", "{", "if", "(", "$", "route", "instanceof", "...
Creates the final RouteCollection and returns it. @return RouteCollection
[ "Creates", "the", "final", "RouteCollection", "and", "returns", "it", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L268-L323
train
Build the route collection
[ 30522, 2270, 3853, 3857, 1006, 1007, 1063, 1002, 2799, 26895, 18491, 1027, 2047, 2799, 26895, 18491, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 5847, 2004, 1002, 2171, 1027, 1028, 1002, 2799, 1007, 1063, 2065, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/AbstractTypeExtension.php
AbstractTypeExtension.getExtendedType
public function getExtendedType() { if (!method_exists($this, 'getExtendedTypes')) { throw new LogicException(sprintf('You need to implement the static getExtendedTypes() method when implementing the %s in %s.', FormTypeExtensionInterface::class, static::class)); } @trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', \get_class($this)), E_USER_DEPRECATED); foreach (static::getExtendedTypes() as $extendedType) { return $extendedType; } }
php
public function getExtendedType() { if (!method_exists($this, 'getExtendedTypes')) { throw new LogicException(sprintf('You need to implement the static getExtendedTypes() method when implementing the %s in %s.', FormTypeExtensionInterface::class, static::class)); } @trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', \get_class($this)), E_USER_DEPRECATED); foreach (static::getExtendedTypes() as $extendedType) { return $extendedType; } }
[ "public", "function", "getExtendedType", "(", ")", "{", "if", "(", "!", "method_exists", "(", "$", "this", ",", "'getExtendedTypes'", ")", ")", "{", "throw", "new", "LogicException", "(", "sprintf", "(", "'You need to implement the static getExtendedTypes() method whe...
{@inheritdoc} @deprecated since Symfony 4.2, use getExtendedTypes() instead.
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/AbstractTypeExtension.php#L55-L66
train
Returns the extended type of the form type
[ 30522, 2270, 3853, 2131, 10288, 6528, 5732, 13874, 1006, 1007, 1063, 2065, 1006, 999, 4118, 1035, 6526, 1006, 1002, 2023, 1010, 1005, 2131, 10288, 6528, 5732, 13874, 2015, 1005, 1007, 1007, 1063, 5466, 2047, 7961, 10288, 24422, 1006, 9043, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Insights/InsightReport.php
InsightReport.generateInsight
public function generateInsight($reportMetadata, $period, $date, $lastDate, $metric, $currentReport, $lastReport, $totalValue, $minMoversPercent, $minNewPercent, $minDisappearedPercent, $minGrowthPercentPositive, $minGrowthPercentNegative, $orderBy, $limitIncreaser, $limitDecreaser) { $minChangeMovers = $this->getMinVisits($totalValue, $minMoversPercent); $minIncreaseNew = $this->getMinVisits($totalValue, $minNewPercent); $minDecreaseDisappeared = $this->getMinVisits($totalValue, $minDisappearedPercent); $dataTable = new DataTable(); $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\Insight', array( $currentReport, $lastReport, $metric, $considerMovers = (-1 !== $minMoversPercent), $considerNew = (-1 !== $minNewPercent), $considerDisappeared = (-1 !== $minDisappearedPercent) ) ); $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\MinGrowth', array( 'growth_percent_numeric', $minGrowthPercentPositive, $minGrowthPercentNegative ) ); if ($minIncreaseNew) { $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue', array( 'difference', $minIncreaseNew, 'isNew' ) ); } if ($minChangeMovers) { $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue', array( 'difference', $minChangeMovers, 'isMover' ) ); } if ($minDecreaseDisappeared) { $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue', array( 'difference', $minDecreaseDisappeared, 'isDisappeared' ) ); } $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\OrderBy', array( $this->getOrderByColumn($orderBy), $orderBy === self::ORDER_BY_RELATIVE ? $this->getOrderByColumn(self::ORDER_BY_ABSOLUTE) : $this->getOrderByColumn(self::ORDER_BY_RELATIVE), $metric ) ); $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\Limit', array( 'growth_percent_numeric', $limitIncreaser, $limitDecreaser ) ); $metricName = $metric; if (!empty($reportMetadata['metrics'][$metric])) { $metricName = $reportMetadata['metrics'][$metric]; } $dataTable->setMetadataValues(array( 'reportName' => $reportMetadata['name'], 'metricName' => $metricName, 'date' => $date, 'lastDate' => $lastDate, 'period' => $period, 'report' => $reportMetadata, 'totalValue' => $totalValue, 'orderBy' => $orderBy, 'metric' => $metric, 'minChangeMovers' => $minChangeMovers, 'minIncreaseNew' => $minIncreaseNew, 'minDecreaseDisappeared' => $minDecreaseDisappeared, 'minGrowthPercentPositive' => $minGrowthPercentPositive, 'minGrowthPercentNegative' => $minGrowthPercentNegative, 'minMoversPercent' => $minMoversPercent, 'minNewPercent' => $minNewPercent, 'minDisappearedPercent' => $minDisappearedPercent )); return $dataTable; }
php
public function generateInsight($reportMetadata, $period, $date, $lastDate, $metric, $currentReport, $lastReport, $totalValue, $minMoversPercent, $minNewPercent, $minDisappearedPercent, $minGrowthPercentPositive, $minGrowthPercentNegative, $orderBy, $limitIncreaser, $limitDecreaser) { $minChangeMovers = $this->getMinVisits($totalValue, $minMoversPercent); $minIncreaseNew = $this->getMinVisits($totalValue, $minNewPercent); $minDecreaseDisappeared = $this->getMinVisits($totalValue, $minDisappearedPercent); $dataTable = new DataTable(); $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\Insight', array( $currentReport, $lastReport, $metric, $considerMovers = (-1 !== $minMoversPercent), $considerNew = (-1 !== $minNewPercent), $considerDisappeared = (-1 !== $minDisappearedPercent) ) ); $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\MinGrowth', array( 'growth_percent_numeric', $minGrowthPercentPositive, $minGrowthPercentNegative ) ); if ($minIncreaseNew) { $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue', array( 'difference', $minIncreaseNew, 'isNew' ) ); } if ($minChangeMovers) { $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue', array( 'difference', $minChangeMovers, 'isMover' ) ); } if ($minDecreaseDisappeared) { $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue', array( 'difference', $minDecreaseDisappeared, 'isDisappeared' ) ); } $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\OrderBy', array( $this->getOrderByColumn($orderBy), $orderBy === self::ORDER_BY_RELATIVE ? $this->getOrderByColumn(self::ORDER_BY_ABSOLUTE) : $this->getOrderByColumn(self::ORDER_BY_RELATIVE), $metric ) ); $dataTable->filter( 'Piwik\Plugins\Insights\DataTable\Filter\Limit', array( 'growth_percent_numeric', $limitIncreaser, $limitDecreaser ) ); $metricName = $metric; if (!empty($reportMetadata['metrics'][$metric])) { $metricName = $reportMetadata['metrics'][$metric]; } $dataTable->setMetadataValues(array( 'reportName' => $reportMetadata['name'], 'metricName' => $metricName, 'date' => $date, 'lastDate' => $lastDate, 'period' => $period, 'report' => $reportMetadata, 'totalValue' => $totalValue, 'orderBy' => $orderBy, 'metric' => $metric, 'minChangeMovers' => $minChangeMovers, 'minIncreaseNew' => $minIncreaseNew, 'minDecreaseDisappeared' => $minDecreaseDisappeared, 'minGrowthPercentPositive' => $minGrowthPercentPositive, 'minGrowthPercentNegative' => $minGrowthPercentNegative, 'minMoversPercent' => $minMoversPercent, 'minNewPercent' => $minNewPercent, 'minDisappearedPercent' => $minDisappearedPercent )); return $dataTable; }
[ "public", "function", "generateInsight", "(", "$", "reportMetadata", ",", "$", "period", ",", "$", "date", ",", "$", "lastDate", ",", "$", "metric", ",", "$", "currentReport", ",", "$", "lastReport", ",", "$", "totalValue", ",", "$", "minMoversPercent", ",...
@param array $reportMetadata @param string $period @param string $date @param string $lastDate @param string $metric @param DataTable $currentReport @param DataTable $lastReport @param int $totalValue @param int $minMoversPercent Exclude rows who moved and the difference is not at least min percent visits of totalVisits. -1 excludes movers. @param int $minNewPercent Exclude rows who are new and the difference is not at least min percent visits of totalVisits. -1 excludes all new. @param int $minDisappearedPercent Exclude rows who are disappeared and the difference is not at least min percent visits of totalVisits. -1 excludes all disappeared. @param int $minGrowthPercentPositive The actual growth of a row must be at least percent compared to the previous value (not total value) @param int $minGrowthPercentNegative The actual growth of a row must be lower percent compared to the previous value (not total value) @param string $orderBy Order by absolute, relative, importance @param int $limitIncreaser @param int $limitDecreaser @return DataTable
[ "@param", "array", "$reportMetadata", "@param", "string", "$period", "@param", "string", "$date", "@param", "string", "$lastDate", "@param", "string", "$metric", "@param", "DataTable", "$currentReport", "@param", "DataTable", "$lastReport", "@param", "int", "$totalValue...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Insights/InsightReport.php#L142-L247
train
Generate Insight Data
[ 30522, 2270, 3853, 9699, 7076, 18743, 1006, 1002, 3189, 11368, 8447, 2696, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 2197, 13701, 1010, 1002, 12046, 1010, 1002, 2783, 2890, 6442, 1010, 1002, 2197, 2890, 6442, 1010, 1002, 2561, 10175, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HasRelationships.php
HasRelationships.morphMany
public function morphMany($related, $name, $type = null, $id = null, $localKey = null) { $instance = $this->newRelatedInstance($related); // Here we will gather up the morph type and ID for the relationship so that we // can properly query the intermediate table of a relation. Finally, we will // get the table and create the relationship instances for the developers. [$type, $id] = $this->getMorphs($name, $type, $id); $table = $instance->getTable(); $localKey = $localKey ?: $this->getKeyName(); return $this->newMorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); }
php
public function morphMany($related, $name, $type = null, $id = null, $localKey = null) { $instance = $this->newRelatedInstance($related); // Here we will gather up the morph type and ID for the relationship so that we // can properly query the intermediate table of a relation. Finally, we will // get the table and create the relationship instances for the developers. [$type, $id] = $this->getMorphs($name, $type, $id); $table = $instance->getTable(); $localKey = $localKey ?: $this->getKeyName(); return $this->newMorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); }
[ "public", "function", "morphMany", "(", "$", "related", ",", "$", "name", ",", "$", "type", "=", "null", ",", "$", "id", "=", "null", ",", "$", "localKey", "=", "null", ")", "{", "$", "instance", "=", "$", "this", "->", "newRelatedInstance", "(", "...
Define a polymorphic one-to-many relationship. @param string $related @param string $name @param string $type @param string $id @param string $localKey @return \Illuminate\Database\Eloquent\Relations\MorphMany
[ "Define", "a", "polymorphic", "one", "-", "to", "-", "many", "relationship", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L405-L419
train
Return a new morphMany relationship
[ 30522, 2270, 3853, 22822, 8458, 2386, 2100, 1006, 1002, 3141, 1010, 1002, 2171, 1010, 1002, 2828, 1027, 19701, 1010, 1002, 8909, 1027, 19701, 1010, 1002, 2334, 14839, 1027, 19701, 1007, 1063, 1002, 6013, 1027, 1002, 2023, 1011, 1028, 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...
matomo-org/matomo
plugins/UsersManager/Controller.php
Controller.initViewAnonymousUserSettings
protected function initViewAnonymousUserSettings($view) { if (!Piwik::hasUserSuperUserAccess()) { return; } $userLogin = 'anonymous'; // Which websites are available to the anonymous users? $anonymousSitesAccess = Request::processRequest('UsersManager.getSitesAccessFromUser', array('userLogin' => $userLogin)); $anonymousSites = array(); $idSites = array(); foreach ($anonymousSitesAccess as $info) { $idSite = $info['site']; $idSites[] = $idSite; $site = Request::processRequest('SitesManager.getSiteFromId', array('idSite' => $idSite)); // Work around manual website deletion if (!empty($site)) { $anonymousSites[] = array('key' => $idSite, 'value' => $site['name']); } } $view->anonymousSites = $anonymousSites; $anonymousDefaultSite = ''; // Which report is displayed by default to the anonymous user? $anonymousDefaultReport = Request::processRequest('UsersManager.getUserPreference', array('userLogin' => $userLogin, 'preferenceName' => APIUsersManager::PREFERENCE_DEFAULT_REPORT)); if ($anonymousDefaultReport === false) { if (empty($anonymousSites)) { $anonymousDefaultReport = Piwik::getLoginPluginName(); } else { // we manually imitate what would happen, in case the anonymous user logs in // and is redirected to the first website available to him in the list // @see getDefaultWebsiteId() $anonymousDefaultReport = '1'; $anonymousDefaultSite = $anonymousSites[0]['key']; } } if (is_numeric($anonymousDefaultReport)) { $anonymousDefaultSite = $anonymousDefaultReport; $anonymousDefaultReport = '1'; // a website is selected, we make sure "Dashboard for a specific site" gets pre-selected } if ((empty($anonymousDefaultSite) || !in_array($anonymousDefaultSite, $idSites)) && !empty($idSites)) { $anonymousDefaultSite = $anonymousSites[0]['key']; } $view->anonymousDefaultReport = $anonymousDefaultReport; $view->anonymousDefaultSite = $anonymousDefaultSite; $view->anonymousDefaultDate = $this->getDefaultDateForUser($userLogin); $view->defaultReportOptions = array( array('key' => 'Login', 'value' => Piwik::translate('UsersManager_TheLoginScreen')), array('key' => 'MultiSites', 'value' => Piwik::translate('General_AllWebsitesDashboard'), 'disabled' => empty($anonymousSites)), array('key' => '1', 'value' => Piwik::translate('General_DashboardForASpecificWebsite')), ); }
php
protected function initViewAnonymousUserSettings($view) { if (!Piwik::hasUserSuperUserAccess()) { return; } $userLogin = 'anonymous'; // Which websites are available to the anonymous users? $anonymousSitesAccess = Request::processRequest('UsersManager.getSitesAccessFromUser', array('userLogin' => $userLogin)); $anonymousSites = array(); $idSites = array(); foreach ($anonymousSitesAccess as $info) { $idSite = $info['site']; $idSites[] = $idSite; $site = Request::processRequest('SitesManager.getSiteFromId', array('idSite' => $idSite)); // Work around manual website deletion if (!empty($site)) { $anonymousSites[] = array('key' => $idSite, 'value' => $site['name']); } } $view->anonymousSites = $anonymousSites; $anonymousDefaultSite = ''; // Which report is displayed by default to the anonymous user? $anonymousDefaultReport = Request::processRequest('UsersManager.getUserPreference', array('userLogin' => $userLogin, 'preferenceName' => APIUsersManager::PREFERENCE_DEFAULT_REPORT)); if ($anonymousDefaultReport === false) { if (empty($anonymousSites)) { $anonymousDefaultReport = Piwik::getLoginPluginName(); } else { // we manually imitate what would happen, in case the anonymous user logs in // and is redirected to the first website available to him in the list // @see getDefaultWebsiteId() $anonymousDefaultReport = '1'; $anonymousDefaultSite = $anonymousSites[0]['key']; } } if (is_numeric($anonymousDefaultReport)) { $anonymousDefaultSite = $anonymousDefaultReport; $anonymousDefaultReport = '1'; // a website is selected, we make sure "Dashboard for a specific site" gets pre-selected } if ((empty($anonymousDefaultSite) || !in_array($anonymousDefaultSite, $idSites)) && !empty($idSites)) { $anonymousDefaultSite = $anonymousSites[0]['key']; } $view->anonymousDefaultReport = $anonymousDefaultReport; $view->anonymousDefaultSite = $anonymousDefaultSite; $view->anonymousDefaultDate = $this->getDefaultDateForUser($userLogin); $view->defaultReportOptions = array( array('key' => 'Login', 'value' => Piwik::translate('UsersManager_TheLoginScreen')), array('key' => 'MultiSites', 'value' => Piwik::translate('General_AllWebsitesDashboard'), 'disabled' => empty($anonymousSites)), array('key' => '1', 'value' => Piwik::translate('General_DashboardForASpecificWebsite')), ); }
[ "protected", "function", "initViewAnonymousUserSettings", "(", "$", "view", ")", "{", "if", "(", "!", "Piwik", "::", "hasUserSuperUserAccess", "(", ")", ")", "{", "return", ";", "}", "$", "userLogin", "=", "'anonymous'", ";", "// Which websites are available to th...
The Super User can modify Anonymous user settings @param View $view
[ "The", "Super", "User", "can", "modify", "Anonymous", "user", "settings" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/Controller.php#L275-L334
train
Initializes the view object with the anonymous user settings
[ 30522, 5123, 3853, 1999, 4183, 8584, 6761, 4890, 27711, 20330, 21678, 8613, 1006, 1002, 3193, 1007, 1063, 2065, 1006, 999, 14255, 9148, 2243, 1024, 1024, 2038, 20330, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1007, 1063, 2709, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataCollector/QueryCollector.php
QueryCollector.collectTransactionEvent
public function collectTransactionEvent($event, $connection) { $source = []; if ($this->findSource) { try { $source = $this->findSource(); } catch (\Exception $e) { } } $this->queries[] = [ 'query' => $event, 'type' => 'transaction', 'bindings' => [], 'time' => 0, 'source' => $source, 'explain' => [], 'connection' => $connection->getDatabaseName(), 'hints' => null, ]; }
php
public function collectTransactionEvent($event, $connection) { $source = []; if ($this->findSource) { try { $source = $this->findSource(); } catch (\Exception $e) { } } $this->queries[] = [ 'query' => $event, 'type' => 'transaction', 'bindings' => [], 'time' => 0, 'source' => $source, 'explain' => [], 'connection' => $connection->getDatabaseName(), 'hints' => null, ]; }
[ "public", "function", "collectTransactionEvent", "(", "$", "event", ",", "$", "connection", ")", "{", "$", "source", "=", "[", "]", ";", "if", "(", "$", "this", "->", "findSource", ")", "{", "try", "{", "$", "source", "=", "$", "this", "->", "findSou...
Collect a database transaction event. @param string $event @param \Illuminate\Database\Connection $connection @return array
[ "Collect", "a", "database", "transaction", "event", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataCollector/QueryCollector.php#L376-L397
train
Collects transaction event data
[ 30522, 2270, 3853, 8145, 6494, 3619, 18908, 3258, 18697, 3372, 1006, 1002, 2724, 1010, 1002, 4434, 1007, 1063, 1002, 3120, 1027, 1031, 1033, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 4858, 8162, 3401, 1007, 1063, 3046, 1063, 1002, 3120, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail.php
Zend_Mail.setHeaderEncoding
public function setHeaderEncoding($encoding) { $allowed = array( Zend_Mime::ENCODING_BASE64, Zend_Mime::ENCODING_QUOTEDPRINTABLE ); if (!in_array($encoding, $allowed)) { /** * @see Zend_Mail_Exception */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception('Invalid encoding "' . $encoding . '"'); } $this->_headerEncoding = $encoding; return $this; }
php
public function setHeaderEncoding($encoding) { $allowed = array( Zend_Mime::ENCODING_BASE64, Zend_Mime::ENCODING_QUOTEDPRINTABLE ); if (!in_array($encoding, $allowed)) { /** * @see Zend_Mail_Exception */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception('Invalid encoding "' . $encoding . '"'); } $this->_headerEncoding = $encoding; return $this; }
[ "public", "function", "setHeaderEncoding", "(", "$", "encoding", ")", "{", "$", "allowed", "=", "array", "(", "Zend_Mime", "::", "ENCODING_BASE64", ",", "Zend_Mime", "::", "ENCODING_QUOTEDPRINTABLE", ")", ";", "if", "(", "!", "in_array", "(", "$", "encoding", ...
Set the encoding of mail headers @param string $encoding Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64 @return Zend_Mail Provides fluent interface
[ "Set", "the", "encoding", "of", "mail", "headers" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L335-L351
train
Set the encoding of the header
[ 30522, 2270, 3853, 6662, 13775, 7869, 15305, 4667, 1006, 1002, 17181, 1007, 1063, 1002, 3039, 1027, 9140, 1006, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 17181, 1035, 2918, 21084, 1010, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 17181, 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...
octobercms/october
modules/system/classes/PluginBase.php
PluginBase.getConfigurationFromYaml
protected function getConfigurationFromYaml($exceptionMessage = null) { if ($this->loadedYamlConfiguration !== false) { return $this->loadedYamlConfiguration; } $reflection = new ReflectionClass(get_class($this)); $yamlFilePath = dirname($reflection->getFileName()).'/plugin.yaml'; if (!file_exists($yamlFilePath)) { if ($exceptionMessage) { throw new SystemException($exceptionMessage); } $this->loadedYamlConfiguration = []; } else { $this->loadedYamlConfiguration = Yaml::parse(file_get_contents($yamlFilePath)); if (!is_array($this->loadedYamlConfiguration)) { throw new SystemException(sprintf('Invalid format of the plugin configuration file: %s. The file should define an array.', $yamlFilePath)); } } return $this->loadedYamlConfiguration; }
php
protected function getConfigurationFromYaml($exceptionMessage = null) { if ($this->loadedYamlConfiguration !== false) { return $this->loadedYamlConfiguration; } $reflection = new ReflectionClass(get_class($this)); $yamlFilePath = dirname($reflection->getFileName()).'/plugin.yaml'; if (!file_exists($yamlFilePath)) { if ($exceptionMessage) { throw new SystemException($exceptionMessage); } $this->loadedYamlConfiguration = []; } else { $this->loadedYamlConfiguration = Yaml::parse(file_get_contents($yamlFilePath)); if (!is_array($this->loadedYamlConfiguration)) { throw new SystemException(sprintf('Invalid format of the plugin configuration file: %s. The file should define an array.', $yamlFilePath)); } } return $this->loadedYamlConfiguration; }
[ "protected", "function", "getConfigurationFromYaml", "(", "$", "exceptionMessage", "=", "null", ")", "{", "if", "(", "$", "this", "->", "loadedYamlConfiguration", "!==", "false", ")", "{", "return", "$", "this", "->", "loadedYamlConfiguration", ";", "}", "$", ...
Read configuration from YAML file @param string|null $exceptionMessage @return array|bool @throws SystemException
[ "Read", "configuration", "from", "YAML", "file" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginBase.php#L278-L302
train
Get the plugin configuration from the YAML file
[ 30522, 5123, 3853, 2131, 8663, 8873, 27390, 3370, 19699, 16940, 3286, 2140, 1006, 1002, 6453, 7834, 3736, 3351, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 8209, 14852, 22499, 2078, 8873, 27390, 3370, 999, 1027, 1027, 6270,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/RouteCompiler.php
RouteCompiler.computeRegexp
private static function computeRegexp(array $tokens, int $index, int $firstOptional): string { $token = $tokens[$index]; if ('text' === $token[0]) { // Text tokens return preg_quote($token[1], self::REGEX_DELIMITER); } else { // Variable tokens if (0 === $index && 0 === $firstOptional) { // When the only token is an optional variable token, the separator is required return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); } else { $regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); if ($index >= $firstOptional) { // Enclose each optional token in a subpattern to make it optional. // "?:" means it is non-capturing, i.e. the portion of the subject string that // matched the optional subpattern is not passed back. $regexp = "(?:$regexp"; $nbTokens = \count($tokens); if ($nbTokens - 1 == $index) { // Close the optional subpatterns $regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0)); } } return $regexp; } } }
php
private static function computeRegexp(array $tokens, int $index, int $firstOptional): string { $token = $tokens[$index]; if ('text' === $token[0]) { // Text tokens return preg_quote($token[1], self::REGEX_DELIMITER); } else { // Variable tokens if (0 === $index && 0 === $firstOptional) { // When the only token is an optional variable token, the separator is required return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); } else { $regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); if ($index >= $firstOptional) { // Enclose each optional token in a subpattern to make it optional. // "?:" means it is non-capturing, i.e. the portion of the subject string that // matched the optional subpattern is not passed back. $regexp = "(?:$regexp"; $nbTokens = \count($tokens); if ($nbTokens - 1 == $index) { // Close the optional subpatterns $regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0)); } } return $regexp; } } }
[ "private", "static", "function", "computeRegexp", "(", "array", "$", "tokens", ",", "int", "$", "index", ",", "int", "$", "firstOptional", ")", ":", "string", "{", "$", "token", "=", "$", "tokens", "[", "$", "index", "]", ";", "if", "(", "'text'", "=...
Computes the regexp used to match a specific token. It can be static text or a subpattern. @param array $tokens The route tokens @param int $index The index of the current token @param int $firstOptional The index of the first optional token @return string The regexp pattern for a single token
[ "Computes", "the", "regexp", "used", "to", "match", "a", "specific", "token", ".", "It", "can", "be", "static", "text", "or", "a", "subpattern", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCompiler.php#L287-L315
train
Compute the regexp for the token at the given index
[ 30522, 2797, 10763, 3853, 3274, 24746, 2595, 2361, 1006, 9140, 1002, 19204, 2015, 1010, 20014, 1002, 5950, 1010, 20014, 1002, 2034, 7361, 3508, 2389, 1007, 1024, 5164, 1063, 1002, 19204, 1027, 1002, 19204, 2015, 1031, 1002, 5950, 1033, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
FileProfilerStorage.purge
public function purge() { $flags = \FilesystemIterator::SKIP_DOTS; $iterator = new \RecursiveDirectoryIterator($this->folder, $flags); $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $file) { if (is_file($file)) { unlink($file); } else { rmdir($file); } } }
php
public function purge() { $flags = \FilesystemIterator::SKIP_DOTS; $iterator = new \RecursiveDirectoryIterator($this->folder, $flags); $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $file) { if (is_file($file)) { unlink($file); } else { rmdir($file); } } }
[ "public", "function", "purge", "(", ")", "{", "$", "flags", "=", "\\", "FilesystemIterator", "::", "SKIP_DOTS", ";", "$", "iterator", "=", "new", "\\", "RecursiveDirectoryIterator", "(", "$", "this", "->", "folder", ",", "$", "flags", ")", ";", "$", "ite...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php#L98-L111
train
Purges all files in the folder
[ 30522, 2270, 3853, 24694, 1006, 1007, 1063, 1002, 9245, 1027, 1032, 6764, 27268, 23238, 14621, 4263, 1024, 1024, 13558, 1035, 14981, 1025, 1002, 2009, 6906, 4263, 1027, 2047, 1032, 28667, 9236, 3512, 4305, 2890, 16761, 10139, 14621, 4263, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule/Callback.php
HTML_QuickForm2_Rule_Callback.mergeConfig
public static function mergeConfig($localConfig, $globalConfig) { if (!isset($globalConfig)) { $config = $localConfig; } else { if (!is_array($globalConfig) || !isset($globalConfig['callback']) && !isset($globalConfig['arguments']) ) { $config = array('callback' => $globalConfig); } else { $config = $globalConfig; } if (is_array($localConfig) && (isset($localConfig['callback']) || isset($localConfig['arguments'])) ) { $config += $localConfig; } elseif(isset($localConfig)) { $config += array('callback' => $localConfig, 'arguments' => $localConfig); } } return $config; }
php
public static function mergeConfig($localConfig, $globalConfig) { if (!isset($globalConfig)) { $config = $localConfig; } else { if (!is_array($globalConfig) || !isset($globalConfig['callback']) && !isset($globalConfig['arguments']) ) { $config = array('callback' => $globalConfig); } else { $config = $globalConfig; } if (is_array($localConfig) && (isset($localConfig['callback']) || isset($localConfig['arguments'])) ) { $config += $localConfig; } elseif(isset($localConfig)) { $config += array('callback' => $localConfig, 'arguments' => $localConfig); } } return $config; }
[ "public", "static", "function", "mergeConfig", "(", "$", "localConfig", ",", "$", "globalConfig", ")", "{", "if", "(", "!", "isset", "(", "$", "globalConfig", ")", ")", "{", "$", "config", "=", "$", "localConfig", ";", "}", "else", "{", "if", "(", "!...
Merges local configuration with that provided for registerRule() "Global" configuration may be passed to {@link HTML_QuickForm2_Factory::registerRule()} in either of the following formats - callback - array(['callback' => callback, ]['arguments' => array(...)]) "Local" configuration may be passed to the constructor in either of the following formats - callback or arguments (interpretation depends on whether the global configuration already contains the callback) - array(['callback' => callback, ]['arguments' => array(...)]) As usual, global config overrides local one. It is a good idea to use the associative array format to prevent ambiguity. @param mixed Local configuration @param mixed Global configuration @return mixed Merged configuration
[ "Merges", "local", "configuration", "with", "that", "provided", "for", "registerRule", "()" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Callback.php#L126-L148
train
Merge local and global config
[ 30522, 2270, 10763, 3853, 13590, 8663, 8873, 2290, 1006, 1002, 2334, 8663, 8873, 2290, 1010, 1002, 3795, 8663, 8873, 2290, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 3795, 8663, 8873, 2290, 1007, 1007, 1063, 1002, 9530, 8873, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule/Each.php
HTML_QuickForm2_Rule_Each.validateOwner
protected function validateOwner() { $rule = clone $this->getConfig(); foreach ($this->owner->getRecursiveIterator(RecursiveIteratorIterator::LEAVES_ONLY) as $child) { $rule->setOwner($child); if (!$rule->validateOwner()) { return false; } } return true; }
php
protected function validateOwner() { $rule = clone $this->getConfig(); foreach ($this->owner->getRecursiveIterator(RecursiveIteratorIterator::LEAVES_ONLY) as $child) { $rule->setOwner($child); if (!$rule->validateOwner()) { return false; } } return true; }
[ "protected", "function", "validateOwner", "(", ")", "{", "$", "rule", "=", "clone", "$", "this", "->", "getConfig", "(", ")", ";", "foreach", "(", "$", "this", "->", "owner", "->", "getRecursiveIterator", "(", "RecursiveIteratorIterator", "::", "LEAVES_ONLY", ...
Validates the owner's children using the template Rule @return bool Whether all children are valid according to a template Rule
[ "Validates", "the", "owner", "s", "children", "using", "the", "template", "Rule" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Each.php#L81-L91
train
Validate owner of this node
[ 30522, 5123, 3853, 9398, 3686, 12384, 2121, 1006, 1007, 1063, 1002, 3627, 1027, 17598, 1002, 2023, 1011, 1028, 2131, 8663, 8873, 2290, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 3954, 1011, 1028, 2131, 2890, 10841, 2869, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.children
public function children($path) { $children = $this->children[(string)$path] ?? []; return new Collection($children, [], $this); }
php
public function children($path) { $children = $this->children[(string)$path] ?? []; return new Collection($children, [], $this); }
[ "public", "function", "children", "(", "$", "path", ")", "{", "$", "children", "=", "$", "this", "->", "children", "[", "(", "string", ")", "$", "path", "]", "??", "[", "]", ";", "return", "new", "Collection", "(", "$", "children", ",", "[", "]", ...
Get children of the path. @param string $path @return Collection
[ "Get", "children", "of", "the", "path", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Pages.php#L404-L409
train
Get children of path
[ 30522, 2270, 3853, 2336, 1006, 1002, 4130, 1007, 1063, 1002, 2336, 1027, 1002, 2023, 1011, 1028, 2336, 1031, 1006, 5164, 1007, 1002, 4130, 1033, 1029, 1029, 1031, 1033, 1025, 2709, 2047, 3074, 1006, 1002, 2336, 1010, 1031, 1033, 1010, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/twig/DebugExtension.php
DebugExtension.getDataCss
protected function getDataCss($variable) { $css = [ 'padding' => '7px', 'background-color' => $this->zebra ? '#D8D9DB' : '#FFF', 'color' => '#405261', ]; $type = gettype($variable); if ($type == 'NULL') { $css['color'] = '#999'; } return $this->arrayToCss($css); }
php
protected function getDataCss($variable) { $css = [ 'padding' => '7px', 'background-color' => $this->zebra ? '#D8D9DB' : '#FFF', 'color' => '#405261', ]; $type = gettype($variable); if ($type == 'NULL') { $css['color'] = '#999'; } return $this->arrayToCss($css); }
[ "protected", "function", "getDataCss", "(", "$", "variable", ")", "{", "$", "css", "=", "[", "'padding'", "=>", "'7px'", ",", "'background-color'", "=>", "$", "this", "->", "zebra", "?", "'#D8D9DB'", ":", "'#FFF'", ",", "'color'", "=>", "'#405261'", ",", ...
Get the CSS string for the output data @param mixed $variable @return string
[ "Get", "the", "CSS", "string", "for", "the", "output", "data" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/DebugExtension.php#L532-L546
train
Get data css
[ 30522, 5123, 3853, 2131, 2850, 2696, 6169, 2015, 1006, 1002, 8023, 1007, 1063, 1002, 20116, 2015, 1027, 1031, 1005, 11687, 4667, 1005, 1027, 1028, 1005, 1021, 2361, 2595, 1005, 1010, 1005, 4281, 1011, 3609, 1005, 1027, 1028, 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...
z-song/laravel-admin
src/Grid.php
Grid.addColumn
protected function addColumn($column = '', $label = '') { $column = new Column($column, $label); $column->setGrid($this); return tap($column, function ($value) { $this->columns->push($value); }); }
php
protected function addColumn($column = '', $label = '') { $column = new Column($column, $label); $column->setGrid($this); return tap($column, function ($value) { $this->columns->push($value); }); }
[ "protected", "function", "addColumn", "(", "$", "column", "=", "''", ",", "$", "label", "=", "''", ")", "{", "$", "column", "=", "new", "Column", "(", "$", "column", ",", "$", "label", ")", ";", "$", "column", "->", "setGrid", "(", "$", "this", "...
Add column to grid. @param string $column @param string $label @return Column
[ "Add", "column", "to", "grid", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L398-L406
train
Add column to grid
[ 30522, 5123, 3853, 5587, 25778, 2819, 2078, 1006, 1002, 5930, 1027, 1005, 1005, 1010, 1002, 3830, 1027, 1005, 1005, 1007, 1063, 1002, 5930, 1027, 2047, 5930, 1006, 1002, 5930, 1010, 1002, 3830, 1007, 1025, 1002, 5930, 1011, 1028, 2275, 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...
octobercms/october
modules/backend/behaviors/RelationController.php
RelationController.findExistingRelationIds
protected function findExistingRelationIds($checkIds = null) { $foreignKeyName = $this->relationModel->getQualifiedKeyName(); $results = $this->relationObject ->getBaseQuery() ->select($foreignKeyName); if ($checkIds !== null && is_array($checkIds) && count($checkIds)) { $results = $results->whereIn($foreignKeyName, $checkIds); } return $results->lists($foreignKeyName); }
php
protected function findExistingRelationIds($checkIds = null) { $foreignKeyName = $this->relationModel->getQualifiedKeyName(); $results = $this->relationObject ->getBaseQuery() ->select($foreignKeyName); if ($checkIds !== null && is_array($checkIds) && count($checkIds)) { $results = $results->whereIn($foreignKeyName, $checkIds); } return $results->lists($foreignKeyName); }
[ "protected", "function", "findExistingRelationIds", "(", "$", "checkIds", "=", "null", ")", "{", "$", "foreignKeyName", "=", "$", "this", "->", "relationModel", "->", "getQualifiedKeyName", "(", ")", ";", "$", "results", "=", "$", "this", "->", "relationObject...
Returns the existing record IDs for the relation.
[ "Returns", "the", "existing", "record", "IDs", "for", "the", "relation", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/RelationController.php#L1354-L1367
train
Find existing relation ids
[ 30522, 5123, 3853, 2424, 10288, 2923, 2075, 16570, 3370, 9821, 1006, 1002, 4638, 9821, 1027, 19701, 1007, 1063, 1002, 3097, 14839, 18442, 1027, 1002, 2023, 1011, 1028, 7189, 5302, 9247, 1011, 1028, 2131, 26426, 7810, 14839, 18442, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/CronArchive.php
CronArchive.findInvalidatedSitesToReprocess
private function findInvalidatedSitesToReprocess() { $this->updateIdSitesInvalidatedOldReports(); if (count($this->idSitesInvalidatedOldReports) > 0) { $ids = ", IDs: " . implode(", ", $this->idSitesInvalidatedOldReports); $this->logger->info("- Will process " . count($this->idSitesInvalidatedOldReports) . " other websites because some old data reports have been invalidated (eg. using the Log Import script or the InvalidateReports plugin) " . $ids); } return $this->idSitesInvalidatedOldReports; }
php
private function findInvalidatedSitesToReprocess() { $this->updateIdSitesInvalidatedOldReports(); if (count($this->idSitesInvalidatedOldReports) > 0) { $ids = ", IDs: " . implode(", ", $this->idSitesInvalidatedOldReports); $this->logger->info("- Will process " . count($this->idSitesInvalidatedOldReports) . " other websites because some old data reports have been invalidated (eg. using the Log Import script or the InvalidateReports plugin) " . $ids); } return $this->idSitesInvalidatedOldReports; }
[ "private", "function", "findInvalidatedSitesToReprocess", "(", ")", "{", "$", "this", "->", "updateIdSitesInvalidatedOldReports", "(", ")", ";", "if", "(", "count", "(", "$", "this", "->", "idSitesInvalidatedOldReports", ")", ">", "0", ")", "{", "$", "ids", "=...
Return All websites that had reports in the past which were invalidated recently (see API CoreAdminHome.invalidateArchivedReports) eg. when using Python log import script @return array
[ "Return", "All", "websites", "that", "had", "reports", "in", "the", "past", "which", "were", "invalidated", "recently", "(", "see", "API", "CoreAdminHome", ".", "invalidateArchivedReports", ")", "eg", ".", "when", "using", "Python", "log", "import", "script" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive.php#L1252-L1264
train
Find invalid websites to reprocess
[ 30522, 2797, 3853, 2424, 2378, 10175, 8524, 3064, 28032, 4355, 5686, 21572, 9623, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 10651, 9821, 7616, 2378, 10175, 8524, 3064, 11614, 2890, 25378, 1006, 1007, 1025, 2065, 1006, 4175, 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/Form/Console/Descriptor/Descriptor.php
Descriptor.describe
public function describe(OutputInterface $output, $object, array $options = []) { $this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output); switch (true) { case null === $object: $this->describeDefaults($options); break; case $object instanceof ResolvedFormTypeInterface: $this->describeResolvedFormType($object, $options); break; case $object instanceof OptionsResolver: $this->describeOption($object, $options); break; default: throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object))); } }
php
public function describe(OutputInterface $output, $object, array $options = []) { $this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output); switch (true) { case null === $object: $this->describeDefaults($options); break; case $object instanceof ResolvedFormTypeInterface: $this->describeResolvedFormType($object, $options); break; case $object instanceof OptionsResolver: $this->describeOption($object, $options); break; default: throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object))); } }
[ "public", "function", "describe", "(", "OutputInterface", "$", "output", ",", "$", "object", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "output", "=", "$", "output", "instanceof", "OutputStyle", "?", "$", "output", ":", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Console/Descriptor/Descriptor.php#L46-L63
train
Describes the given object.
[ 30522, 2270, 3853, 6235, 1006, 6434, 18447, 2121, 12172, 1002, 6434, 1010, 1002, 4874, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 6434, 1027, 1002, 6434, 6013, 11253, 27852, 27983, 1029, 1002, 6434, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Kernel.php
Kernel.getBundle
public function getBundle($name) { if (!isset($this->bundles[$name])) { $class = \get_class($this); $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, $class)); } return $this->bundles[$name]; }
php
public function getBundle($name) { if (!isset($this->bundles[$name])) { $class = \get_class($this); $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, $class)); } return $this->bundles[$name]; }
[ "public", "function", "getBundle", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "bundles", "[", "$", "name", "]", ")", ")", "{", "$", "class", "=", "\\", "get_class", "(", "$", "this", ")", ";", "$", "class", "="...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L225-L235
train
Get bundle by name
[ 30522, 2270, 3853, 2131, 27265, 2571, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 26825, 1031, 1002, 2171, 1033, 1007, 1007, 1063, 1002, 2465, 1027, 1032, 2131, 1035, 2465, 1006, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
ConsumeMessagesCommand.interact
protected function interact(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); if ($this->receiverNames && 0 === \count($input->getArgument('receivers'))) { $io->block('Which transports/receivers do you want to consume?', null, 'fg=white;bg=blue', ' ', true); $io->writeln('Choose which receivers you want to consume messages from in order of priority.'); if (\count($this->receiverNames) > 1) { $io->writeln(sprintf('Hint: to consume from multiple, use a list of their names, e.g. <comment>%s</comment>', implode(', ', $this->receiverNames))); } $question = new ChoiceQuestion('Select receivers to consume:', $this->receiverNames, 0); $question->setMultiselect(true); $input->setArgument('receivers', $io->askQuestion($question)); } if (0 === \count($input->getArgument('receivers'))) { throw new RuntimeException('Please pass at least one receiver.'); } }
php
protected function interact(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); if ($this->receiverNames && 0 === \count($input->getArgument('receivers'))) { $io->block('Which transports/receivers do you want to consume?', null, 'fg=white;bg=blue', ' ', true); $io->writeln('Choose which receivers you want to consume messages from in order of priority.'); if (\count($this->receiverNames) > 1) { $io->writeln(sprintf('Hint: to consume from multiple, use a list of their names, e.g. <comment>%s</comment>', implode(', ', $this->receiverNames))); } $question = new ChoiceQuestion('Select receivers to consume:', $this->receiverNames, 0); $question->setMultiselect(true); $input->setArgument('receivers', $io->askQuestion($question)); } if (0 === \count($input->getArgument('receivers'))) { throw new RuntimeException('Please pass at least one receiver.'); } }
[ "protected", "function", "interact", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", "instanceof", "ConsoleOutputInterface", "?", "$", "output",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php#L126-L147
train
Interacts with the user to select which transports to consume messages from
[ 30522, 5123, 3853, 11835, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 22834, 1027, 2047, 25353, 2213, 14876, 4890, 21756, 2571, 1006, 1002, 7953, 1010, 1002, 6434, 6013, 11253, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
JsonDescriptor.describeContainerServices
protected function describeContainerServices(ContainerBuilder $builder, array $options = []) { $serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds(); $showHidden = isset($options['show_hidden']) && $options['show_hidden']; $omitTags = isset($options['omit_tags']) && $options['omit_tags']; $showArguments = isset($options['show_arguments']) && $options['show_arguments']; $data = ['definitions' => [], 'aliases' => [], 'services' => []]; if (isset($options['filter'])) { $serviceIds = array_filter($serviceIds, $options['filter']); } foreach ($this->sortServiceIds($serviceIds) as $serviceId) { $service = $this->resolveServiceDefinition($builder, $serviceId); if ($showHidden xor '.' === ($serviceId[0] ?? null)) { continue; } if ($service instanceof Alias) { $data['aliases'][$serviceId] = $this->getContainerAliasData($service); } elseif ($service instanceof Definition) { $data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments); } else { $data['services'][$serviceId] = \get_class($service); } } $this->writeData($data, $options); }
php
protected function describeContainerServices(ContainerBuilder $builder, array $options = []) { $serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds(); $showHidden = isset($options['show_hidden']) && $options['show_hidden']; $omitTags = isset($options['omit_tags']) && $options['omit_tags']; $showArguments = isset($options['show_arguments']) && $options['show_arguments']; $data = ['definitions' => [], 'aliases' => [], 'services' => []]; if (isset($options['filter'])) { $serviceIds = array_filter($serviceIds, $options['filter']); } foreach ($this->sortServiceIds($serviceIds) as $serviceId) { $service = $this->resolveServiceDefinition($builder, $serviceId); if ($showHidden xor '.' === ($serviceId[0] ?? null)) { continue; } if ($service instanceof Alias) { $data['aliases'][$serviceId] = $this->getContainerAliasData($service); } elseif ($service instanceof Definition) { $data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments); } else { $data['services'][$serviceId] = \get_class($service); } } $this->writeData($data, $options); }
[ "protected", "function", "describeContainerServices", "(", "ContainerBuilder", "$", "builder", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "serviceIds", "=", "isset", "(", "$", "options", "[", "'tag'", "]", ")", "&&", "$", "options", "[", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php#L101-L130
train
Describes the container services
[ 30522, 5123, 3853, 6235, 8663, 18249, 2545, 2121, 7903, 2229, 1006, 11661, 8569, 23891, 2099, 1002, 12508, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2326, 9821, 1027, 26354, 3388, 1006, 1002, 7047, 1031, 1005, 6415, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Console/Scheduling/ManagesFrequencies.php
ManagesFrequencies.inTimeInterval
private function inTimeInterval($startTime, $endTime) { return function () use ($startTime, $endTime) { return Carbon::now($this->timezone)->between( Carbon::parse($startTime, $this->timezone), Carbon::parse($endTime, $this->timezone), true ); }; }
php
private function inTimeInterval($startTime, $endTime) { return function () use ($startTime, $endTime) { return Carbon::now($this->timezone)->between( Carbon::parse($startTime, $this->timezone), Carbon::parse($endTime, $this->timezone), true ); }; }
[ "private", "function", "inTimeInterval", "(", "$", "startTime", ",", "$", "endTime", ")", "{", "return", "function", "(", ")", "use", "(", "$", "startTime", ",", "$", "endTime", ")", "{", "return", "Carbon", "::", "now", "(", "$", "this", "->", "timezo...
Schedule the event to run between start and end time. @param string $startTime @param string $endTime @return \Closure
[ "Schedule", "the", "event", "to", "run", "between", "start", "and", "end", "time", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php#L53-L62
train
Returns a closure that will check if the time interval is between the start and end time
[ 30522, 2797, 3853, 20014, 14428, 18447, 2121, 10175, 1006, 1002, 2707, 7292, 1010, 1002, 2203, 7292, 1007, 1063, 2709, 3853, 1006, 1007, 2224, 1006, 1002, 2707, 7292, 1010, 1002, 2203, 7292, 1007, 1063, 2709, 6351, 1024, 1024, 2085, 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
core/CronArchive.php
CronArchive.end
public function end() { /** * This event is triggered after archiving. * * @param CronArchive $this */ Piwik::postEvent('CronArchive.end', array($this)); if (empty($this->errors)) { // No error -> Logs the successful script execution until completion Option::set(self::OPTION_ARCHIVING_FINISHED_TS, time()); return; } $this->logSection("SUMMARY OF ERRORS"); foreach ($this->errors as $error) { // do not logError since errors are already in stderr $this->logger->info("Error: " . $error); } $summary = count($this->errors) . " total errors during this script execution, please investigate and try and fix these errors."; $this->logFatalError($summary); }
php
public function end() { /** * This event is triggered after archiving. * * @param CronArchive $this */ Piwik::postEvent('CronArchive.end', array($this)); if (empty($this->errors)) { // No error -> Logs the successful script execution until completion Option::set(self::OPTION_ARCHIVING_FINISHED_TS, time()); return; } $this->logSection("SUMMARY OF ERRORS"); foreach ($this->errors as $error) { // do not logError since errors are already in stderr $this->logger->info("Error: " . $error); } $summary = count($this->errors) . " total errors during this script execution, please investigate and try and fix these errors."; $this->logFatalError($summary); }
[ "public", "function", "end", "(", ")", "{", "/**\n * This event is triggered after archiving.\n *\n * @param CronArchive $this\n */", "Piwik", "::", "postEvent", "(", "'CronArchive.end'", ",", "array", "(", "$", "this", ")", ")", ";", "if", "...
End of the script
[ "End", "of", "the", "script" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive.php#L548-L571
train
End archiving the script
[ 30522, 2270, 3853, 2203, 1006, 1007, 1063, 1013, 1008, 1008, 1008, 2023, 2724, 2003, 13330, 2044, 7905, 14966, 1012, 1008, 1008, 1030, 11498, 2213, 13675, 7856, 11140, 3512, 1002, 2023, 1008, 1013, 14255, 9148, 2243, 1024, 1024, 2695, 18697...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php
DateTimeNormalizer.formatDateTimeErrors
private function formatDateTimeErrors(array $errors) { $formattedErrors = []; foreach ($errors as $pos => $message) { $formattedErrors[] = sprintf('at position %d: %s', $pos, $message); } return $formattedErrors; }
php
private function formatDateTimeErrors(array $errors) { $formattedErrors = []; foreach ($errors as $pos => $message) { $formattedErrors[] = sprintf('at position %d: %s', $pos, $message); } return $formattedErrors; }
[ "private", "function", "formatDateTimeErrors", "(", "array", "$", "errors", ")", "{", "$", "formattedErrors", "=", "[", "]", ";", "foreach", "(", "$", "errors", "as", "$", "pos", "=>", "$", "message", ")", "{", "$", "formattedErrors", "[", "]", "=", "s...
Formats datetime errors. @return string[]
[ "Formats", "datetime", "errors", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php#L146-L155
train
Formats DateTime errors
[ 30522, 2797, 3853, 4289, 13701, 7292, 2121, 29165, 2015, 1006, 9140, 1002, 10697, 1007, 1063, 1002, 4289, 3064, 2121, 29165, 2015, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 10697, 2004, 1002, 13433, 2015, 1027, 1028, 1002, 4471, 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/View/Factory.php
Factory.renderEach
public function renderEach($view, $data, $iterator, $empty = 'raw|') { $result = ''; // If is actually data in the array, we will loop through the data and append // an instance of the partial view to the final result HTML passing in the // iterated value of this data array, allowing the views to access them. if (count($data) > 0) { foreach ($data as $key => $value) { $result .= $this->make( $view, ['key' => $key, $iterator => $value] )->render(); } } // If there is no data in the array, we will render the contents of the empty // view. Alternatively, the "empty view" could be a raw string that begins // with "raw|" for convenience and to let this know that it is a string. else { $result = Str::startsWith($empty, 'raw|') ? substr($empty, 4) : $this->make($empty)->render(); } return $result; }
php
public function renderEach($view, $data, $iterator, $empty = 'raw|') { $result = ''; // If is actually data in the array, we will loop through the data and append // an instance of the partial view to the final result HTML passing in the // iterated value of this data array, allowing the views to access them. if (count($data) > 0) { foreach ($data as $key => $value) { $result .= $this->make( $view, ['key' => $key, $iterator => $value] )->render(); } } // If there is no data in the array, we will render the contents of the empty // view. Alternatively, the "empty view" could be a raw string that begins // with "raw|" for convenience and to let this know that it is a string. else { $result = Str::startsWith($empty, 'raw|') ? substr($empty, 4) : $this->make($empty)->render(); } return $result; }
[ "public", "function", "renderEach", "(", "$", "view", ",", "$", "data", ",", "$", "iterator", ",", "$", "empty", "=", "'raw|'", ")", "{", "$", "result", "=", "''", ";", "// If is actually data in the array, we will loop through the data and append", "// an instance ...
Get the rendered contents of a partial from a loop. @param string $view @param array $data @param string $iterator @param string $empty @return string
[ "Get", "the", "rendered", "contents", "of", "a", "partial", "from", "a", "loop", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Factory.php#L193-L218
train
Render each partial view
[ 30522, 2270, 3853, 17552, 5243, 2818, 1006, 1002, 3193, 1010, 1002, 2951, 1010, 1002, 2009, 6906, 4263, 1010, 1002, 4064, 1027, 1005, 6315, 1064, 1005, 1007, 1063, 1002, 2765, 1027, 1005, 1005, 1025, 1013, 1013, 2065, 2003, 2941, 2951, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Console/Cli/CleanCommand.php
CleanCommand.setupConsole
public function setupConsole(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; $this->output->getFormatter()->setStyle('normal', new OutputFormatterStyle('white')); $this->output->getFormatter()->setStyle('yellow', new OutputFormatterStyle('yellow', null, ['bold'])); $this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, ['bold'])); $this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan', null, ['bold'])); $this->output->getFormatter()->setStyle('green', new OutputFormatterStyle('green', null, ['bold'])); $this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta', null, ['bold'])); $this->output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, ['bold'])); }
php
public function setupConsole(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; $this->output->getFormatter()->setStyle('normal', new OutputFormatterStyle('white')); $this->output->getFormatter()->setStyle('yellow', new OutputFormatterStyle('yellow', null, ['bold'])); $this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, ['bold'])); $this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan', null, ['bold'])); $this->output->getFormatter()->setStyle('green', new OutputFormatterStyle('green', null, ['bold'])); $this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta', null, ['bold'])); $this->output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, ['bold'])); }
[ "public", "function", "setupConsole", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "input", "=", "$", "input", ";", "$", "this", "->", "output", "=", "$", "output", ";", "$", "this", "->", "ou...
Set colors style definition for the formatter. @param InputInterface $input @param OutputInterface $output
[ "Set", "colors", "style", "definition", "for", "the", "formatter", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Cli/CleanCommand.php#L309-L321
train
Setup Console.
[ 30522, 2270, 3853, 16437, 8663, 19454, 2063, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 2023, 1011, 1028, 7953, 1027, 1002, 7953, 1025, 1002, 30524, 2047, 6434, 14192, 20097, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
AnnotationClassLoader.getDefaultRouteName
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) { $name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name); if ($this->defaultRouteIndex > 0) { $name .= '_'.$this->defaultRouteIndex; } ++$this->defaultRouteIndex; return $name; }
php
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) { $name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name); if ($this->defaultRouteIndex > 0) { $name .= '_'.$this->defaultRouteIndex; } ++$this->defaultRouteIndex; return $name; }
[ "protected", "function", "getDefaultRouteName", "(", "\\", "ReflectionClass", "$", "class", ",", "\\", "ReflectionMethod", "$", "method", ")", "{", "$", "name", "=", "strtolower", "(", "str_replace", "(", "'\\\\'", ",", "'_'", ",", "$", "class", "->", "name"...
Gets the default route name for a class method. @param \ReflectionClass $class @param \ReflectionMethod $method @return string
[ "Gets", "the", "default", "route", "name", "for", "a", "class", "method", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php#L249-L258
train
Get default route name
[ 30522, 5123, 3853, 2131, 3207, 7011, 11314, 22494, 6528, 14074, 1006, 1032, 9185, 26266, 1002, 2465, 1010, 1032, 9185, 11368, 6806, 2094, 1002, 4118, 1007, 1063, 1002, 2171, 1027, 2358, 5339, 12898, 13777, 1006, 2358, 2099, 1035, 5672, 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
core/ViewDataTable/Request.php
Request.getDefaultOrCurrent
protected function getDefaultOrCurrent($nameVar) { if (isset($_GET[$nameVar])) { return Common::sanitizeInputValue($_GET[$nameVar]); } return $this->getDefault($nameVar); }
php
protected function getDefaultOrCurrent($nameVar) { if (isset($_GET[$nameVar])) { return Common::sanitizeInputValue($_GET[$nameVar]); } return $this->getDefault($nameVar); }
[ "protected", "function", "getDefaultOrCurrent", "(", "$", "nameVar", ")", "{", "if", "(", "isset", "(", "$", "_GET", "[", "$", "nameVar", "]", ")", ")", "{", "return", "Common", "::", "sanitizeInputValue", "(", "$", "_GET", "[", "$", "nameVar", "]", ")...
Returns, for a given parameter, the value of this parameter in the REQUEST array. If not set, returns the default value for this parameter @see getDefault() @param string $nameVar @return string|mixed Value of this parameter
[ "Returns", "for", "a", "given", "parameter", "the", "value", "of", "this", "parameter", "in", "the", "REQUEST", "array", ".", "If", "not", "set", "returns", "the", "default", "value", "for", "this", "parameter", "@see", "getDefault", "()" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Request.php#L123-L130
train
Returns the default value or the current value if it is set
[ 30522, 5123, 3853, 2131, 3207, 7011, 11314, 2953, 10841, 14343, 3372, 1006, 1002, 2171, 10755, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 1035, 2131, 1031, 1002, 2171, 10755, 1033, 1007, 1007, 1063, 2709, 2691, 1024, 1024, 2624, 25090...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/AttributeTranslator.php
AttributeTranslator._set_table_rules
static protected function _set_table_rules(\DOMElement $node, $value) { $new_style = "; border-collapse: collapse;"; switch ($value) { case "none": $new_style .= "border-style: none;"; break; case "groups": // FIXME: unsupported return null; case "rows": $new_style .= "border-style: solid none solid none; border-width: 1px; "; break; case "cols": $new_style .= "border-style: none solid none solid; border-width: 1px; "; break; case "all": $new_style .= "border-style: solid; border-width: 1px; "; break; default: // Invalid value return null; } $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { $style = $cell->getAttribute(self::$_style_attr); $style .= $new_style; $cell->setAttribute(self::$_style_attr, $style); } $style = rtrim($node->getAttribute(self::$_style_attr), ";"); $style .= "; border-collapse: collapse; "; return ltrim($style, "; "); }
php
static protected function _set_table_rules(\DOMElement $node, $value) { $new_style = "; border-collapse: collapse;"; switch ($value) { case "none": $new_style .= "border-style: none;"; break; case "groups": // FIXME: unsupported return null; case "rows": $new_style .= "border-style: solid none solid none; border-width: 1px; "; break; case "cols": $new_style .= "border-style: none solid none solid; border-width: 1px; "; break; case "all": $new_style .= "border-style: solid; border-width: 1px; "; break; default: // Invalid value return null; } $cell_list = self::get_cell_list($node); foreach ($cell_list as $cell) { $style = $cell->getAttribute(self::$_style_attr); $style .= $new_style; $cell->setAttribute(self::$_style_attr, $style); } $style = rtrim($node->getAttribute(self::$_style_attr), ";"); $style .= "; border-collapse: collapse; "; return ltrim($style, "; "); }
[ "static", "protected", "function", "_set_table_rules", "(", "\\", "DOMElement", "$", "node", ",", "$", "value", ")", "{", "$", "new_style", "=", "\"; border-collapse: collapse;\"", ";", "switch", "(", "$", "value", ")", "{", "case", "\"none\"", ":", "$", "ne...
@param \DOMElement $node @param string $value @return null|string
[ "@param", "\\", "DOMElement", "$node", "@param", "string", "$value" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/AttributeTranslator.php#L420-L462
train
Set table rules
[ 30522, 10763, 5123, 3853, 1035, 2275, 1035, 2795, 1035, 3513, 1006, 1032, 8514, 16930, 4765, 1002, 13045, 1010, 1002, 3643, 1007, 1063, 1002, 2047, 1035, 2806, 1027, 1000, 1025, 3675, 1011, 7859, 1024, 7859, 1025, 1000, 1025, 6942, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/PhpEngine.php
PhpEngine.set
public function set(HelperInterface $helper, $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { $this->helpers[$alias] = $helper; } $helper->setCharset($this->charset); }
php
public function set(HelperInterface $helper, $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { $this->helpers[$alias] = $helper; } $helper->setCharset($this->charset); }
[ "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/Templating/PhpEngine.php#L248-L256
train
Set a helper
[ 30522, 2270, 3853, 2275, 1006, 2393, 23282, 3334, 12172, 1002, 2393, 2121, 1010, 1002, 14593, 1027, 19701, 30524, 1027, 1002, 2393, 2121, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 14593, 1007, 1063, 1002, 2023, 1011, 1028, 2393, 2545,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/JsonResponse.php
JsonResponse.setCallback
public function setCallback($callback = null) { if (null !== $callback) { // partially taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ // partially taken from https://github.com/willdurand/JsonpCallbackValidator // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details. // (c) William Durand <william.durand1@gmail.com> $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u'; $reserved = [ 'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while', 'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export', 'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false', ]; $parts = explode('.', $callback); foreach ($parts as $part) { if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) { throw new \InvalidArgumentException('The callback name is not valid.'); } } } $this->callback = $callback; return $this->update(); }
php
public function setCallback($callback = null) { if (null !== $callback) { // partially taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ // partially taken from https://github.com/willdurand/JsonpCallbackValidator // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details. // (c) William Durand <william.durand1@gmail.com> $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u'; $reserved = [ 'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while', 'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export', 'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false', ]; $parts = explode('.', $callback); foreach ($parts as $part) { if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) { throw new \InvalidArgumentException('The callback name is not valid.'); } } } $this->callback = $callback; return $this->update(); }
[ "public", "function", "setCallback", "(", "$", "callback", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "callback", ")", "{", "// partially taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/", "// partially taken from https://github.com/willdur...
Sets the JSONP callback. @param string|null $callback The JSONP callback or null to use none @return $this @throws \InvalidArgumentException When the callback name is not valid
[ "Sets", "the", "JSONP", "callback", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/JsonResponse.php#L89-L113
train
Set the callback name
[ 30522, 2270, 3853, 2275, 9289, 20850, 8684, 1006, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2655, 5963, 1007, 1063, 1013, 1013, 6822, 2579, 2013, 30524, 1012, 29294, 23732, 1012, 5658, 1013, 2249, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/PolicyMakeCommand.php
PolicyMakeCommand.buildClass
protected function buildClass($name) { $stub = $this->replaceUserNamespace( parent::buildClass($name) ); $model = $this->option('model'); return $model ? $this->replaceModel($stub, $model) : $stub; }
php
protected function buildClass($name) { $stub = $this->replaceUserNamespace( parent::buildClass($name) ); $model = $this->option('model'); return $model ? $this->replaceModel($stub, $model) : $stub; }
[ "protected", "function", "buildClass", "(", "$", "name", ")", "{", "$", "stub", "=", "$", "this", "->", "replaceUserNamespace", "(", "parent", "::", "buildClass", "(", "$", "name", ")", ")", ";", "$", "model", "=", "$", "this", "->", "option", "(", "...
Build the class with the given name. @param string $name @return string
[ "Build", "the", "class", "with", "the", "given", "name", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/PolicyMakeCommand.php#L38-L47
train
Build the class with the user namespace and the model
[ 30522, 5123, 3853, 3857, 26266, 1006, 1002, 2171, 1007, 1063, 1002, 24646, 2497, 1027, 1002, 2023, 1011, 1028, 5672, 20330, 18442, 23058, 1006, 6687, 1024, 1024, 3857, 26266, 1006, 1002, 2171, 1007, 1007, 1025, 1002, 2944, 1027, 1002, 2023,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider.php
LocationProvider.getAllProviders
public static function getAllProviders() { if (is_null(self::$providers)) { self::$providers = array(); $plugins = PluginManager::getInstance()->getPluginsLoadedAndActivated(); foreach ($plugins as $plugin) { foreach (self::getLocationProviders($plugin) as $instance) { self::$providers[] = $instance; } } } return self::$providers; }
php
public static function getAllProviders() { if (is_null(self::$providers)) { self::$providers = array(); $plugins = PluginManager::getInstance()->getPluginsLoadedAndActivated(); foreach ($plugins as $plugin) { foreach (self::getLocationProviders($plugin) as $instance) { self::$providers[] = $instance; } } } return self::$providers; }
[ "public", "static", "function", "getAllProviders", "(", ")", "{", "if", "(", "is_null", "(", "self", "::", "$", "providers", ")", ")", "{", "self", "::", "$", "providers", "=", "array", "(", ")", ";", "$", "plugins", "=", "PluginManager", "::", "getIns...
Returns every available provider instance. @return LocationProvider[]
[ "Returns", "every", "available", "provider", "instance", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider.php#L166-L179
train
Get all location providers
[ 30522, 2270, 10763, 3853, 2131, 8095, 21572, 17258, 2545, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 2969, 1024, 1024, 1002, 11670, 1007, 1007, 1063, 2969, 1024, 1024, 1002, 11670, 1027, 9140, 1006, 1007, 1025, 1002, 13354, 7076...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/IgnoreCookie.php
IgnoreCookie.getTrackingCookie
private static function getTrackingCookie() { $cookie_name = @Config::getInstance()->Tracker['cookie_name']; $cookie_path = @Config::getInstance()->Tracker['cookie_path']; return new Cookie($cookie_name, null, $cookie_path); }
php
private static function getTrackingCookie() { $cookie_name = @Config::getInstance()->Tracker['cookie_name']; $cookie_path = @Config::getInstance()->Tracker['cookie_path']; return new Cookie($cookie_name, null, $cookie_path); }
[ "private", "static", "function", "getTrackingCookie", "(", ")", "{", "$", "cookie_name", "=", "@", "Config", "::", "getInstance", "(", ")", "->", "Tracker", "[", "'cookie_name'", "]", ";", "$", "cookie_path", "=", "@", "Config", "::", "getInstance", "(", "...
Get tracking cookie @return Cookie
[ "Get", "tracking", "cookie" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/IgnoreCookie.php#L25-L31
train
Get tracking cookie
[ 30522, 2797, 10763, 3853, 2131, 6494, 23177, 30524, 1006, 1007, 1011, 1028, 27080, 1031, 1005, 17387, 1035, 4130, 1005, 1033, 1025, 2709, 2047, 17387, 1006, 1002, 17387, 1035, 2171, 1010, 19701, 1010, 1002, 17387, 1035, 4130, 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...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
HasRelationships.newHasManyThrough
protected function newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) { return new HasManyThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); }
php
protected function newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) { return new HasManyThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); }
[ "protected", "function", "newHasManyThrough", "(", "Builder", "$", "query", ",", "Model", "$", "farParent", ",", "Model", "$", "throughParent", ",", "$", "firstKey", ",", "$", "secondKey", ",", "$", "localKey", ",", "$", "secondLocalKey", ")", "{", "return",...
Instantiate a new HasManyThrough relationship. @param \Illuminate\Database\Eloquent\Builder $query @param \Illuminate\Database\Eloquent\Model $farParent @param \Illuminate\Database\Eloquent\Model $throughParent @param string $firstKey @param string $secondKey @param string $localKey @param string $secondLocalKey @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
[ "Instantiate", "a", "new", "HasManyThrough", "relationship", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L390-L393
train
Creates a HasManyThrough object
[ 30522, 5123, 3853, 2047, 14949, 2386, 22123, 8093, 10593, 1006, 12508, 1002, 23032, 1010, 2944, 1002, 2521, 19362, 4765, 1010, 2944, 1002, 2083, 19362, 4765, 1010, 1002, 2034, 14839, 1010, 1002, 2117, 14839, 1010, 1002, 2334, 14839, 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...
matomo-org/matomo
libs/HTML/QuickForm2/Element.php
HTML_QuickForm2_Element.getPersistentContent
protected function getPersistentContent() { if (!$this->persistent || null === ($value = $this->getValue())) { return ''; } return '<input type="hidden"' . self::getAttributesString(array( 'name' => $this->getName(), 'value' => $value, 'id' => $this->getId() )) . ' />'; }
php
protected function getPersistentContent() { if (!$this->persistent || null === ($value = $this->getValue())) { return ''; } return '<input type="hidden"' . self::getAttributesString(array( 'name' => $this->getName(), 'value' => $value, 'id' => $this->getId() )) . ' />'; }
[ "protected", "function", "getPersistentContent", "(", ")", "{", "if", "(", "!", "$", "this", "->", "persistent", "||", "null", "===", "(", "$", "value", "=", "$", "this", "->", "getValue", "(", ")", ")", ")", "{", "return", "''", ";", "}", "return", ...
Generates hidden form field containing the element's value This is used to pass the frozen element's value if 'persistent freeze' feature is on @return string
[ "Generates", "hidden", "form", "field", "containing", "the", "element", "s", "value" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element.php#L77-L87
train
Get persistent content
[ 30522, 5123, 3853, 2131, 7347, 27870, 3372, 8663, 6528, 2102, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 14516, 1064, 1064, 19701, 1027, 1027, 1027, 1006, 1002, 3643, 1027, 1002, 2023, 1011, 1028, 2131, 10175, 5657, 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...
opencart/opencart
upload/system/engine/loader.php
Loader.helper
public function helper($route) { $file = DIR_SYSTEM . 'helper/' . preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route) . '.php'; if (is_file($file)) { include_once($file); } else { throw new \Exception('Error: Could not load helper ' . $route . '!'); } }
php
public function helper($route) { $file = DIR_SYSTEM . 'helper/' . preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route) . '.php'; if (is_file($file)) { include_once($file); } else { throw new \Exception('Error: Could not load helper ' . $route . '!'); } }
[ "public", "function", "helper", "(", "$", "route", ")", "{", "$", "file", "=", "DIR_SYSTEM", ".", "'helper/'", ".", "preg_replace", "(", "'/[^a-zA-Z0-9_\\/]/'", ",", "''", ",", "(", "string", ")", "$", "route", ")", ".", "'.php'", ";", "if", "(", "is_f...
Helper @param string $route
[ "Helper" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/system/engine/loader.php#L169-L177
train
Load the helper file
[ 30522, 2270, 3853, 2393, 2121, 1006, 1002, 2799, 1007, 1063, 1002, 5371, 1027, 16101, 1035, 2291, 1012, 1005, 2393, 2121, 1013, 1005, 1012, 3653, 2290, 1035, 5672, 1006, 1005, 1013, 1031, 1034, 1037, 1011, 23564, 1011, 1062, 2692, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Route.php
Route.setCondition
public function setCondition($condition) { $this->condition = (string) $condition; $this->compiled = null; return $this; }
php
public function setCondition($condition) { $this->condition = (string) $condition; $this->compiled = null; return $this; }
[ "public", "function", "setCondition", "(", "$", "condition", ")", "{", "$", "this", "->", "condition", "=", "(", "string", ")", "$", "condition", ";", "$", "this", "->", "compiled", "=", "null", ";", "return", "$", "this", ";", "}" ]
Sets the condition. This method implements a fluent interface. @param string $condition The condition @return $this
[ "Sets", "the", "condition", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Route.php#L531-L537
train
Set the condition for this page
[ 30522, 2270, 3853, 2275, 8663, 20562, 1006, 1002, 4650, 1007, 1063, 1002, 2023, 1011, 1028, 4650, 1027, 1006, 5164, 1007, 1002, 4650, 1025, 1002, 2023, 1011, 1028, 9227, 1027, 19701, 1025, 2709, 1002, 2023, 1025, 1065, 102, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Request.php
Request.getBaseUrl
public function getBaseUrl() { if (null === $this->baseUrl) { $this->baseUrl = $this->prepareBaseUrl(); } return $this->baseUrl; }
php
public function getBaseUrl() { if (null === $this->baseUrl) { $this->baseUrl = $this->prepareBaseUrl(); } return $this->baseUrl; }
[ "public", "function", "getBaseUrl", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "baseUrl", ")", "{", "$", "this", "->", "baseUrl", "=", "$", "this", "->", "prepareBaseUrl", "(", ")", ";", "}", "return", "$", "this", "->", "baseUrl", ...
Returns the root URL from which this request is executed. The base URL never ends with a /. This is similar to getBasePath(), except that it also includes the script filename (e.g. index.php) if one exists. @return string The raw URL (i.e. not urldecoded)
[ "Returns", "the", "root", "URL", "from", "which", "this", "request", "is", "executed", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L871-L878
train
Get Base Url
[ 30522, 2270, 3853, 2131, 15058, 3126, 2140, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 2918, 3126, 2140, 1007, 1063, 1002, 2023, 1011, 1028, 2918, 3126, 2140, 1027, 1002, 2023, 1011, 1028, 7374, 15058, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php
SendEmailVerificationNotification.handle
public function handle(Registered $event) { if ($event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { $event->user->sendEmailVerificationNotification(); } }
php
public function handle(Registered $event) { if ($event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { $event->user->sendEmailVerificationNotification(); } }
[ "public", "function", "handle", "(", "Registered", "$", "event", ")", "{", "if", "(", "$", "event", "->", "user", "instanceof", "MustVerifyEmail", "&&", "!", "$", "event", "->", "user", "->", "hasVerifiedEmail", "(", ")", ")", "{", "$", "event", "->", ...
Handle the event. @param \Illuminate\Auth\Events\Registered $event @return void
[ "Handle", "the", "event", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php#L16-L21
train
Handle the Registration event.
[ 30522, 2270, 3853, 5047, 1006, 5068, 1002, 2724, 1007, 1063, 2065, 1006, 1002, 2724, 1011, 1028, 5310, 6013, 11253, 2442, 6299, 8757, 14545, 4014, 1004, 1004, 999, 1002, 2724, 1011, 1028, 5310, 1011, 1028, 2038, 6299, 7810, 14545, 4014, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Renderer.php
Renderer.shouldWrapArrayBeforeRendering
protected static function shouldWrapArrayBeforeRendering( $array, $wrapSingleValues = true, $isAssociativeArray = null) { if (empty($array)) { return false; } if ($isAssociativeArray === null) { $isAssociativeArray = Piwik::isAssociativeArray($array); } $wrap = true; if ($isAssociativeArray) { // we don't wrap if the array has one element that is a value $firstValue = reset($array); if (!$wrapSingleValues && count($array) === 1 && (!is_array($firstValue) && !is_object($firstValue)) ) { $wrap = false; } else { foreach ($array as $value) { if (is_array($value) || is_object($value) ) { $wrap = false; break; } } } } else { $wrap = false; } return $wrap; }
php
protected static function shouldWrapArrayBeforeRendering( $array, $wrapSingleValues = true, $isAssociativeArray = null) { if (empty($array)) { return false; } if ($isAssociativeArray === null) { $isAssociativeArray = Piwik::isAssociativeArray($array); } $wrap = true; if ($isAssociativeArray) { // we don't wrap if the array has one element that is a value $firstValue = reset($array); if (!$wrapSingleValues && count($array) === 1 && (!is_array($firstValue) && !is_object($firstValue)) ) { $wrap = false; } else { foreach ($array as $value) { if (is_array($value) || is_object($value) ) { $wrap = false; break; } } } } else { $wrap = false; } return $wrap; }
[ "protected", "static", "function", "shouldWrapArrayBeforeRendering", "(", "$", "array", ",", "$", "wrapSingleValues", "=", "true", ",", "$", "isAssociativeArray", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "array", ")", ")", "{", "return", "false",...
Returns true if an array should be wrapped before rendering. This is used to mimic quirks in the old rendering logic (for backwards compatibility). The specific meaning of 'wrap' is left up to the Renderer. For XML, this means a new <row> node. For JSON, this means wrapping in an array. In the old code, arrays were added to new DataTable instances, and then rendered. This transformation wrapped associative arrays except under certain circumstances, including: - single element (ie, array('nb_visits' => 0)) (not wrapped for some renderers) - empty array (ie, array()) - array w/ arrays/DataTable instances as values (ie, array('name' => 'myreport', 'reportData' => new DataTable()) OR array('name' => 'myreport', 'reportData' => array(...)) ) @param array $array @param bool $wrapSingleValues Whether to wrap array('key' => 'value') arrays. Some renderers wrap them and some don't. @param bool|null $isAssociativeArray Whether the array is associative or not. If null, it is determined. @return bool
[ "Returns", "true", "if", "an", "array", "should", "be", "wrapped", "before", "rendering", ".", "This", "is", "used", "to", "mimic", "quirks", "in", "the", "old", "rendering", "logic", "(", "for", "backwards", "compatibility", ")", ".", "The", "specific", "...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer.php#L346-L382
train
Returns true if the array should be wrapped before rendering
[ 30522, 5123, 10763, 3853, 2323, 13088, 22068, 11335, 2100, 4783, 29278, 7869, 11563, 2075, 1006, 1002, 9140, 1010, 1002, 19735, 2075, 20414, 2389, 15808, 1027, 2995, 1010, 1002, 18061, 24137, 7405, 6024, 2906, 9447, 1027, 19701, 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...
octobercms/october
modules/cms/twig/PlaceholderNode.php
PlaceholderNode.compile
public function compile(Twig_Compiler $compiler) { $hasBody = $this->hasNode('default'); $varId = '__placeholder_'.$this->getAttribute('name').'_default_contents'; $compiler ->addDebugInfo($this) ->write("\$context[") ->raw("'".$varId."'") ->raw("] = null;"); if ($hasBody) { $compiler ->addDebugInfo($this) ->write('ob_start();') ->subcompile($this->getNode('default')) ->write("\$context[") ->raw("'".$varId."'") ->raw("] = ob_get_clean();"); } $isText = $this->hasAttribute('type') && $this->getAttribute('type') == 'text'; $compiler->addDebugInfo($this); if (!$isText) { $compiler->write("echo \$this->env->getExtension('Cms\Twig\Extension')->displayBlock("); } else { $compiler->write("echo twig_escape_filter(\$this->env, \$this->env->getExtension('Cms\Twig\Extension')->displayBlock("); } $compiler ->raw("'".$this->getAttribute('name')."', ") ->raw("\$context[") ->raw("'".$varId."'") ->raw("]") ->raw(")"); if (!$isText) { $compiler->raw(";\n"); } else { $compiler->raw(");\n"); } $compiler ->addDebugInfo($this) ->write("unset(\$context[") ->raw("'".$varId."'") ->raw("]);"); }
php
public function compile(Twig_Compiler $compiler) { $hasBody = $this->hasNode('default'); $varId = '__placeholder_'.$this->getAttribute('name').'_default_contents'; $compiler ->addDebugInfo($this) ->write("\$context[") ->raw("'".$varId."'") ->raw("] = null;"); if ($hasBody) { $compiler ->addDebugInfo($this) ->write('ob_start();') ->subcompile($this->getNode('default')) ->write("\$context[") ->raw("'".$varId."'") ->raw("] = ob_get_clean();"); } $isText = $this->hasAttribute('type') && $this->getAttribute('type') == 'text'; $compiler->addDebugInfo($this); if (!$isText) { $compiler->write("echo \$this->env->getExtension('Cms\Twig\Extension')->displayBlock("); } else { $compiler->write("echo twig_escape_filter(\$this->env, \$this->env->getExtension('Cms\Twig\Extension')->displayBlock("); } $compiler ->raw("'".$this->getAttribute('name')."', ") ->raw("\$context[") ->raw("'".$varId."'") ->raw("]") ->raw(")"); if (!$isText) { $compiler->raw(";\n"); } else { $compiler->raw(");\n"); } $compiler ->addDebugInfo($this) ->write("unset(\$context[") ->raw("'".$varId."'") ->raw("]);"); }
[ "public", "function", "compile", "(", "Twig_Compiler", "$", "compiler", ")", "{", "$", "hasBody", "=", "$", "this", "->", "hasNode", "(", "'default'", ")", ";", "$", "varId", "=", "'__placeholder_'", ".", "$", "this", "->", "getAttribute", "(", "'name'", ...
Compiles the node to PHP. @param Twig_Compiler $compiler A Twig_Compiler instance
[ "Compiles", "the", "node", "to", "PHP", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/PlaceholderNode.php#L33-L82
train
Compiles the placeholder content into the Twig code
[ 30522, 2270, 3853, 4012, 22090, 1006, 1056, 16279, 1035, 21624, 1002, 21624, 1007, 1063, 1002, 2038, 23684, 1027, 1002, 2023, 1011, 1028, 8440, 10244, 1006, 1005, 12398, 1005, 1007, 1025, 1002, 13075, 3593, 1027, 1005, 1035, 1035, 2173, 145...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/RouteCollectionBuilder.php
RouteCollectionBuilder.add
public function add($path, $controller, $name = null) { $route = new Route($path); $route->setDefault('_controller', $controller); $this->addRoute($route, $name); return $route; }
php
public function add($path, $controller, $name = null) { $route = new Route($path); $route->setDefault('_controller', $controller); $this->addRoute($route, $name); return $route; }
[ "public", "function", "add", "(", "$", "path", ",", "$", "controller", ",", "$", "name", "=", "null", ")", "{", "$", "route", "=", "new", "Route", "(", "$", "path", ")", ";", "$", "route", "->", "setDefault", "(", "'_controller'", ",", "$", "contro...
Adds a route and returns it for future modification. @param string $path The route path @param string $controller The route's controller @param string|null $name The name to give this route @return Route
[ "Adds", "a", "route", "and", "returns", "it", "for", "future", "modification", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L96-L103
train
Add route to the route list
[ 30522, 2270, 3853, 5587, 1006, 1002, 4130, 1010, 1002, 11486, 1010, 1002, 2171, 1027, 19701, 1007, 1063, 1002, 2799, 1027, 2047, 2799, 1006, 1002, 4130, 1007, 1025, 1002, 2799, 1011, 1028, 2275, 3207, 7011, 11314, 1006, 1005, 1035, 11486, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ContractsTrait.php
ContractsTrait.setCallbackWrapper
public function setCallbackWrapper(?callable $callbackWrapper): callable { $previousWrapper = $this->callbackWrapper; $this->callbackWrapper = $callbackWrapper ?? function (callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger) { return $callback($item, $save); }; return $previousWrapper; }
php
public function setCallbackWrapper(?callable $callbackWrapper): callable { $previousWrapper = $this->callbackWrapper; $this->callbackWrapper = $callbackWrapper ?? function (callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger) { return $callback($item, $save); }; return $previousWrapper; }
[ "public", "function", "setCallbackWrapper", "(", "?", "callable", "$", "callbackWrapper", ")", ":", "callable", "{", "$", "previousWrapper", "=", "$", "this", "->", "callbackWrapper", ";", "$", "this", "->", "callbackWrapper", "=", "$", "callbackWrapper", "??", ...
Wraps the callback passed to ->get() in a callable. @return callable the previous callback wrapper
[ "Wraps", "the", "callback", "passed", "to", "-", ">", "get", "()", "in", "a", "callable", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/ContractsTrait.php#L41-L49
train
Set the callback wrapper
[ 30522, 2270, 3853, 2275, 9289, 20850, 8684, 13088, 29098, 2121, 1006, 1029, 2655, 3085, 1002, 2655, 5963, 13088, 29098, 2121, 1007, 1024, 2655, 3085, 1063, 1002, 3025, 13088, 29098, 2121, 1027, 1002, 2023, 1011, 1028, 2655, 5963, 13088, 290...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/controllers/Index.php
Index.makeTemplateFormWidget
protected function makeTemplateFormWidget($type, $template, $alias = null) { $formConfigs = [ 'page' => '~/modules/cms/classes/page/fields.yaml', 'partial' => '~/modules/cms/classes/partial/fields.yaml', 'layout' => '~/modules/cms/classes/layout/fields.yaml', 'content' => '~/modules/cms/classes/content/fields.yaml', 'asset' => '~/modules/cms/classes/asset/fields.yaml' ]; if (!array_key_exists($type, $formConfigs)) { throw new ApplicationException(trans('cms::lang.template.not_found')); } $widgetConfig = $this->makeConfig($formConfigs[$type]); $widgetConfig->model = $template; $widgetConfig->alias = $alias ?: 'form'.studly_case($type).md5($template->getFileName()).uniqid(); return $this->makeWidget('Backend\Widgets\Form', $widgetConfig); }
php
protected function makeTemplateFormWidget($type, $template, $alias = null) { $formConfigs = [ 'page' => '~/modules/cms/classes/page/fields.yaml', 'partial' => '~/modules/cms/classes/partial/fields.yaml', 'layout' => '~/modules/cms/classes/layout/fields.yaml', 'content' => '~/modules/cms/classes/content/fields.yaml', 'asset' => '~/modules/cms/classes/asset/fields.yaml' ]; if (!array_key_exists($type, $formConfigs)) { throw new ApplicationException(trans('cms::lang.template.not_found')); } $widgetConfig = $this->makeConfig($formConfigs[$type]); $widgetConfig->model = $template; $widgetConfig->alias = $alias ?: 'form'.studly_case($type).md5($template->getFileName()).uniqid(); return $this->makeWidget('Backend\Widgets\Form', $widgetConfig); }
[ "protected", "function", "makeTemplateFormWidget", "(", "$", "type", ",", "$", "template", ",", "$", "alias", "=", "null", ")", "{", "$", "formConfigs", "=", "[", "'page'", "=>", "'~/modules/cms/classes/page/fields.yaml'", ",", "'partial'", "=>", "'~/modules/cms/c...
Returns a form widget for a specified template type. @param string $type @param string $template @param string $alias @return Backend\Widgets\Form
[ "Returns", "a", "form", "widget", "for", "a", "specified", "template", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L525-L544
train
Make template form widget
[ 30522, 5123, 3853, 2191, 18532, 15725, 14192, 9148, 24291, 1006, 1002, 2828, 1010, 1002, 23561, 1010, 1002, 14593, 1027, 19701, 1007, 1063, 1002, 2433, 8663, 8873, 5620, 1027, 1031, 1005, 3931, 1005, 1027, 1028, 1005, 1066, 1013, 14184, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/File/DataFile.php
DataFile.save
public function save($data): void { if (\is_string($data)) { // Make sure that the string is valid data. try { $this->formatter->decode($data); } catch (RuntimeException $e) { throw new RuntimeException(sprintf("Failed to save file '%s': %s", $this->getFilePath(), $e->getMessage()), $e->getCode(), $e); } $encoded = $data; } else { $encoded = $this->formatter->encode($data); } parent::save($encoded); }
php
public function save($data): void { if (\is_string($data)) { // Make sure that the string is valid data. try { $this->formatter->decode($data); } catch (RuntimeException $e) { throw new RuntimeException(sprintf("Failed to save file '%s': %s", $this->getFilePath(), $e->getMessage()), $e->getCode(), $e); } $encoded = $data; } else { $encoded = $this->formatter->encode($data); } parent::save($encoded); }
[ "public", "function", "save", "(", "$", "data", ")", ":", "void", "{", "if", "(", "\\", "is_string", "(", "$", "data", ")", ")", "{", "// Make sure that the string is valid data.", "try", "{", "$", "this", "->", "formatter", "->", "decode", "(", "$", "da...
{@inheritdoc} @see FileInterface::save()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/File/DataFile.php#L53-L68
train
Save the data to the file
[ 30522, 2270, 3853, 3828, 1006, 1002, 2951, 1007, 1024, 11675, 1063, 2065, 1006, 1032, 2003, 1035, 5164, 1006, 1002, 2951, 1007, 1007, 1063, 1013, 1013, 2191, 2469, 2008, 1996, 5164, 2003, 9398, 2951, 1012, 3046, 1063, 1002, 2023, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Piwik.php
Piwik.postEvent
public static function postEvent($eventName, $params = array(), $pending = false, $plugins = null) { EventDispatcher::getInstance()->postEvent($eventName, $params, $pending, $plugins); }
php
public static function postEvent($eventName, $params = array(), $pending = false, $plugins = null) { EventDispatcher::getInstance()->postEvent($eventName, $params, $pending, $plugins); }
[ "public", "static", "function", "postEvent", "(", "$", "eventName", ",", "$", "params", "=", "array", "(", ")", ",", "$", "pending", "=", "false", ",", "$", "plugins", "=", "null", ")", "{", "EventDispatcher", "::", "getInstance", "(", ")", "->", "post...
Post an event to Piwik's event dispatcher which will execute the event's observers. @param string $eventName The event name. @param array $params The parameter array to forward to observer callbacks. @param bool $pending If true, plugins that are loaded after this event is fired will have their observers for this event executed. @param array|null $plugins The list of plugins to execute observers for. If null, all plugin observers will be executed. @api
[ "Post", "an", "event", "to", "Piwik", "s", "event", "dispatcher", "which", "will", "execute", "the", "event", "s", "observers", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L778-L781
train
Post an event to the current page
[ 30522, 2270, 10763, 3853, 2695, 18697, 3372, 1006, 1002, 2724, 18442, 1010, 1002, 11498, 5244, 1027, 9140, 1006, 1007, 1010, 1002, 14223, 1027, 6270, 1010, 1002, 13354, 7076, 1027, 19701, 1007, 1063, 2724, 10521, 4502, 10649, 2121, 1024, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Node.php
HTML_QuickForm2_Node.applyFilters
protected function applyFilters($value) { foreach ($this->filters as $filter) { if (is_array($value) && !empty($filter['recursive'])) { array_walk_recursive($value, array('HTML_QuickForm2_Node', 'applyFilter'), $filter); } else { self::applyFilter($value, null, $filter); } } return $value; }
php
protected function applyFilters($value) { foreach ($this->filters as $filter) { if (is_array($value) && !empty($filter['recursive'])) { array_walk_recursive($value, array('HTML_QuickForm2_Node', 'applyFilter'), $filter); } else { self::applyFilter($value, null, $filter); } } return $value; }
[ "protected", "function", "applyFilters", "(", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "filters", "as", "$", "filter", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", "&&", "!", "empty", "(", "$", "filter", "[", "'recursive...
Applies element filters on element value @param mixed Element value @return mixed Filtered value
[ "Applies", "element", "filters", "on", "element", "value" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Node.php#L668-L679
train
Apply all filters to the value
[ 30522, 5123, 3853, 6611, 8873, 21928, 2015, 1006, 1002, 3643, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 17736, 2004, 1002, 11307, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1004, 1004, 999, 4064, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Validator/TraceableValidator.php
TraceableValidator.validate
public function validate($value, $constraints = null, $groups = null) { $violations = $this->validator->validate($value, $constraints, $groups); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 7); $file = $trace[0]['file']; $line = $trace[0]['line']; for ($i = 1; $i < 7; ++$i) { if (isset($trace[$i]['class'], $trace[$i]['function']) && 'validate' === $trace[$i]['function'] && is_a($trace[$i]['class'], ValidatorInterface::class, true) ) { $file = $trace[$i]['file']; $line = $trace[$i]['line']; while (++$i < 7) { if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) { $file = $trace[$i]['file']; $line = $trace[$i]['line']; break; } } break; } } $name = str_replace('\\', '/', $file); $name = substr($name, strrpos($name, '/') + 1); $this->collectedData[] = [ 'caller' => compact('name', 'file', 'line'), 'context' => compact('value', 'constraints', 'groups'), 'violations' => iterator_to_array($violations), ]; return $violations; }
php
public function validate($value, $constraints = null, $groups = null) { $violations = $this->validator->validate($value, $constraints, $groups); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 7); $file = $trace[0]['file']; $line = $trace[0]['line']; for ($i = 1; $i < 7; ++$i) { if (isset($trace[$i]['class'], $trace[$i]['function']) && 'validate' === $trace[$i]['function'] && is_a($trace[$i]['class'], ValidatorInterface::class, true) ) { $file = $trace[$i]['file']; $line = $trace[$i]['line']; while (++$i < 7) { if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) { $file = $trace[$i]['file']; $line = $trace[$i]['line']; break; } } break; } } $name = str_replace('\\', '/', $file); $name = substr($name, strrpos($name, '/') + 1); $this->collectedData[] = [ 'caller' => compact('name', 'file', 'line'), 'context' => compact('value', 'constraints', 'groups'), 'violations' => iterator_to_array($violations), ]; return $violations; }
[ "public", "function", "validate", "(", "$", "value", ",", "$", "constraints", "=", "null", ",", "$", "groups", "=", "null", ")", "{", "$", "violations", "=", "$", "this", "->", "validator", "->", "validate", "(", "$", "value", ",", "$", "constraints", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/TraceableValidator.php#L64-L103
train
Validate the value using the validator
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 1002, 14679, 1027, 19701, 1010, 1002, 2967, 1027, 19701, 1007, 1063, 1002, 13302, 1027, 1002, 2023, 1011, 1028, 9398, 8844, 1011, 1028, 9398, 3686, 1006, 1002, 3643, 1010, 1002, 14679, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AmqpExt/AmqpReceiver.php
AmqpReceiver.getMessageCount
public function getMessageCount(): int { try { return $this->connection->countMessagesInQueues(); } catch (\AMQPException $exception) { throw new TransportException($exception->getMessage(), 0, $exception); } }
php
public function getMessageCount(): int { try { return $this->connection->countMessagesInQueues(); } catch (\AMQPException $exception) { throw new TransportException($exception->getMessage(), 0, $exception); } }
[ "public", "function", "getMessageCount", "(", ")", ":", "int", "{", "try", "{", "return", "$", "this", "->", "connection", "->", "countMessagesInQueues", "(", ")", ";", "}", "catch", "(", "\\", "AMQPException", "$", "exception", ")", "{", "throw", "new", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php#L111-L118
train
Returns the number of messages in the queues
[ 30522, 2270, 3853, 2131, 7834, 3736, 3351, 3597, 16671, 1006, 1007, 1024, 20014, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 4434, 1011, 1028, 4175, 7834, 3736, 8449, 2378, 4226, 15808, 1006, 1007, 1025, 1065, 4608, 1006, 1032, 2572, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php
ConditionallyLoadsAttributes.whenPivotLoadedAs
protected function whenPivotLoadedAs($accessor, $table, $value, $default = null) { if (func_num_args() === 3) { $default = new MissingValue; } return $this->when( $this->resource->$accessor && ($this->resource->$accessor instanceof $table || $this->resource->$accessor->getTable() === $table), ...[$value, $default] ); }
php
protected function whenPivotLoadedAs($accessor, $table, $value, $default = null) { if (func_num_args() === 3) { $default = new MissingValue; } return $this->when( $this->resource->$accessor && ($this->resource->$accessor instanceof $table || $this->resource->$accessor->getTable() === $table), ...[$value, $default] ); }
[ "protected", "function", "whenPivotLoadedAs", "(", "$", "accessor", ",", "$", "table", ",", "$", "value", ",", "$", "default", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "3", ")", "{", "$", "default", "=", "new", "MissingValue"...
Execute a callback if the given pivot table with a custom accessor has been loaded. @param string $accessor @param string $table @param mixed $value @param mixed $default @return \Illuminate\Http\Resources\MissingValue|mixed
[ "Execute", "a", "callback", "if", "the", "given", "pivot", "table", "with", "a", "custom", "accessor", "has", "been", "loaded", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php#L198-L210
train
When the pivot table has been loaded as the specified table and the value has been set as the specified value
[ 30522, 5123, 3853, 2043, 8197, 22994, 17468, 3022, 1006, 1002, 3229, 2953, 1010, 1002, 2795, 1010, 1002, 3643, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 2065, 1006, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, 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...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
ArrayDenormalizer.supportsDenormalization
public function supportsDenormalization($data, $type, $format = null, array $context = []) { return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); }
php
public function supportsDenormalization($data, $type, $format = null, array $context = []) { return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); }
[ "public", "function", "supportsDenormalization", "(", "$", "data", ",", "$", "type", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "return", "'[]'", "===", "substr", "(", "$", "type", ",", "-", "2", ")", "&...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php#L69-L73
train
Returns true if the serializer supports denormalization
[ 30522, 2270, 3853, 6753, 4181, 2953, 9067, 3989, 1006, 1002, 2951, 1010, 1002, 2828, 1010, 1002, 4289, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 2709, 1005, 1031, 1033, 1005, 1027, 1027, 1027, 4942, 3367, 2099, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/traits/ErrorMaker.php
ErrorMaker.handleError
public function handleError($exception) { $errorMessage = ErrorHandler::getDetailedMessage($exception); $this->fatalError = $errorMessage; $this->vars['fatalError'] = $errorMessage; }
php
public function handleError($exception) { $errorMessage = ErrorHandler::getDetailedMessage($exception); $this->fatalError = $errorMessage; $this->vars['fatalError'] = $errorMessage; }
[ "public", "function", "handleError", "(", "$", "exception", ")", "{", "$", "errorMessage", "=", "ErrorHandler", "::", "getDetailedMessage", "(", "$", "exception", ")", ";", "$", "this", "->", "fatalError", "=", "$", "errorMessage", ";", "$", "this", "->", ...
Sets standard page variables in the case of a controller error.
[ "Sets", "standard", "page", "variables", "in", "the", "case", "of", "a", "controller", "error", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/ErrorMaker.php#L22-L27
train
This method is called by the error handler to display the error message.
[ 30522, 2270, 3853, 5047, 2121, 29165, 1006, 1002, 6453, 1007, 1063, 1002, 7561, 7834, 3736, 3351, 1027, 7561, 11774, 3917, 1024, 1024, 2131, 3207, 14162, 2098, 7834, 3736, 3351, 1006, 1002, 6453, 1007, 1025, 1002, 2023, 1011, 1028, 10611, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Filesystem/Folder.php
Folder.delete
public static function delete($target, $include_target = true) { if (!is_dir($target)) { return false; } $success = self::doDelete($target, $include_target); if (!$success) { $error = error_get_last(); throw new \RuntimeException($error['message']); } // Make sure that the change will be detected when caching. if ($include_target) { @touch(dirname($target)); } else { @touch($target); } return $success; }
php
public static function delete($target, $include_target = true) { if (!is_dir($target)) { return false; } $success = self::doDelete($target, $include_target); if (!$success) { $error = error_get_last(); throw new \RuntimeException($error['message']); } // Make sure that the change will be detected when caching. if ($include_target) { @touch(dirname($target)); } else { @touch($target); } return $success; }
[ "public", "static", "function", "delete", "(", "$", "target", ",", "$", "include_target", "=", "true", ")", "{", "if", "(", "!", "is_dir", "(", "$", "target", ")", ")", "{", "return", "false", ";", "}", "$", "success", "=", "self", "::", "doDelete", ...
Recursively delete directory from filesystem. @param string $target @param bool $include_target @return bool @throws \RuntimeException
[ "Recursively", "delete", "directory", "from", "filesystem", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Filesystem/Folder.php#L383-L404
train
Delete a directory and all of its contents
[ 30522, 2270, 10763, 3853, 3972, 12870, 1006, 1002, 4539, 1010, 1002, 2421, 1035, 4539, 1027, 2995, 1007, 1063, 2065, 1006, 999, 2003, 1035, 16101, 1006, 1002, 4539, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 1002, 3112, 1027, 2969, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php
AcceptHeaderItem.setAttribute
public function setAttribute($name, $value) { if ('q' === $name) { $this->quality = (float) $value; } else { $this->attributes[$name] = (string) $value; } return $this; }
php
public function setAttribute($name, $value) { if ('q' === $name) { $this->quality = (float) $value; } else { $this->attributes[$name] = (string) $value; } return $this; }
[ "public", "function", "setAttribute", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "'q'", "===", "$", "name", ")", "{", "$", "this", "->", "quality", "=", "(", "float", ")", "$", "value", ";", "}", "else", "{", "$", "this", "->", "...
Set an attribute. @param string $name @param string $value @return $this
[ "Set", "an", "attribute", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php#L181-L190
train
Set attribute value
[ 30522, 2270, 3853, 2275, 19321, 3089, 8569, 2618, 1006, 1002, 2171, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 1005, 1053, 1005, 1027, 1027, 1027, 1002, 2171, 1007, 1063, 1002, 2023, 1011, 1028, 3737, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Middleware/ThrottleRequests.php
ThrottleRequests.addHeaders
protected function addHeaders(Response $response, $maxAttempts, $remainingAttempts, $retryAfter = null) { $response->headers->add( $this->getHeaders($maxAttempts, $remainingAttempts, $retryAfter) ); return $response; }
php
protected function addHeaders(Response $response, $maxAttempts, $remainingAttempts, $retryAfter = null) { $response->headers->add( $this->getHeaders($maxAttempts, $remainingAttempts, $retryAfter) ); return $response; }
[ "protected", "function", "addHeaders", "(", "Response", "$", "response", ",", "$", "maxAttempts", ",", "$", "remainingAttempts", ",", "$", "retryAfter", "=", "null", ")", "{", "$", "response", "->", "headers", "->", "add", "(", "$", "this", "->", "getHeade...
Add the limit header information to the given response. @param \Symfony\Component\HttpFoundation\Response $response @param int $maxAttempts @param int $remainingAttempts @param int|null $retryAfter @return \Symfony\Component\HttpFoundation\Response
[ "Add", "the", "limit", "header", "information", "to", "the", "given", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Middleware/ThrottleRequests.php#L149-L156
train
Add headers to the response
[ 30522, 5123, 3853, 5587, 4974, 2545, 1006, 3433, 1002, 3433, 1010, 1002, 4098, 19321, 6633, 22798, 1010, 1002, 3588, 19321, 6633, 22798, 1010, 1002, 2128, 11129, 10354, 3334, 1027, 19701, 30524, 1011, 1028, 5587, 1006, 1002, 2023, 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...
matomo-org/matomo
plugins/API/API.php
API.isPluginActivated
public function isPluginActivated($pluginName) { Piwik::checkUserHasSomeViewAccess(); return \Piwik\Plugin\Manager::getInstance()->isPluginActivated($pluginName); }
php
public function isPluginActivated($pluginName) { Piwik::checkUserHasSomeViewAccess(); return \Piwik\Plugin\Manager::getInstance()->isPluginActivated($pluginName); }
[ "public", "function", "isPluginActivated", "(", "$", "pluginName", ")", "{", "Piwik", "::", "checkUserHasSomeViewAccess", "(", ")", ";", "return", "\\", "Piwik", "\\", "Plugin", "\\", "Manager", "::", "getInstance", "(", ")", "->", "isPluginActivated", "(", "$...
Return true if plugin is activated, false otherwise @param string $pluginName @return bool
[ "Return", "true", "if", "plugin", "is", "activated", "false", "otherwise" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/API.php#L553-L557
train
Returns true if the plugin is activated.
[ 30522, 2270, 3853, 2003, 24759, 15916, 3981, 6593, 21967, 1006, 1002, 13354, 23111, 14074, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 14045, 8584, 6305, 9623, 2015, 1006, 1007, 1025, 2709, 1032, 14255, 9148, 2243, 1032, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Rules/DatabaseRule.php
DatabaseRule.whereNot
public function whereNot($column, $value) { if (is_array($value)) { return $this->whereNotIn($column, $value); } return $this->where($column, '!'.$value); }
php
public function whereNot($column, $value) { if (is_array($value)) { return $this->whereNotIn($column, $value); } return $this->where($column, '!'.$value); }
[ "public", "function", "whereNot", "(", "$", "column", ",", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "$", "this", "->", "whereNotIn", "(", "$", "column", ",", "$", "value", ")", ";", "}", "return", ...
Set a "where not" constraint on the query. @param string $column @param array|string $value @return $this
[ "Set", "a", "where", "not", "constraint", "on", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Rules/DatabaseRule.php#L79-L86
train
Devuelve el where not de la consulta
[ 30522, 2270, 3853, 2073, 17048, 1006, 1002, 5930, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2073, 17048, 2378, 1006, 1002, 5930, 1010, 1002, 3643, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/Mailable.php
Mailable.with
public function with($key, $value = null) { if (is_array($key)) { $this->viewData = array_merge($this->viewData, $key); } else { $this->viewData[$key] = $value; } return $this; }
php
public function with($key, $value = null) { if (is_array($key)) { $this->viewData = array_merge($this->viewData, $key); } else { $this->viewData[$key] = $value; } return $this; }
[ "public", "function", "with", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "$", "this", "->", "viewData", "=", "array_merge", "(", "$", "this", "->", "viewData", ",", "$", "key"...
Set the view data for the message. @param string|array $key @param mixed $value @return $this
[ "Set", "the", "view", "data", "for", "the", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L730-L739
train
Add a view data to the viewData array
[ 30522, 2270, 3853, 2007, 1006, 1002, 3145, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 3145, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 3193, 2850, 2696, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/PostgresBuilder.php
PostgresBuilder.dropAllTables
public function dropAllTables() { $tables = []; $excludedTables = ['spatial_ref_sys']; foreach ($this->getAllTables() as $row) { $row = (array) $row; $table = reset($row); if (! in_array($table, $excludedTables)) { $tables[] = $table; } } if (empty($tables)) { return; } $this->connection->statement( $this->grammar->compileDropAllTables($tables) ); }
php
public function dropAllTables() { $tables = []; $excludedTables = ['spatial_ref_sys']; foreach ($this->getAllTables() as $row) { $row = (array) $row; $table = reset($row); if (! in_array($table, $excludedTables)) { $tables[] = $table; } } if (empty($tables)) { return; } $this->connection->statement( $this->grammar->compileDropAllTables($tables) ); }
[ "public", "function", "dropAllTables", "(", ")", "{", "$", "tables", "=", "[", "]", ";", "$", "excludedTables", "=", "[", "'spatial_ref_sys'", "]", ";", "foreach", "(", "$", "this", "->", "getAllTables", "(", ")", "as", "$", "row", ")", "{", "$", "ro...
Drop all tables from the database. @return void
[ "Drop", "all", "tables", "from", "the", "database", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/PostgresBuilder.php#L29-L52
train
Drop all tables in the database
[ 30522, 2270, 3853, 4530, 8095, 10880, 2015, 1006, 1007, 1063, 1002, 7251, 1027, 1031, 1033, 1025, 1002, 12421, 10880, 2015, 1027, 1031, 1005, 13589, 1035, 25416, 1035, 25353, 2015, 1005, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/IgnoreCookie.php
IgnoreCookie.setIgnoreCookie
public static function setIgnoreCookie() { $ignoreCookie = self::getIgnoreCookie(); if ($ignoreCookie->isCookieFound()) { $ignoreCookie->delete(); } else { $ignoreCookie->set('ignore', '*'); $ignoreCookie->save(); } self::deleteThirdPartyCookieUIDIfExists(); }
php
public static function setIgnoreCookie() { $ignoreCookie = self::getIgnoreCookie(); if ($ignoreCookie->isCookieFound()) { $ignoreCookie->delete(); } else { $ignoreCookie->set('ignore', '*'); $ignoreCookie->save(); } self::deleteThirdPartyCookieUIDIfExists(); }
[ "public", "static", "function", "setIgnoreCookie", "(", ")", "{", "$", "ignoreCookie", "=", "self", "::", "getIgnoreCookie", "(", ")", ";", "if", "(", "$", "ignoreCookie", "->", "isCookieFound", "(", ")", ")", "{", "$", "ignoreCookie", "->", "delete", "(",...
Set ignore (visit) cookie or deletes it if already present
[ "Set", "ignore", "(", "visit", ")", "cookie", "or", "deletes", "it", "if", "already", "present" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/IgnoreCookie.php#L57-L68
train
Set Ignore Cookie
[ 30522, 2270, 10763, 3853, 2275, 23773, 5686, 3597, 23212, 2063, 1006, 1007, 1063, 1002, 8568, 3597, 23212, 2063, 1027, 2969, 1024, 1024, 2131, 23773, 5686, 3597, 23212, 2063, 1006, 1007, 1025, 2065, 1006, 1002, 8568, 3597, 23212, 2063, 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/View/Factory.php
Factory.share
public function share($key, $value = null) { $keys = is_array($key) ? $key : [$key => $value]; foreach ($keys as $key => $value) { $this->shared[$key] = $value; } return $value; }
php
public function share($key, $value = null) { $keys = is_array($key) ? $key : [$key => $value]; foreach ($keys as $key => $value) { $this->shared[$key] = $value; } return $value; }
[ "public", "function", "share", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "$", "keys", "=", "is_array", "(", "$", "key", ")", "?", "$", "key", ":", "[", "$", "key", "=>", "$", "value", "]", ";", "foreach", "(", "$", "keys", "a...
Add a piece of shared data to the environment. @param array|string $key @param mixed $value @return mixed
[ "Add", "a", "piece", "of", "shared", "data", "to", "the", "environment", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Factory.php#L313-L322
train
Share a key with a value
[ 30522, 2270, 3853, 3745, 1006, 1002, 3145, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 1002, 6309, 1027, 2003, 1035, 9140, 1006, 1002, 3145, 1007, 1029, 1002, 3145, 1024, 1031, 1002, 3145, 1027, 1028, 1002, 3643, 1033, 1025, 18921, 6776, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Validator.php
Validator.replaceAsterisksInParameters
protected function replaceAsterisksInParameters(array $parameters, array $keys) { return array_map(function ($field) use ($keys) { return vsprintf(str_replace('*', '%s', $field), $keys); }, $parameters); }
php
protected function replaceAsterisksInParameters(array $parameters, array $keys) { return array_map(function ($field) use ($keys) { return vsprintf(str_replace('*', '%s', $field), $keys); }, $parameters); }
[ "protected", "function", "replaceAsterisksInParameters", "(", "array", "$", "parameters", ",", "array", "$", "keys", ")", "{", "return", "array_map", "(", "function", "(", "$", "field", ")", "use", "(", "$", "keys", ")", "{", "return", "vsprintf", "(", "st...
Replace each field parameter which has asterisks with the given keys. @param array $parameters @param array $keys @return array
[ "Replace", "each", "field", "parameter", "which", "has", "asterisks", "with", "the", "given", "keys", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L461-L466
train
Replace asterisks in parameters with the values in the parameters array
[ 30522, 5123, 3853, 5672, 24268, 20573, 11493, 28689, 22828, 2015, 1006, 9140, 1002, 11709, 1010, 9140, 1002, 6309, 1007, 1063, 2709, 9140, 1035, 4949, 1006, 3853, 1006, 1002, 2492, 1007, 2224, 1006, 1002, 6309, 1007, 1063, 2709, 5443, 16550...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/BeautifyTimeRangeLabels.php
BeautifyTimeRangeLabels.getRangeLabel
public function getRangeLabel($oldLabel, $lowerBound, $upperBound) { if ($lowerBound < 60) { return sprintf($this->labelSecondsPlural, $lowerBound, $upperBound); } else { return sprintf($this->labelPlural, ceil($lowerBound / 60) . "-" . ceil($upperBound / 60)); } }
php
public function getRangeLabel($oldLabel, $lowerBound, $upperBound) { if ($lowerBound < 60) { return sprintf($this->labelSecondsPlural, $lowerBound, $upperBound); } else { return sprintf($this->labelPlural, ceil($lowerBound / 60) . "-" . ceil($upperBound / 60)); } }
[ "public", "function", "getRangeLabel", "(", "$", "oldLabel", ",", "$", "lowerBound", ",", "$", "upperBound", ")", "{", "if", "(", "$", "lowerBound", "<", "60", ")", "{", "return", "sprintf", "(", "$", "this", "->", "labelSecondsPlural", ",", "$", "lowerB...
Beautifies and returns a range label whose range is bounded and spans over more than one unit, ie 1-5, 5-10 but NOT 11+. If the lower bound of the range is less than 60 the pretty range label will be in seconds. Otherwise, it will be in minutes. @param string $oldLabel The original label value. @param int $lowerBound The lower bound of the range. @param int $upperBound The upper bound of the range. @return string The pretty range label.
[ "Beautifies", "and", "returns", "a", "range", "label", "whose", "range", "is", "bounded", "and", "spans", "over", "more", "than", "one", "unit", "ie", "1", "-", "5", "5", "-", "10", "but", "NOT", "11", "+", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/BeautifyTimeRangeLabels.php#L92-L99
train
Returns range label
[ 30522, 2270, 3853, 2131, 24388, 10581, 8671, 1006, 1002, 2214, 20470, 2884, 1010, 1002, 2896, 15494, 1010, 1002, 3356, 15494, 1007, 1063, 2065, 1006, 1002, 2896, 15494, 1026, 3438, 1007, 1063, 2709, 9043, 2546, 1006, 1002, 2023, 1011, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Static.php
Zend_Cache_Backend_Static.load
public function load($id, $doNotTestCacheValidity = false) { if (($id = (string)$id) === '') { $id = $this->_detectId(); } else { $id = $this->_decodeId($id); } if (!$this->_verifyPath($id)) { Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path'); } if ($doNotTestCacheValidity) { $this->_log("Zend_Cache_Backend_Static::load() : \$doNotTestCacheValidity=true is unsupported by the Static backend"); } $fileName = basename($id); if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); $file = rtrim($pathName, '/') . '/' . $fileName . $this->_options['file_extension']; if (file_exists($file)) { $content = file_get_contents($file); return $content; } return false; }
php
public function load($id, $doNotTestCacheValidity = false) { if (($id = (string)$id) === '') { $id = $this->_detectId(); } else { $id = $this->_decodeId($id); } if (!$this->_verifyPath($id)) { Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path'); } if ($doNotTestCacheValidity) { $this->_log("Zend_Cache_Backend_Static::load() : \$doNotTestCacheValidity=true is unsupported by the Static backend"); } $fileName = basename($id); if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); $file = rtrim($pathName, '/') . '/' . $fileName . $this->_options['file_extension']; if (file_exists($file)) { $content = file_get_contents($file); return $content; } return false; }
[ "public", "function", "load", "(", "$", "id", ",", "$", "doNotTestCacheValidity", "=", "false", ")", "{", "if", "(", "(", "$", "id", "=", "(", "string", ")", "$", "id", ")", "===", "''", ")", "{", "$", "id", "=", "$", "this", "->", "_detectId", ...
Test if a cache is available for the given id and (if yes) return it (false else) Note : return value is always "string" (unserialization is done by the core not by the backend) @param string $id Cache id @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested @return string|false cached datas
[ "Test", "if", "a", "cache", "is", "available", "for", "the", "given", "id", "and", "(", "if", "yes", ")", "return", "it", "(", "false", "else", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Static.php#L124-L150
train
Load a cache from the file system
[ 30522, 2270, 3853, 7170, 1006, 1002, 8909, 1010, 1002, 2123, 28495, 3367, 3540, 16179, 11475, 25469, 1027, 6270, 1007, 1063, 2065, 1006, 1006, 1002, 8909, 1027, 1006, 5164, 1007, 1002, 8909, 1007, 1027, 1027, 1027, 1005, 1005, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Http/Concerns/InteractsWithInput.php
InteractsWithInput.bearerToken
public function bearerToken() { $header = $this->header('Authorization', ''); if (Str::startsWith($header, 'Bearer ')) { return Str::substr($header, 7); } }
php
public function bearerToken() { $header = $this->header('Authorization', ''); if (Str::startsWith($header, 'Bearer ')) { return Str::substr($header, 7); } }
[ "public", "function", "bearerToken", "(", ")", "{", "$", "header", "=", "$", "this", "->", "header", "(", "'Authorization'", ",", "''", ")", ";", "if", "(", "Str", "::", "startsWith", "(", "$", "header", ",", "'Bearer '", ")", ")", "{", "return", "St...
Get the bearer token from the request headers. @return string|null
[ "Get", "the", "bearer", "token", "from", "the", "request", "headers", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Concerns/InteractsWithInput.php#L53-L60
train
Get bearer token
[ 30522, 2270, 3853, 20905, 18715, 2368, 1006, 1007, 1063, 1002, 20346, 1027, 1002, 2023, 1011, 1028, 20346, 1006, 1005, 20104, 1005, 1010, 1005, 1005, 1007, 1025, 2065, 1006, 2358, 2099, 1024, 1024, 4627, 24415, 1006, 1002, 20346, 1010, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.where
public function where($key, $operator = null, $value = null) { return $this->filter($this->operatorForWhere(...func_get_args())); }
php
public function where($key, $operator = null, $value = null) { return $this->filter($this->operatorForWhere(...func_get_args())); }
[ "public", "function", "where", "(", "$", "key", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "filter", "(", "$", "this", "->", "operatorForWhere", "(", "...", "func_get_args", "(", ")", ")"...
Filter items by the given key value pair. @param string $key @param mixed $operator @param mixed $value @return static
[ "Filter", "items", "by", "the", "given", "key", "value", "pair", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L643-L646
train
Filters the result by a given key value pair using the given operator.
[ 30522, 2270, 3853, 2073, 1006, 1002, 3145, 1010, 1002, 6872, 1027, 19701, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11307, 1006, 1002, 2023, 1011, 1028, 6872, 29278, 2860, 5886, 2063, 1006, 1012, 1012, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Fragment/FragmentHandler.php
FragmentHandler.deliver
protected function deliver(Response $response) { if (!$response->isSuccessful()) { throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode())); } if (!$response instanceof StreamedResponse) { return $response->getContent(); } $response->sendContent(); }
php
protected function deliver(Response $response) { if (!$response->isSuccessful()) { throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode())); } if (!$response instanceof StreamedResponse) { return $response->getContent(); } $response->sendContent(); }
[ "protected", "function", "deliver", "(", "Response", "$", "response", ")", "{", "if", "(", "!", "$", "response", "->", "isSuccessful", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Error when rendering \"%s\" (Status code i...
Delivers the Response as a string. When the Response is a StreamedResponse, the content is streamed immediately instead of being returned. @return string|null The Response content or null when the Response is streamed @throws \RuntimeException when the Response is not successful
[ "Delivers", "the", "Response", "as", "a", "string", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php#L100-L111
train
Deliver the response to the browser
[ 30522, 5123, 3853, 8116, 1006, 3433, 1002, 3433, 1007, 1063, 2065, 1006, 999, 1002, 3433, 1011, 1028, 26354, 14194, 9623, 22747, 5313, 1006, 1007, 1007, 1063, 5466, 2047, 1032, 2448, 7292, 10288, 24422, 1006, 9043, 2546, 1006, 1005, 7561, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Scheduler/Scheduler.php
Scheduler.addFunction
public function addFunction(callable $fn, $args = [], $id = null) { $job = new Job($fn, $args, $id); $this->queueJob($job->configure($this->config)); return $job; }
php
public function addFunction(callable $fn, $args = [], $id = null) { $job = new Job($fn, $args, $id); $this->queueJob($job->configure($this->config)); return $job; }
[ "public", "function", "addFunction", "(", "callable", "$", "fn", ",", "$", "args", "=", "[", "]", ",", "$", "id", "=", "null", ")", "{", "$", "job", "=", "new", "Job", "(", "$", "fn", ",", "$", "args", ",", "$", "id", ")", ";", "$", "this", ...
Queues a PHP function execution. @param callable $fn The function to execute @param array $args Optional arguments to pass to the php script @param string $id Optional custom identifier @return Job
[ "Queues", "a", "PHP", "function", "execution", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Scheduler.php#L126-L132
train
Add a function to the queue
[ 30522, 2270, 3853, 5587, 11263, 27989, 1006, 2655, 3085, 1002, 1042, 2078, 1010, 1002, 12098, 5620, 1027, 1031, 1033, 1010, 1002, 8909, 1027, 19701, 1007, 1063, 1002, 3105, 1027, 2047, 3105, 1006, 1002, 30524, 1002, 3105, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.withoutTouchingOn
public static function withoutTouchingOn(array $models, callable $callback) { static::$ignoreOnTouch = array_values(array_merge(static::$ignoreOnTouch, $models)); try { call_user_func($callback); } finally { static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models)); } }
php
public static function withoutTouchingOn(array $models, callable $callback) { static::$ignoreOnTouch = array_values(array_merge(static::$ignoreOnTouch, $models)); try { call_user_func($callback); } finally { static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models)); } }
[ "public", "static", "function", "withoutTouchingOn", "(", "array", "$", "models", ",", "callable", "$", "callback", ")", "{", "static", "::", "$", "ignoreOnTouch", "=", "array_values", "(", "array_merge", "(", "static", "::", "$", "ignoreOnTouch", ",", "$", ...
Disables relationship model touching for the given model classes during given callback scope. @param array $models @param callable $callback @return void
[ "Disables", "relationship", "model", "touching", "for", "the", "given", "model", "classes", "during", "given", "callback", "scope", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L276-L285
train
Exclude the given models from the ignore - on - touch list.
[ 30522, 2270, 10763, 3853, 2302, 24826, 8450, 2239, 1006, 9140, 1002, 4275, 1010, 2655, 3085, 1002, 2655, 5963, 1007, 1063, 10763, 1024, 1024, 1002, 8568, 12162, 7140, 2818, 1027, 9140, 1035, 5300, 1006, 9140, 1035, 13590, 1006, 10763, 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...
octobercms/october
modules/backend/classes/WidgetManager.php
WidgetManager.resolveFormWidget
public function resolveFormWidget($name) { if ($this->formWidgets === null) { $this->listFormWidgets(); } $hints = $this->formWidgetHints; if (isset($hints[$name])) { return $hints[$name]; } $_name = Str::normalizeClassName($name); if (isset($this->formWidgets[$_name])) { return $_name; } return $name; }
php
public function resolveFormWidget($name) { if ($this->formWidgets === null) { $this->listFormWidgets(); } $hints = $this->formWidgetHints; if (isset($hints[$name])) { return $hints[$name]; } $_name = Str::normalizeClassName($name); if (isset($this->formWidgets[$_name])) { return $_name; } return $name; }
[ "public", "function", "resolveFormWidget", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "formWidgets", "===", "null", ")", "{", "$", "this", "->", "listFormWidgets", "(", ")", ";", "}", "$", "hints", "=", "$", "this", "->", "formWidgetHint...
Returns a class name from a form widget code Normalizes a class name or converts an code to its class name. @param string $name Class name or form widget code. @return string The class name resolved, or the original name.
[ "Returns", "a", "class", "name", "from", "a", "form", "widget", "code", "Normalizes", "a", "class", "name", "or", "converts", "an", "code", "to", "its", "class", "name", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/WidgetManager.php#L136-L154
train
Resolves form widget name
[ 30522, 30524, 1006, 1007, 1025, 1065, 1002, 20385, 1027, 1002, 2023, 1011, 1028, 2433, 9148, 24291, 10606, 3215, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 20385, 1031, 1002, 2171, 1033, 1007, 1007, 1063, 2709, 1002, 20385, 1031, 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...
laravel/framework
src/Illuminate/Queue/Listener.php
Listener.createCommand
protected function createCommand($connection, $queue, ListenerOptions $options) { return array_filter([ $this->phpBinary(), $this->artisanBinary(), 'queue:work', $connection, '--once', "--queue={$queue}", "--delay={$options->delay}", "--memory={$options->memory}", "--sleep={$options->sleep}", "--tries={$options->maxTries}", ], function ($value) { return ! is_null($value); }); }
php
protected function createCommand($connection, $queue, ListenerOptions $options) { return array_filter([ $this->phpBinary(), $this->artisanBinary(), 'queue:work', $connection, '--once', "--queue={$queue}", "--delay={$options->delay}", "--memory={$options->memory}", "--sleep={$options->sleep}", "--tries={$options->maxTries}", ], function ($value) { return ! is_null($value); }); }
[ "protected", "function", "createCommand", "(", "$", "connection", ",", "$", "queue", ",", "ListenerOptions", "$", "options", ")", "{", "return", "array_filter", "(", "[", "$", "this", "->", "phpBinary", "(", ")", ",", "$", "this", "->", "artisanBinary", "(...
Create the command with the listener options. @param string $connection @param string $queue @param \Illuminate\Queue\ListenerOptions $options @return array
[ "Create", "the", "command", "with", "the", "listener", "options", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Listener.php#L146-L162
train
Create command for listener
[ 30522, 5123, 3853, 3443, 9006, 2386, 2094, 1006, 1002, 4434, 1010, 1002, 24240, 1010, 19373, 7361, 9285, 1002, 7047, 1007, 1063, 2709, 9140, 1035, 11307, 1006, 1031, 1002, 2023, 1011, 1028, 25718, 21114, 2854, 1006, 1007, 1010, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/FlexObject.php
FlexObject.search
public function search(string $search, $properties = null, array $options = null): float { $options = $options ?? $this->getFlexDirectory()->getConfig('data.search.options', []); $properties = $properties ?? $this->getFlexDirectory()->getConfig('data.search.fields', []); if (!$properties) { foreach ($this->getFlexDirectory()->getConfig('admin.list.fields', []) as $property => $value) { if (!empty($value['link'])) { $properties[] = $property; } } } $weight = 0; foreach ((array)$properties as $property) { $weight += $this->searchNestedProperty($property, $search, $options); } return $weight > 0 ? min($weight, 1) : 0; }
php
public function search(string $search, $properties = null, array $options = null): float { $options = $options ?? $this->getFlexDirectory()->getConfig('data.search.options', []); $properties = $properties ?? $this->getFlexDirectory()->getConfig('data.search.fields', []); if (!$properties) { foreach ($this->getFlexDirectory()->getConfig('admin.list.fields', []) as $property => $value) { if (!empty($value['link'])) { $properties[] = $property; } } } $weight = 0; foreach ((array)$properties as $property) { $weight += $this->searchNestedProperty($property, $search, $options); } return $weight > 0 ? min($weight, 1) : 0; }
[ "public", "function", "search", "(", "string", "$", "search", ",", "$", "properties", "=", "null", ",", "array", "$", "options", "=", "null", ")", ":", "float", "{", "$", "options", "=", "$", "options", "??", "$", "this", "->", "getFlexDirectory", "(",...
{@inheritdoc} @see FlexObjectInterface::search()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexObject.php#L161-L179
train
Search for a given search string in the flex directory
[ 30522, 2270, 3853, 3945, 1006, 5164, 1002, 3945, 1010, 1002, 5144, 1027, 19701, 1010, 9140, 1002, 7047, 1027, 30524, 2023, 1011, 1028, 2131, 21031, 2595, 4305, 2890, 16761, 2100, 1006, 1007, 1011, 1028, 2131, 8663, 8873, 2290, 1006, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/EloquentUserProvider.php
EloquentUserProvider.retrieveByCredentials
public function retrieveByCredentials(array $credentials) { if (empty($credentials) || (count($credentials) === 1 && array_key_exists('password', $credentials))) { return; } // First we will add each credential element to the query as a where clause. // Then we can execute the query and, if we found a user, return it in a // Eloquent User "model" that will be utilized by the Guard instances. $query = $this->newModelQuery(); foreach ($credentials as $key => $value) { if (Str::contains($key, 'password')) { continue; } if (is_array($value) || $value instanceof Arrayable) { $query->whereIn($key, $value); } else { $query->where($key, $value); } } return $query->first(); }
php
public function retrieveByCredentials(array $credentials) { if (empty($credentials) || (count($credentials) === 1 && array_key_exists('password', $credentials))) { return; } // First we will add each credential element to the query as a where clause. // Then we can execute the query and, if we found a user, return it in a // Eloquent User "model" that will be utilized by the Guard instances. $query = $this->newModelQuery(); foreach ($credentials as $key => $value) { if (Str::contains($key, 'password')) { continue; } if (is_array($value) || $value instanceof Arrayable) { $query->whereIn($key, $value); } else { $query->where($key, $value); } } return $query->first(); }
[ "public", "function", "retrieveByCredentials", "(", "array", "$", "credentials", ")", "{", "if", "(", "empty", "(", "$", "credentials", ")", "||", "(", "count", "(", "$", "credentials", ")", "===", "1", "&&", "array_key_exists", "(", "'password'", ",", "$"...
Retrieve a user by the given credentials. @param array $credentials @return \Illuminate\Contracts\Auth\Authenticatable|null
[ "Retrieve", "a", "user", "by", "the", "given", "credentials", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/EloquentUserProvider.php#L106-L132
train
Retrieve a user by the given credentials
[ 30522, 2270, 3853, 12850, 3762, 16748, 16454, 26340, 1006, 9140, 1002, 22496, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 22496, 1007, 1064, 1064, 1006, 4175, 1006, 1002, 22496, 1007, 1027, 1027, 1027, 1015, 1004, 1004, 9140, 1035, 3145, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/API.php
API.getUsersSitesFromAccess
public function getUsersSitesFromAccess($access) { Piwik::checkUserHasSuperUserAccess(); $this->checkAccessType($access); $userSites = $this->model->getUsersSitesFromAccess($access); $userSites = $this->userFilter->filterLoginIndexedArray($userSites); return $userSites; }
php
public function getUsersSitesFromAccess($access) { Piwik::checkUserHasSuperUserAccess(); $this->checkAccessType($access); $userSites = $this->model->getUsersSitesFromAccess($access); $userSites = $this->userFilter->filterLoginIndexedArray($userSites); return $userSites; }
[ "public", "function", "getUsersSitesFromAccess", "(", "$", "access", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "$", "this", "->", "checkAccessType", "(", "$", "access", ")", ";", "$", "userSites", "=", "$", "this", "->", "model",...
For each user, returns the list of website IDs where the user has the supplied $access level. If a user doesn't have the given $access to any website IDs, the user will not be in the returned array. @param string Access can have the following values : 'view' or 'admin' @return array The returned array has the format array( login1 => array ( idsite1,idsite2), login2 => array(idsite2), ... )
[ "For", "each", "user", "returns", "the", "list", "of", "website", "IDs", "where", "the", "user", "has", "the", "supplied", "$access", "level", ".", "If", "a", "user", "doesn", "t", "have", "the", "given", "$access", "to", "any", "website", "IDs", "the", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L408-L418
train
Returns the list of all the sites that the user has the specified access.
[ 30522, 2270, 3853, 2131, 20330, 18719, 4570, 19699, 9626, 9468, 7971, 1006, 1002, 3229, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 4638, 6305...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.moveFile
public function moveFile($oldPath, $newPath, $isRename = false) { $oldPath = self::validatePath($oldPath); $fullOldPath = $this->getMediaPath($oldPath); $newPath = self::validatePath($newPath); $fullNewPath = $this->getMediaPath($newPath); return $this->getStorageDisk()->move($fullOldPath, $fullNewPath); }
php
public function moveFile($oldPath, $newPath, $isRename = false) { $oldPath = self::validatePath($oldPath); $fullOldPath = $this->getMediaPath($oldPath); $newPath = self::validatePath($newPath); $fullNewPath = $this->getMediaPath($newPath); return $this->getStorageDisk()->move($fullOldPath, $fullNewPath); }
[ "public", "function", "moveFile", "(", "$", "oldPath", ",", "$", "newPath", ",", "$", "isRename", "=", "false", ")", "{", "$", "oldPath", "=", "self", "::", "validatePath", "(", "$", "oldPath", ")", ";", "$", "fullOldPath", "=", "$", "this", "->", "g...
Moves a file to another location. @param string $oldPath Specifies the original path of the file. @param string $newPath Specifies the new path of the file. @return boolean
[ "Moves", "a", "file", "to", "another", "location", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L335-L344
train
Moves a file from one location to another location.
[ 30522, 2270, 3853, 2693, 8873, 2571, 1006, 1002, 2214, 15069, 1010, 1002, 2047, 15069, 1010, 1002, 2003, 7389, 14074, 1027, 6270, 1007, 1063, 1002, 2214, 15069, 1027, 2969, 1024, 1024, 9398, 3686, 15069, 1006, 1002, 2214, 15069, 1007, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
NumberFormatter.parse
public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0) { if (self::TYPE_DEFAULT == $type || self::TYPE_CURRENCY == $type) { trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); return false; } // Any invalid number at the end of the string is removed. // Only numbers and the fraction separator is expected in the string. // If grouping is used, grouping separator also becomes a valid character. $groupingMatch = $this->getAttribute(self::GROUPING_USED) ? '|(?P<grouping>\d++(,{1}\d+)++(\.\d*+)?)' : ''; if (preg_match("/^-?(?:\.\d++{$groupingMatch}|\d++(\.\d*+)?)/", $value, $matches)) { $value = $matches[0]; $position = \strlen($value); // value is not valid if grouping is used, but digits are not grouped in groups of three if ($error = isset($matches['grouping']) && !preg_match('/^-?(?:\d{1,3}+)?(?:(?:,\d{3})++|\d*+)(?:\.\d*+)?$/', $value)) { // the position on error is 0 for positive and 1 for negative numbers $position = 0 === strpos($value, '-') ? 1 : 0; } } else { $error = true; $position = 0; } if ($error) { IntlGlobals::setError(IntlGlobals::U_PARSE_ERROR, 'Number parsing failed'); $this->errorCode = IntlGlobals::getErrorCode(); $this->errorMessage = IntlGlobals::getErrorMessage(); return false; } $value = str_replace(',', '', $value); $value = $this->convertValueDataType($value, $type); // behave like the intl extension $this->resetError(); return $value; }
php
public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0) { if (self::TYPE_DEFAULT == $type || self::TYPE_CURRENCY == $type) { trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); return false; } // Any invalid number at the end of the string is removed. // Only numbers and the fraction separator is expected in the string. // If grouping is used, grouping separator also becomes a valid character. $groupingMatch = $this->getAttribute(self::GROUPING_USED) ? '|(?P<grouping>\d++(,{1}\d+)++(\.\d*+)?)' : ''; if (preg_match("/^-?(?:\.\d++{$groupingMatch}|\d++(\.\d*+)?)/", $value, $matches)) { $value = $matches[0]; $position = \strlen($value); // value is not valid if grouping is used, but digits are not grouped in groups of three if ($error = isset($matches['grouping']) && !preg_match('/^-?(?:\d{1,3}+)?(?:(?:,\d{3})++|\d*+)(?:\.\d*+)?$/', $value)) { // the position on error is 0 for positive and 1 for negative numbers $position = 0 === strpos($value, '-') ? 1 : 0; } } else { $error = true; $position = 0; } if ($error) { IntlGlobals::setError(IntlGlobals::U_PARSE_ERROR, 'Number parsing failed'); $this->errorCode = IntlGlobals::getErrorCode(); $this->errorMessage = IntlGlobals::getErrorMessage(); return false; } $value = str_replace(',', '', $value); $value = $this->convertValueDataType($value, $type); // behave like the intl extension $this->resetError(); return $value; }
[ "public", "function", "parse", "(", "$", "value", ",", "$", "type", "=", "self", "::", "TYPE_DOUBLE", ",", "&", "$", "position", "=", "0", ")", "{", "if", "(", "self", "::", "TYPE_DEFAULT", "==", "$", "type", "||", "self", "::", "TYPE_CURRENCY", "=="...
Parse a number. @param string $value The value to parse @param int $type Type of the formatting, one of the format type constants. NumberFormatter::TYPE_DOUBLE by default. @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended @return int|float|false The parsed value or false on error @see http://www.php.net/manual/en/numberformatter.parse.php
[ "Parse", "a", "number", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L509-L549
train
Parse the value and return the result
[ 30522, 2270, 3853, 11968, 3366, 1006, 1002, 3643, 1010, 1002, 2828, 1027, 2969, 1024, 1024, 2828, 1035, 3313, 1010, 1004, 1002, 2597, 1027, 1014, 1007, 1063, 2065, 1006, 2969, 1024, 1024, 2828, 1035, 12398, 1027, 1027, 1002, 2828, 1064, 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/Console/Gpm/InstallCommand.php
InstallCommand.installPackage
private function installPackage($package, $is_update = false) { $type = $package->package_type; Installer::install($this->file, $this->destination, ['install_path' => $package->install_path, 'theme' => $type === 'themes', 'is_update' => $is_update]); $error_code = Installer::lastErrorCode(); Folder::delete($this->tmp); if ($error_code) { $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(' |- Installing package... <red>error</red> '); $this->output->writeln(" | '- " . Installer::lastErrorMsg()); return false; } $message = Installer::getMessage(); if ($message) { $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(" |- {$message}"); } $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(' |- Installing package... <green>ok</green> '); return true; }
php
private function installPackage($package, $is_update = false) { $type = $package->package_type; Installer::install($this->file, $this->destination, ['install_path' => $package->install_path, 'theme' => $type === 'themes', 'is_update' => $is_update]); $error_code = Installer::lastErrorCode(); Folder::delete($this->tmp); if ($error_code) { $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(' |- Installing package... <red>error</red> '); $this->output->writeln(" | '- " . Installer::lastErrorMsg()); return false; } $message = Installer::getMessage(); if ($message) { $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(" |- {$message}"); } $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(' |- Installing package... <green>ok</green> '); return true; }
[ "private", "function", "installPackage", "(", "$", "package", ",", "$", "is_update", "=", "false", ")", "{", "$", "type", "=", "$", "package", "->", "package_type", ";", "Installer", "::", "install", "(", "$", "this", "->", "file", ",", "$", "this", "-...
Install a package @param Package $package @param bool $is_update True if it's an update. False if it's an install @return bool
[ "Install", "a", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L651-L680
train
Installs a package
[ 30522, 2797, 3853, 16500, 23947, 4270, 1006, 1002, 7427, 1010, 1002, 2003, 1035, 10651, 1027, 6270, 1007, 1063, 1002, 2828, 1027, 1002, 7427, 1011, 1028, 7427, 1035, 2828, 1025, 16500, 2121, 1024, 1024, 16500, 1006, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Concerns/ReplacesAttributes.php
ReplacesAttributes.replaceRequiredWithoutAll
protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) { return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); }
php
protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) { return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); }
[ "protected", "function", "replaceRequiredWithoutAll", "(", "$", "message", ",", "$", "attribute", ",", "$", "rule", ",", "$", "parameters", ")", "{", "return", "$", "this", "->", "replaceRequiredWith", "(", "$", "message", ",", "$", "attribute", ",", "$", ...
Replace all place-holders for the required_without_all rule. @param string $message @param string $attribute @param string $rule @param array $parameters @return string
[ "Replace", "all", "place", "-", "holders", "for", "the", "required_without_all", "rule", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php#L232-L235
train
Replace all place - holders for the required_without_all rule.
[ 30522, 5123, 3853, 5672, 2890, 15549, 5596, 24415, 5833, 8095, 1006, 1002, 4471, 1010, 1002, 17961, 1010, 1002, 3627, 1010, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.escapeString
public function escapeString($string) { if (func_num_args() < 2) { if (strpos($string, "\n") !== false) { return array('{' . strlen($string) . '}', $string); } else { return '"' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) . '"'; } } $result = array(); foreach (func_get_args() as $string) { $result[] = $this->escapeString($string); } return $result; }
php
public function escapeString($string) { if (func_num_args() < 2) { if (strpos($string, "\n") !== false) { return array('{' . strlen($string) . '}', $string); } else { return '"' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) . '"'; } } $result = array(); foreach (func_get_args() as $string) { $result[] = $this->escapeString($string); } return $result; }
[ "public", "function", "escapeString", "(", "$", "string", ")", "{", "if", "(", "func_num_args", "(", ")", "<", "2", ")", "{", "if", "(", "strpos", "(", "$", "string", ",", "\"\\n\"", ")", "!==", "false", ")", "{", "return", "array", "(", "'{'", "."...
escape one or more literals i.e. for sendRequest @param string|array $string the literal/-s @return string|array escape literals, literals with newline ar returned as array('{size}', 'string');
[ "escape", "one", "or", "more", "literals", "i", ".", "e", ".", "for", "sendRequest" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Imap.php#L400-L414
train
Escape string for use in the context of the current context
[ 30522, 2270, 3853, 12976, 18886, 3070, 1006, 1002, 5164, 1007, 1063, 2065, 1006, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, 1026, 1016, 1007, 1063, 2065, 1006, 2358, 14536, 2891, 1006, 1002, 5164, 1010, 1000, 1032, 1050, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Http/FileHelpers.php
FileHelpers.hashName
public function hashName($path = null) { if ($path) { $path = rtrim($path, '/').'/'; } $hash = $this->hashName ?: $this->hashName = Str::random(40); if ($extension = $this->guessExtension()) { $extension = '.'.$extension; } return $path.$hash.$extension; }
php
public function hashName($path = null) { if ($path) { $path = rtrim($path, '/').'/'; } $hash = $this->hashName ?: $this->hashName = Str::random(40); if ($extension = $this->guessExtension()) { $extension = '.'.$extension; } return $path.$hash.$extension; }
[ "public", "function", "hashName", "(", "$", "path", "=", "null", ")", "{", "if", "(", "$", "path", ")", "{", "$", "path", "=", "rtrim", "(", "$", "path", ",", "'/'", ")", ".", "'/'", ";", "}", "$", "hash", "=", "$", "this", "->", "hashName", ...
Get a filename for the file. @param string $path @return string
[ "Get", "a", "filename", "for", "the", "file", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/FileHelpers.php#L42-L55
train
Returns a unique name for the current file
[ 30522, 2270, 3853, 23325, 18442, 1006, 1002, 4130, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 19387, 20026, 1006, 1002, 4130, 1010, 1005, 1013, 1005, 1007, 1012, 1005, 1013, 1005, 1025, 1065, 1002, 23325,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Installation/Controller.php
Controller.firstWebsiteSetup
public function firstWebsiteSetup() { $this->checkPiwikIsNotInstalled(); ServerFilesGenerator::createFilesForSecurity(); $siteIdsCount = Access::doAsSuperUser(function () { return count(APISitesManager::getInstance()->getAllSitesId()); }); if ($siteIdsCount > 0) { // if there is a already a website, skip this step and trackingCode step $this->redirectToNextStep('trackingCode'); } $view = new View( '@Installation/firstWebsiteSetup', $this->getInstallationSteps(), __FUNCTION__ ); $form = new FormFirstWebsiteSetup(); if ($form->validate()) { $name = Common::sanitizeInputValue($form->getSubmitValue('siteName')); $url = Common::unsanitizeInputValue($form->getSubmitValue('url')); $ecommerce = (int)$form->getSubmitValue('ecommerce'); try { $result = Access::doAsSuperUser(function () use ($name, $url, $ecommerce) { return APISitesManager::getInstance()->addSite($name, $url, $ecommerce); }); $params = array( 'site_idSite' => $result, 'site_name' => urlencode($name) ); $this->addTrustedHosts($url); $this->redirectToNextStep(__FUNCTION__, $params); } catch (Exception $e) { $view->errorMessage = $e->getMessage(); } } // Display previous step success message, when current step form was not submitted yet if (count($form->getErrorMessages()) == 0) { $view->displayGeneralSetupSuccess = true; } $view->addForm($form); return $view->render(); }
php
public function firstWebsiteSetup() { $this->checkPiwikIsNotInstalled(); ServerFilesGenerator::createFilesForSecurity(); $siteIdsCount = Access::doAsSuperUser(function () { return count(APISitesManager::getInstance()->getAllSitesId()); }); if ($siteIdsCount > 0) { // if there is a already a website, skip this step and trackingCode step $this->redirectToNextStep('trackingCode'); } $view = new View( '@Installation/firstWebsiteSetup', $this->getInstallationSteps(), __FUNCTION__ ); $form = new FormFirstWebsiteSetup(); if ($form->validate()) { $name = Common::sanitizeInputValue($form->getSubmitValue('siteName')); $url = Common::unsanitizeInputValue($form->getSubmitValue('url')); $ecommerce = (int)$form->getSubmitValue('ecommerce'); try { $result = Access::doAsSuperUser(function () use ($name, $url, $ecommerce) { return APISitesManager::getInstance()->addSite($name, $url, $ecommerce); }); $params = array( 'site_idSite' => $result, 'site_name' => urlencode($name) ); $this->addTrustedHosts($url); $this->redirectToNextStep(__FUNCTION__, $params); } catch (Exception $e) { $view->errorMessage = $e->getMessage(); } } // Display previous step success message, when current step form was not submitted yet if (count($form->getErrorMessages()) == 0) { $view->displayGeneralSetupSuccess = true; } $view->addForm($form); return $view->render(); }
[ "public", "function", "firstWebsiteSetup", "(", ")", "{", "$", "this", "->", "checkPiwikIsNotInstalled", "(", ")", ";", "ServerFilesGenerator", "::", "createFilesForSecurity", "(", ")", ";", "$", "siteIdsCount", "=", "Access", "::", "doAsSuperUser", "(", "function...
Installation Step 6: Configure first web-site
[ "Installation", "Step", "6", ":", "Configure", "first", "web", "-", "site" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/Controller.php#L300-L352
train
Displays the first website setup screen
[ 30522, 2270, 3853, 2034, 8545, 5910, 7616, 3388, 6279, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4638, 8197, 9148, 14270, 17048, 7076, 9080, 3709, 1006, 1007, 1025, 8241, 8873, 4244, 6914, 6906, 4263, 1024, 1024, 3443, 8873, 4244, 29278, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Cookie/SessionCookieJar.php
SessionCookieJar.load
protected function load() { if (!isset($_SESSION[$this->sessionKey])) { return; } $data = json_decode($_SESSION[$this->sessionKey], true); if (is_array($data)) { foreach ($data as $cookie) { $this->setCookie(new SetCookie($cookie)); } } elseif (strlen($data)) { throw new \RuntimeException("Invalid cookie data"); } }
php
protected function load() { if (!isset($_SESSION[$this->sessionKey])) { return; } $data = json_decode($_SESSION[$this->sessionKey], true); if (is_array($data)) { foreach ($data as $cookie) { $this->setCookie(new SetCookie($cookie)); } } elseif (strlen($data)) { throw new \RuntimeException("Invalid cookie data"); } }
[ "protected", "function", "load", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "_SESSION", "[", "$", "this", "->", "sessionKey", "]", ")", ")", "{", "return", ";", "}", "$", "data", "=", "json_decode", "(", "$", "_SESSION", "[", "$", "this", ...
Load the contents of the client session into the data array
[ "Load", "the", "contents", "of", "the", "client", "session", "into", "the", "data", "array" ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/SessionCookieJar.php#L57-L70
train
Load session data
[ 30522, 5123, 3853, 7170, 1006, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 1035, 5219, 1031, 1002, 2023, 1011, 1028, 5219, 14839, 1033, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 2951, 1027, 1046, 3385, 1035, 21933, 3207, 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...
symfony/symfony
src/Symfony/Component/Console/Helper/QuestionHelper.php
QuestionHelper.ask
public function ask(InputInterface $input, OutputInterface $output, Question $question) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } if (!$input->isInteractive()) { $default = $question->getDefault(); if (null === $default) { return $default; } if ($validator = $question->getValidator()) { return \call_user_func($question->getValidator(), $default); } elseif ($question instanceof ChoiceQuestion) { $choices = $question->getChoices(); if (!$question->isMultiselect()) { return isset($choices[$default]) ? $choices[$default] : $default; } $default = explode(',', $default); foreach ($default as $k => $v) { $v = trim($v); $default[$k] = isset($choices[$v]) ? $choices[$v] : $v; } } return $default; } if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) { $this->inputStream = $stream; } if (!$question->getValidator()) { return $this->doAsk($output, $question); } $interviewer = function () use ($output, $question) { return $this->doAsk($output, $question); }; return $this->validateAttempts($interviewer, $output, $question); }
php
public function ask(InputInterface $input, OutputInterface $output, Question $question) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } if (!$input->isInteractive()) { $default = $question->getDefault(); if (null === $default) { return $default; } if ($validator = $question->getValidator()) { return \call_user_func($question->getValidator(), $default); } elseif ($question instanceof ChoiceQuestion) { $choices = $question->getChoices(); if (!$question->isMultiselect()) { return isset($choices[$default]) ? $choices[$default] : $default; } $default = explode(',', $default); foreach ($default as $k => $v) { $v = trim($v); $default[$k] = isset($choices[$v]) ? $choices[$v] : $v; } } return $default; } if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) { $this->inputStream = $stream; } if (!$question->getValidator()) { return $this->doAsk($output, $question); } $interviewer = function () use ($output, $question) { return $this->doAsk($output, $question); }; return $this->validateAttempts($interviewer, $output, $question); }
[ "public", "function", "ask", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "Question", "$", "question", ")", "{", "if", "(", "$", "output", "instanceof", "ConsoleOutputInterface", ")", "{", "$", "output", "=", "$", "output"...
Asks a question to the user. @return mixed The user answer @throws RuntimeException If there is no data to read in the input stream
[ "Asks", "a", "question", "to", "the", "user", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/QuestionHelper.php#L43-L88
train
Ask the user for a question.
[ 30522, 2270, 3853, 3198, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1010, 3160, 1002, 3160, 1007, 1063, 2065, 1006, 1002, 6434, 6013, 11253, 10122, 5833, 18780, 18447, 2121, 12172, 1007, 1063, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/FrameDecorator/AbstractFrameDecorator.php
AbstractFrameDecorator.remove_child
function remove_child(Frame $child, $update_node = true) { while ($child instanceof AbstractFrameDecorator) { $child = $child->_frame; } return $this->_frame->remove_child($child, $update_node); }
php
function remove_child(Frame $child, $update_node = true) { while ($child instanceof AbstractFrameDecorator) { $child = $child->_frame; } return $this->_frame->remove_child($child, $update_node); }
[ "function", "remove_child", "(", "Frame", "$", "child", ",", "$", "update_node", "=", "true", ")", "{", "while", "(", "$", "child", "instanceof", "AbstractFrameDecorator", ")", "{", "$", "child", "=", "$", "child", "->", "_frame", ";", "}", "return", "$"...
@param Frame $child @param bool $update_node @return Frame
[ "@param", "Frame", "$child", "@param", "bool", "$update_node" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameDecorator/AbstractFrameDecorator.php#L431-L438
train
Remove a child frame
[ 30522, 3853, 6366, 1035, 2775, 1006, 4853, 1002, 2775, 1010, 1002, 10651, 1035, 13045, 1027, 2995, 1007, 1063, 2096, 1006, 1002, 2775, 6013, 11253, 10061, 15643, 3207, 27108, 8844, 1007, 1063, 1002, 2775, 1027, 1002, 2775, 1011, 1028, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SegmentEditor/Model.php
Model.getAllSegmentsForSite
public function getAllSegmentsForSite($idSite, $userLogin) { $bind = array($idSite, $userLogin); $sql = $this->buildQuerySortedByName('(enable_only_idsite = ? OR enable_only_idsite = 0) AND deleted = 0 AND (enable_all_users = 1 OR login = ?)'); $segments = $this->getDb()->fetchAll($sql, $bind); return $segments; }
php
public function getAllSegmentsForSite($idSite, $userLogin) { $bind = array($idSite, $userLogin); $sql = $this->buildQuerySortedByName('(enable_only_idsite = ? OR enable_only_idsite = 0) AND deleted = 0 AND (enable_all_users = 1 OR login = ?)'); $segments = $this->getDb()->fetchAll($sql, $bind); return $segments; }
[ "public", "function", "getAllSegmentsForSite", "(", "$", "idSite", ",", "$", "userLogin", ")", "{", "$", "bind", "=", "array", "(", "$", "idSite", ",", "$", "userLogin", ")", ";", "$", "sql", "=", "$", "this", "->", "buildQuerySortedByName", "(", "'(enab...
Returns all stored segments that are available for the given site and login. @param string $userLogin @param int $idSite Whether to return stored segments for a specific idSite, or all of them. If supplied, must be a valid site ID. @return array
[ "Returns", "all", "stored", "segments", "that", "are", "available", "for", "the", "given", "site", "and", "login", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/Model.php#L90-L99
train
Get all segments for a site and a user
[ 30522, 2270, 3853, 2131, 8095, 3366, 21693, 11187, 29278, 28032, 2063, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 5310, 21197, 2378, 1007, 1063, 1002, 14187, 1027, 9140, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 5310, 21197, 2378, 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/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
TextDescriptor.describeContainerTags
protected function describeContainerTags(ContainerBuilder $builder, array $options = []) { $showHidden = isset($options['show_hidden']) && $options['show_hidden']; if ($showHidden) { $options['output']->title('Symfony Container Hidden Tags'); } else { $options['output']->title('Symfony Container Tags'); } foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) { $options['output']->section(sprintf('"%s" tag', $tag)); $options['output']->listing(array_keys($definitions)); } }
php
protected function describeContainerTags(ContainerBuilder $builder, array $options = []) { $showHidden = isset($options['show_hidden']) && $options['show_hidden']; if ($showHidden) { $options['output']->title('Symfony Container Hidden Tags'); } else { $options['output']->title('Symfony Container Tags'); } foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) { $options['output']->section(sprintf('"%s" tag', $tag)); $options['output']->listing(array_keys($definitions)); } }
[ "protected", "function", "describeContainerTags", "(", "ContainerBuilder", "$", "builder", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "showHidden", "=", "isset", "(", "$", "options", "[", "'show_hidden'", "]", ")", "&&", "$", "options", "[...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php#L133-L147
train
Describes the container tags
[ 30522, 5123, 3853, 6235, 8663, 18249, 8743, 26454, 1006, 11661, 8569, 23891, 2099, 1002, 12508, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2265, 27511, 4181, 1027, 26354, 3388, 1006, 1002, 7047, 1031, 1005, 2265, 1035, 5023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Loader/YamlFileLoader.php
YamlFileLoader.load
public function load($file, $type = null) { $path = $this->locator->locate($file); if (!stream_is_local($path)) { throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path)); } if (!file_exists($path)) { throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path)); } if (null === $this->yamlParser) { $this->yamlParser = new YamlParser(); } try { $parsedConfig = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT); } catch (ParseException $e) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e); } $collection = new RouteCollection(); $collection->addResource(new FileResource($path)); // empty file if (null === $parsedConfig) { return $collection; } // not an array if (!\is_array($parsedConfig)) { throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); } foreach ($parsedConfig as $name => $config) { $this->validate($config, $name, $path); if (isset($config['resource'])) { $this->parseImport($collection, $config, $path, $file); } else { $this->parseRoute($collection, $name, $config, $path); } } return $collection; }
php
public function load($file, $type = null) { $path = $this->locator->locate($file); if (!stream_is_local($path)) { throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path)); } if (!file_exists($path)) { throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path)); } if (null === $this->yamlParser) { $this->yamlParser = new YamlParser(); } try { $parsedConfig = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT); } catch (ParseException $e) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e); } $collection = new RouteCollection(); $collection->addResource(new FileResource($path)); // empty file if (null === $parsedConfig) { return $collection; } // not an array if (!\is_array($parsedConfig)) { throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); } foreach ($parsedConfig as $name => $config) { $this->validate($config, $name, $path); if (isset($config['resource'])) { $this->parseImport($collection, $config, $path, $file); } else { $this->parseRoute($collection, $name, $config, $path); } } return $collection; }
[ "public", "function", "load", "(", "$", "file", ",", "$", "type", "=", "null", ")", "{", "$", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", "file", ")", ";", "if", "(", "!", "stream_is_local", "(", "$", "path", ")", ")", ...
Loads a Yaml file. @param string $file A Yaml file path @param string|null $type The resource type @return RouteCollection A RouteCollection instance @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid
[ "Loads", "a", "Yaml", "file", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/YamlFileLoader.php#L45-L91
train
Load a YAML file into a RouteCollection
[ 30522, 2270, 3853, 7170, 1006, 1002, 5371, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 8840, 11266, 2953, 1011, 1028, 12453, 1006, 1002, 5371, 1007, 1025, 2065, 1006, 999, 5460, 1035, 2003, 1035, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php
ResettableServicePass.process
public function process(ContainerBuilder $container) { if (!$container->has('services_resetter')) { return; } $services = $methods = []; foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) { $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE); $attributes = $tags[0]; if (!isset($attributes['method'])) { throw new RuntimeException(sprintf('Tag %s requires the "method" attribute to be set.', $this->tagName)); } $methods[$id] = $attributes['method']; } if (empty($services)) { $container->removeAlias('services_resetter'); $container->removeDefinition('services_resetter'); return; } $container->findDefinition('services_resetter') ->setArgument(0, new IteratorArgument($services)) ->setArgument(1, $methods); }
php
public function process(ContainerBuilder $container) { if (!$container->has('services_resetter')) { return; } $services = $methods = []; foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) { $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE); $attributes = $tags[0]; if (!isset($attributes['method'])) { throw new RuntimeException(sprintf('Tag %s requires the "method" attribute to be set.', $this->tagName)); } $methods[$id] = $attributes['method']; } if (empty($services)) { $container->removeAlias('services_resetter'); $container->removeDefinition('services_resetter'); return; } $container->findDefinition('services_resetter') ->setArgument(0, new IteratorArgument($services)) ->setArgument(1, $methods); }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "if", "(", "!", "$", "container", "->", "has", "(", "'services_resetter'", ")", ")", "{", "return", ";", "}", "$", "services", "=", "$", "methods", "=", "[", "]", ";"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php#L36-L65
train
Adds services resetter to the container
[ 30522, 2270, 3853, 2832, 1006, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 2065, 1006, 999, 1002, 11661, 1011, 1028, 2038, 1006, 1005, 2578, 1035, 25141, 3334, 1005, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 2578, 1027, 1002, 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...
symfony/symfony
src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
TraceableEventDispatcher.getNotCalledListeners
public function getNotCalledListeners(/* Request $request = null */) { try { $allListeners = $this->getListeners(); } catch (\Exception $e) { if (null !== $this->logger) { $this->logger->info('An exception was thrown while getting the uncalled listeners.', ['exception' => $e]); } // unable to retrieve the uncalled listeners return []; } $hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null; $notCalled = []; foreach ($allListeners as $eventName => $listeners) { foreach ($listeners as $listener) { $called = false; if (null !== $this->callStack) { foreach ($this->callStack as $calledListener) { list(, $requestHash) = $this->callStack->getInfo(); if ((null === $hash || $hash === $requestHash) && $calledListener->getWrappedListener() === $listener) { $called = true; break; } } } if (!$called) { if (!$listener instanceof WrappedListener) { $listener = new WrappedListener($listener, null, $this->stopwatch, $this); } $notCalled[] = $listener->getInfo($eventName); } } } uasort($notCalled, [$this, 'sortNotCalledListeners']); return $notCalled; }
php
public function getNotCalledListeners(/* Request $request = null */) { try { $allListeners = $this->getListeners(); } catch (\Exception $e) { if (null !== $this->logger) { $this->logger->info('An exception was thrown while getting the uncalled listeners.', ['exception' => $e]); } // unable to retrieve the uncalled listeners return []; } $hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null; $notCalled = []; foreach ($allListeners as $eventName => $listeners) { foreach ($listeners as $listener) { $called = false; if (null !== $this->callStack) { foreach ($this->callStack as $calledListener) { list(, $requestHash) = $this->callStack->getInfo(); if ((null === $hash || $hash === $requestHash) && $calledListener->getWrappedListener() === $listener) { $called = true; break; } } } if (!$called) { if (!$listener instanceof WrappedListener) { $listener = new WrappedListener($listener, null, $this->stopwatch, $this); } $notCalled[] = $listener->getInfo($eventName); } } } uasort($notCalled, [$this, 'sortNotCalledListeners']); return $notCalled; }
[ "public", "function", "getNotCalledListeners", "(", "/* Request $request = null */", ")", "{", "try", "{", "$", "allListeners", "=", "$", "this", "->", "getListeners", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "if", "(", "nul...
{@inheritdoc} @param Request|null $request The request to get listeners for
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L213-L254
train
Returns all not called listeners
[ 30522, 2270, 3853, 2131, 17048, 9289, 3709, 9863, 24454, 2015, 1006, 1013, 1008, 5227, 1002, 5227, 1027, 19701, 1008, 1013, 1007, 1063, 3046, 1063, 1002, 2035, 9863, 24454, 2015, 1027, 1002, 2023, 1011, 1028, 2131, 9863, 24454, 2015, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/ServiceProvider.php
ServiceProvider.registerBackendWidgets
protected function registerBackendWidgets() { WidgetManager::instance()->registerFormWidgets(function ($manager) { $manager->registerFormWidget('Backend\FormWidgets\CodeEditor', 'codeeditor'); $manager->registerFormWidget('Backend\FormWidgets\RichEditor', 'richeditor'); $manager->registerFormWidget('Backend\FormWidgets\MarkdownEditor', 'markdown'); $manager->registerFormWidget('Backend\FormWidgets\FileUpload', 'fileupload'); $manager->registerFormWidget('Backend\FormWidgets\Relation', 'relation'); $manager->registerFormWidget('Backend\FormWidgets\DatePicker', 'datepicker'); $manager->registerFormWidget('Backend\FormWidgets\TimePicker', 'timepicker'); $manager->registerFormWidget('Backend\FormWidgets\ColorPicker', 'colorpicker'); $manager->registerFormWidget('Backend\FormWidgets\DataTable', 'datatable'); $manager->registerFormWidget('Backend\FormWidgets\RecordFinder', 'recordfinder'); $manager->registerFormWidget('Backend\FormWidgets\Repeater', 'repeater'); $manager->registerFormWidget('Backend\FormWidgets\TagList', 'taglist'); $manager->registerFormWidget('Backend\FormWidgets\MediaFinder', 'mediafinder'); $manager->registerFormWidget('Backend\FormWidgets\NestedForm', 'nestedform'); }); }
php
protected function registerBackendWidgets() { WidgetManager::instance()->registerFormWidgets(function ($manager) { $manager->registerFormWidget('Backend\FormWidgets\CodeEditor', 'codeeditor'); $manager->registerFormWidget('Backend\FormWidgets\RichEditor', 'richeditor'); $manager->registerFormWidget('Backend\FormWidgets\MarkdownEditor', 'markdown'); $manager->registerFormWidget('Backend\FormWidgets\FileUpload', 'fileupload'); $manager->registerFormWidget('Backend\FormWidgets\Relation', 'relation'); $manager->registerFormWidget('Backend\FormWidgets\DatePicker', 'datepicker'); $manager->registerFormWidget('Backend\FormWidgets\TimePicker', 'timepicker'); $manager->registerFormWidget('Backend\FormWidgets\ColorPicker', 'colorpicker'); $manager->registerFormWidget('Backend\FormWidgets\DataTable', 'datatable'); $manager->registerFormWidget('Backend\FormWidgets\RecordFinder', 'recordfinder'); $manager->registerFormWidget('Backend\FormWidgets\Repeater', 'repeater'); $manager->registerFormWidget('Backend\FormWidgets\TagList', 'taglist'); $manager->registerFormWidget('Backend\FormWidgets\MediaFinder', 'mediafinder'); $manager->registerFormWidget('Backend\FormWidgets\NestedForm', 'nestedform'); }); }
[ "protected", "function", "registerBackendWidgets", "(", ")", "{", "WidgetManager", "::", "instance", "(", ")", "->", "registerFormWidgets", "(", "function", "(", "$", "manager", ")", "{", "$", "manager", "->", "registerFormWidget", "(", "'Backend\\FormWidgets\\CodeE...
/* Register widgets
[ "/", "*", "Register", "widgets" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/ServiceProvider.php#L171-L189
train
Register backend widgets
[ 30522, 5123, 3853, 4236, 5963, 10497, 9148, 28682, 1006, 1007, 1063, 15536, 24291, 24805, 4590, 1024, 1024, 6013, 1006, 1007, 1011, 1028, 4236, 14192, 9148, 28682, 1006, 3853, 1006, 1002, 3208, 1007, 1063, 1002, 3208, 1011, 1028, 4236, 1419...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...