repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
laravel/framework
src/Illuminate/Foundation/Console/VendorPublishCommand.php
VendorPublishCommand.publishTag
protected function publishTag($tag) { foreach ($this->pathsToPublish($tag) as $from => $to) { $this->publishItem($from, $to); } }
php
protected function publishTag($tag) { foreach ($this->pathsToPublish($tag) as $from => $to) { $this->publishItem($from, $to); } }
[ "protected", "function", "publishTag", "(", "$", "tag", ")", "{", "foreach", "(", "$", "this", "->", "pathsToPublish", "(", "$", "tag", ")", "as", "$", "from", "=>", "$", "to", ")", "{", "$", "this", "->", "publishItem", "(", "$", "from", ",", "$",...
Publishes the assets for a tag. @param string $tag @return mixed
[ "Publishes", "the", "assets", "for", "a", "tag", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/VendorPublishCommand.php#L158-L163
train
Publishes items for a tag
[ 30522, 5123, 3853, 10172, 15900, 1006, 1002, 6415, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 10425, 14399, 12083, 13602, 1006, 1002, 6415, 1007, 2004, 1002, 2013, 1027, 1028, 1002, 2000, 1007, 1063, 1002, 2023, 1011, 1028, 1017...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Cache.php
Cache.regenerateCacheWebsiteAttributes
public static function regenerateCacheWebsiteAttributes($idSites = array()) { if (!is_array($idSites)) { $idSites = array($idSites); } foreach ($idSites as $idSite) { self::deleteCacheWebsiteAttributes($idSite); self::getCacheWebsiteAttributes($idSite); } }
php
public static function regenerateCacheWebsiteAttributes($idSites = array()) { if (!is_array($idSites)) { $idSites = array($idSites); } foreach ($idSites as $idSite) { self::deleteCacheWebsiteAttributes($idSite); self::getCacheWebsiteAttributes($idSite); } }
[ "public", "static", "function", "regenerateCacheWebsiteAttributes", "(", "$", "idSites", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "idSites", ")", ")", "{", "$", "idSites", "=", "array", "(", "$", "idSites", ")", ";", "}",...
Regenerate Tracker cache files @param array|int $idSites Array of idSites to clear cache for
[ "Regenerate", "Tracker", "cache", "files" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Cache.php#L189-L199
train
Regenerates all cache website attributes for the given sites
[ 30522, 2270, 10763, 3853, 19723, 24454, 3686, 3540, 5403, 8545, 5910, 4221, 19321, 3089, 8569, 4570, 1006, 1002, 8909, 28032, 2229, 1027, 9140, 1006, 1007, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 8909, 28032, 2229, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Request.php
Request.getUserInfo
public function getUserInfo() { $userinfo = $this->getUser(); $pass = $this->getPassword(); if ('' != $pass) { $userinfo .= ":$pass"; } return $userinfo; }
php
public function getUserInfo() { $userinfo = $this->getUser(); $pass = $this->getPassword(); if ('' != $pass) { $userinfo .= ":$pass"; } return $userinfo; }
[ "public", "function", "getUserInfo", "(", ")", "{", "$", "userinfo", "=", "$", "this", "->", "getUser", "(", ")", ";", "$", "pass", "=", "$", "this", "->", "getPassword", "(", ")", ";", "if", "(", "''", "!=", "$", "pass", ")", "{", "$", "userinfo...
Gets the user info. @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server
[ "Gets", "the", "user", "info", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L948-L958
train
Get User Info
[ 30522, 2270, 3853, 2131, 20330, 2378, 14876, 1006, 1007, 1063, 1002, 30524, 3413, 1027, 1002, 2023, 1011, 1028, 2131, 15194, 18351, 1006, 1007, 1025, 2065, 1006, 1005, 1005, 999, 1027, 1002, 3413, 1007, 1063, 1002, 5310, 2378, 14876, 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...
octobercms/october
modules/backend/widgets/Form.php
Form.getFieldDepends
protected function getFieldDepends($field) { if (!$field->dependsOn) { return ''; } $dependsOn = is_array($field->dependsOn) ? $field->dependsOn : [$field->dependsOn]; $dependsOn = htmlspecialchars(json_encode($dependsOn), ENT_QUOTES, 'UTF-8'); return $dependsOn; }
php
protected function getFieldDepends($field) { if (!$field->dependsOn) { return ''; } $dependsOn = is_array($field->dependsOn) ? $field->dependsOn : [$field->dependsOn]; $dependsOn = htmlspecialchars(json_encode($dependsOn), ENT_QUOTES, 'UTF-8'); return $dependsOn; }
[ "protected", "function", "getFieldDepends", "(", "$", "field", ")", "{", "if", "(", "!", "$", "field", "->", "dependsOn", ")", "{", "return", "''", ";", "}", "$", "dependsOn", "=", "is_array", "(", "$", "field", "->", "dependsOn", ")", "?", "$", "fie...
Returns a HTML encoded value containing the other fields this field depends on @param \Backend\Classes\FormField $field @return string
[ "Returns", "a", "HTML", "encoded", "value", "containing", "the", "other", "fields", "this", "field", "depends", "on" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L1090-L1099
train
Get field depends on
[ 30522, 5123, 3853, 2131, 3790, 3207, 11837, 5104, 1006, 1002, 2492, 1007, 1063, 2065, 1006, 999, 1002, 2492, 1011, 1028, 9041, 2239, 1007, 1063, 2709, 1005, 1005, 1025, 1065, 1002, 9041, 2239, 1027, 2003, 1035, 9140, 1006, 1002, 2492, 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...
laravel/framework
src/Illuminate/Routing/Route.php
Route.controllerMiddleware
public function controllerMiddleware() { if (! $this->isControllerAction()) { return []; } return $this->controllerDispatcher()->getMiddleware( $this->getController(), $this->getControllerMethod() ); }
php
public function controllerMiddleware() { if (! $this->isControllerAction()) { return []; } return $this->controllerDispatcher()->getMiddleware( $this->getController(), $this->getControllerMethod() ); }
[ "public", "function", "controllerMiddleware", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isControllerAction", "(", ")", ")", "{", "return", "[", "]", ";", "}", "return", "$", "this", "->", "controllerDispatcher", "(", ")", "->", "getMiddleware", ...
Get the middleware for the route's controller. @return array
[ "Get", "the", "middleware", "for", "the", "route", "s", "controller", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Route.php#L826-L835
train
Return the middleware for the controller action
[ 30522, 2270, 3853, 11486, 4328, 20338, 8059, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2003, 8663, 13181, 10820, 18908, 3258, 1006, 1007, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 11486, 10521,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/XmlDescriptor.php
XmlDescriptor.describeRoute
protected function describeRoute(Route $route, array $options = []) { $this->writeDocument($this->getRouteDocument($route, isset($options['name']) ? $options['name'] : null)); }
php
protected function describeRoute(Route $route, array $options = []) { $this->writeDocument($this->getRouteDocument($route, isset($options['name']) ? $options['name'] : null)); }
[ "protected", "function", "describeRoute", "(", "Route", "$", "route", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "writeDocument", "(", "$", "this", "->", "getRouteDocument", "(", "$", "route", ",", "isset", "(", "$", "opt...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php#L45-L48
train
Describes a route
[ 30522, 5123, 3853, 6235, 22494, 2618, 1006, 2799, 1002, 2799, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 4339, 3527, 24894, 4765, 1006, 1002, 2023, 1011, 1028, 2131, 25849, 10085, 27417, 2102, 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/Extension/Core/Type/DateTimeType.php
DateTimeType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $compound = function (Options $options) { return 'single_text' !== $options['widget']; }; // Defaults to the value of "widget" $dateWidget = function (Options $options) { return 'single_text' === $options['widget'] ? null : $options['widget']; }; // Defaults to the value of "widget" $timeWidget = function (Options $options) { return 'single_text' === $options['widget'] ? null : $options['widget']; }; $resolver->setDefaults([ 'input' => 'datetime', 'model_timezone' => null, 'view_timezone' => null, 'format' => self::HTML5_FORMAT, 'date_format' => null, 'widget' => null, 'date_widget' => $dateWidget, 'time_widget' => $timeWidget, 'with_minutes' => true, 'with_seconds' => false, 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, 'error_bubbling' => false, // If initialized with a \DateTime object, FormType initializes // this option to "\DateTime". Since the internal, normalized // representation is not \DateTime, but an array, we need to unset // this option. 'data_class' => null, 'compound' => $compound, 'date_label' => null, 'time_label' => null, 'empty_data' => function (Options $options) { return $options['compound'] ? [] : ''; }, 'input_format' => 'Y-m-d H:i:s', ]); // Don't add some defaults in order to preserve the defaults // set in DateType and TimeType $resolver->setDefined([ 'placeholder', 'choice_translation_domain', 'years', 'months', 'days', 'hours', 'minutes', 'seconds', ]); $resolver->setAllowedValues('input', [ 'datetime', 'datetime_immutable', 'string', 'timestamp', 'array', ]); $resolver->setAllowedValues('date_widget', [ null, // inherit default from DateType 'single_text', 'text', 'choice', ]); $resolver->setAllowedValues('time_widget', [ null, // inherit default from TimeType 'single_text', 'text', 'choice', ]); // This option will overwrite "date_widget" and "time_widget" options $resolver->setAllowedValues('widget', [ null, // default, don't overwrite options 'single_text', 'text', 'choice', ]); $resolver->setAllowedTypes('input_format', 'string'); $resolver->setDeprecated('date_format', function (Options $options, $dateFormat) { if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { return sprintf('Using the "date_format" option of %s with an HTML5 date widget is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "date_format" option of the %s with an HTML5 date.', self::class)); } return ''; }); $resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) { if (null !== $dateWidget && 'single_text' === $options['widget']) { return sprintf('Using the "date_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "date_widget" option of the %s when the "widget" option is set to "single_text".', self::class)); } return ''; }); $resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) { if (null !== $timeWidget && 'single_text' === $options['widget']) { return sprintf('Using the "time_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "time_widget" option of the %s when the "widget" option is set to "single_text".', self::class)); } return ''; }); $resolver->setDeprecated('html5', function (Options $options, $html5) { if ($html5 && self::HTML5_FORMAT !== $options['format']) { return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class)); } return ''; }); }
php
public function configureOptions(OptionsResolver $resolver) { $compound = function (Options $options) { return 'single_text' !== $options['widget']; }; // Defaults to the value of "widget" $dateWidget = function (Options $options) { return 'single_text' === $options['widget'] ? null : $options['widget']; }; // Defaults to the value of "widget" $timeWidget = function (Options $options) { return 'single_text' === $options['widget'] ? null : $options['widget']; }; $resolver->setDefaults([ 'input' => 'datetime', 'model_timezone' => null, 'view_timezone' => null, 'format' => self::HTML5_FORMAT, 'date_format' => null, 'widget' => null, 'date_widget' => $dateWidget, 'time_widget' => $timeWidget, 'with_minutes' => true, 'with_seconds' => false, 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, 'error_bubbling' => false, // If initialized with a \DateTime object, FormType initializes // this option to "\DateTime". Since the internal, normalized // representation is not \DateTime, but an array, we need to unset // this option. 'data_class' => null, 'compound' => $compound, 'date_label' => null, 'time_label' => null, 'empty_data' => function (Options $options) { return $options['compound'] ? [] : ''; }, 'input_format' => 'Y-m-d H:i:s', ]); // Don't add some defaults in order to preserve the defaults // set in DateType and TimeType $resolver->setDefined([ 'placeholder', 'choice_translation_domain', 'years', 'months', 'days', 'hours', 'minutes', 'seconds', ]); $resolver->setAllowedValues('input', [ 'datetime', 'datetime_immutable', 'string', 'timestamp', 'array', ]); $resolver->setAllowedValues('date_widget', [ null, // inherit default from DateType 'single_text', 'text', 'choice', ]); $resolver->setAllowedValues('time_widget', [ null, // inherit default from TimeType 'single_text', 'text', 'choice', ]); // This option will overwrite "date_widget" and "time_widget" options $resolver->setAllowedValues('widget', [ null, // default, don't overwrite options 'single_text', 'text', 'choice', ]); $resolver->setAllowedTypes('input_format', 'string'); $resolver->setDeprecated('date_format', function (Options $options, $dateFormat) { if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { return sprintf('Using the "date_format" option of %s with an HTML5 date widget is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "date_format" option of the %s with an HTML5 date.', self::class)); } return ''; }); $resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) { if (null !== $dateWidget && 'single_text' === $options['widget']) { return sprintf('Using the "date_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "date_widget" option of the %s when the "widget" option is set to "single_text".', self::class)); } return ''; }); $resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) { if (null !== $timeWidget && 'single_text' === $options['widget']) { return sprintf('Using the "time_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "time_widget" option of the %s when the "widget" option is set to "single_text".', self::class)); } return ''; }); $resolver->setDeprecated('html5', function (Options $options, $html5) { if ($html5 && self::HTML5_FORMAT !== $options['format']) { return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class)); } return ''; }); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "compound", "=", "function", "(", "Options", "$", "options", ")", "{", "return", "'single_text'", "!==", "$", "options", "[", "'widget'", "]", ";", "}", ";", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php#L215-L335
train
Configures the options for the FormType
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 1002, 10663, 2099, 1007, 1063, 1002, 7328, 1027, 3853, 1006, 7047, 1002, 7047, 1007, 1063, 2709, 1005, 2309, 1035, 3793, 1005, 999, 1027, 1027, 1002, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php
CachingFactoryDecorator.createListFromLoader
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null) { $hash = self::generateHash([$loader, $value], 'fromLoader'); if (!isset($this->lists[$hash])) { $this->lists[$hash] = $this->decoratedFactory->createListFromLoader($loader, $value); } return $this->lists[$hash]; }
php
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null) { $hash = self::generateHash([$loader, $value], 'fromLoader'); if (!isset($this->lists[$hash])) { $this->lists[$hash] = $this->decoratedFactory->createListFromLoader($loader, $value); } return $this->lists[$hash]; }
[ "public", "function", "createListFromLoader", "(", "ChoiceLoaderInterface", "$", "loader", ",", "$", "value", "=", "null", ")", "{", "$", "hash", "=", "self", "::", "generateHash", "(", "[", "$", "loader", ",", "$", "value", "]", ",", "'fromLoader'", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php#L105-L114
train
Create a list from a choice loader
[ 30522, 2270, 3853, 3443, 9863, 19699, 5358, 11066, 2121, 1006, 3601, 11066, 23282, 3334, 12172, 1002, 7170, 2121, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 1002, 23325, 1027, 2969, 1024, 1024, 9699, 14949, 2232, 1006, 1031, 1002, 7170, 212...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HttpKernelBrowser.php
HttpKernelBrowser.getScript
protected function getScript($request) { $kernel = var_export(serialize($this->kernel), true); $request = var_export(serialize($request), true); $errorReporting = error_reporting(); $requires = ''; foreach (get_declared_classes() as $class) { if (0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); $file = \dirname(\dirname($r->getFileName())).'/autoload.php'; if (file_exists($file)) { $requires .= 'require_once '.var_export($file, true).";\n"; } } } if (!$requires) { throw new \RuntimeException('Composer autoloader not found.'); } $code = <<<EOF <?php error_reporting($errorReporting); $requires \$kernel = unserialize($kernel); \$request = unserialize($request); EOF; return $code.$this->getHandleScript(); }
php
protected function getScript($request) { $kernel = var_export(serialize($this->kernel), true); $request = var_export(serialize($request), true); $errorReporting = error_reporting(); $requires = ''; foreach (get_declared_classes() as $class) { if (0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); $file = \dirname(\dirname($r->getFileName())).'/autoload.php'; if (file_exists($file)) { $requires .= 'require_once '.var_export($file, true).";\n"; } } } if (!$requires) { throw new \RuntimeException('Composer autoloader not found.'); } $code = <<<EOF <?php error_reporting($errorReporting); $requires \$kernel = unserialize($kernel); \$request = unserialize($request); EOF; return $code.$this->getHandleScript(); }
[ "protected", "function", "getScript", "(", "$", "request", ")", "{", "$", "kernel", "=", "var_export", "(", "serialize", "(", "$", "this", "->", "kernel", ")", ",", "true", ")", ";", "$", "request", "=", "var_export", "(", "serialize", "(", "$", "reque...
Returns the script to execute when the request must be insulated. @return string
[ "Returns", "the", "script", "to", "execute", "when", "the", "request", "must", "be", "insulated", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php#L82-L116
train
Returns the script to execute when the request is executed.
[ 30522, 5123, 3853, 4152, 30524, 1007, 1063, 1002, 16293, 1027, 13075, 1035, 9167, 1006, 7642, 4697, 1006, 1002, 2023, 1011, 1028, 16293, 1007, 1010, 2995, 1007, 1025, 1002, 5227, 1027, 13075, 1035, 9167, 1006, 7642, 4697, 1006, 1002, 5227, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Db/Mysqli.php
Mysqli.commit
public function commit($xid) { if ($this->activeTransaction != $xid || $this->activeTransaction === false) { return; } $this->activeTransaction = false; if (!$this->connection->commit()) { throw new DbException("Commit failed"); } $this->connection->autocommit(true); }
php
public function commit($xid) { if ($this->activeTransaction != $xid || $this->activeTransaction === false) { return; } $this->activeTransaction = false; if (!$this->connection->commit()) { throw new DbException("Commit failed"); } $this->connection->autocommit(true); }
[ "public", "function", "commit", "(", "$", "xid", ")", "{", "if", "(", "$", "this", "->", "activeTransaction", "!=", "$", "xid", "||", "$", "this", "->", "activeTransaction", "===", "false", ")", "{", "return", ";", "}", "$", "this", "->", "activeTransa...
Commit Transaction @param $xid @throws DbException @internal param TransactionID $string from beginTransaction
[ "Commit", "Transaction" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db/Mysqli.php#L353-L366
train
Commits a transaction.
[ 30522, 2270, 3853, 10797, 1006, 1002, 8418, 2094, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3161, 6494, 3619, 18908, 3258, 999, 1027, 1002, 8418, 2094, 1064, 1064, 1002, 2023, 1011, 1028, 3161, 6494, 3619, 18908, 3258, 1027, 1027, 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/Bus/Dispatcher.php
Dispatcher.getCommandHandler
public function getCommandHandler($command) { if ($this->hasCommandHandler($command)) { return $this->container->make($this->handlers[get_class($command)]); } return false; }
php
public function getCommandHandler($command) { if ($this->hasCommandHandler($command)) { return $this->container->make($this->handlers[get_class($command)]); } return false; }
[ "public", "function", "getCommandHandler", "(", "$", "command", ")", "{", "if", "(", "$", "this", "->", "hasCommandHandler", "(", "$", "command", ")", ")", "{", "return", "$", "this", "->", "container", "->", "make", "(", "$", "this", "->", "handlers", ...
Retrieve the handler for a command. @param mixed $command @return bool|mixed
[ "Retrieve", "the", "handler", "for", "a", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Bus/Dispatcher.php#L118-L125
train
Get the handler for a command
[ 30522, 2270, 3853, 2131, 9006, 2386, 17516, 4859, 3917, 1006, 1002, 3094, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2038, 9006, 2386, 17516, 4859, 3917, 1006, 1002, 3094, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11661, 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/Log/LogManager.php
LogManager.createStackDriver
protected function createStackDriver(array $config) { $handlers = collect($config['channels'])->flatMap(function ($channel) { return $this->channel($channel)->getHandlers(); })->all(); if ($config['ignore_exceptions'] ?? false) { $handlers = [new WhatFailureGroupHandler($handlers)]; } return new Monolog($this->parseChannel($config), $handlers); }
php
protected function createStackDriver(array $config) { $handlers = collect($config['channels'])->flatMap(function ($channel) { return $this->channel($channel)->getHandlers(); })->all(); if ($config['ignore_exceptions'] ?? false) { $handlers = [new WhatFailureGroupHandler($handlers)]; } return new Monolog($this->parseChannel($config), $handlers); }
[ "protected", "function", "createStackDriver", "(", "array", "$", "config", ")", "{", "$", "handlers", "=", "collect", "(", "$", "config", "[", "'channels'", "]", ")", "->", "flatMap", "(", "function", "(", "$", "channel", ")", "{", "return", "$", "this",...
Create an aggregate log driver instance. @param array $config @return \Psr\Log\LoggerInterface
[ "Create", "an", "aggregate", "log", "driver", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/LogManager.php#L214-L225
train
Create the stack driver
[ 30522, 5123, 3853, 9005, 2696, 3600, 23663, 2099, 1006, 9140, 1002, 9530, 8873, 2290, 1007, 1063, 1002, 28213, 2015, 1027, 8145, 1006, 1002, 9530, 8873, 2290, 1031, 1005, 6833, 1005, 1033, 1007, 1011, 1028, 4257, 2863, 2361, 1006, 3853, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/LaravelDebugbar.php
LaravelDebugbar.addMessage
public function addMessage($message, $label = 'info') { if ($this->hasCollector('messages')) { /** @var \DebugBar\DataCollector\MessagesCollector $collector */ $collector = $this->getCollector('messages'); $collector->addMessage($message, $label); } }
php
public function addMessage($message, $label = 'info') { if ($this->hasCollector('messages')) { /** @var \DebugBar\DataCollector\MessagesCollector $collector */ $collector = $this->getCollector('messages'); $collector->addMessage($message, $label); } }
[ "public", "function", "addMessage", "(", "$", "message", ",", "$", "label", "=", "'info'", ")", "{", "if", "(", "$", "this", "->", "hasCollector", "(", "'messages'", ")", ")", "{", "/** @var \\DebugBar\\DataCollector\\MessagesCollector $collector */", "$", "collec...
Adds a message to the MessagesCollector A message can be anything from an object to a string @param mixed $message @param string $label
[ "Adds", "a", "message", "to", "the", "MessagesCollector" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/LaravelDebugbar.php#L974-L981
train
Add a message to the messages collector
[ 30522, 2270, 3853, 5587, 7834, 3736, 3351, 1006, 1002, 4471, 1010, 1002, 3830, 1027, 1005, 18558, 1005, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2038, 26895, 22471, 2953, 1006, 1005, 7696, 1005, 1007, 1007, 1063, 1013, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Pop3.php
Zend_Mail_Protocol_Pop3.request
public function request($request, $multiline = false) { $this->sendRequest($request); return $this->readResponse($multiline); }
php
public function request($request, $multiline = false) { $this->sendRequest($request); return $this->readResponse($multiline); }
[ "public", "function", "request", "(", "$", "request", ",", "$", "multiline", "=", "false", ")", "{", "$", "this", "->", "sendRequest", "(", "$", "request", ")", ";", "return", "$", "this", "->", "readResponse", "(", "$", "multiline", ")", ";", "}" ]
Send request and get resposne @see sendRequest(), readResponse() @param string $request request @param bool $multiline multiline response? @return string result from readResponse() @throws Zend_Mail_Protocol_Exception
[ "Send", "request", "and", "get", "resposne" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Pop3.php#L219-L223
train
Sends a request to the server and returns the response.
[ 30522, 2270, 3853, 5227, 1006, 1002, 5227, 1010, 1002, 4800, 4179, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 4604, 2890, 15500, 1006, 1002, 5227, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 3191, 6072, 26029, 3366, 1006, 1002, 4800, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/Loader/MoFileLoader.php
MoFileLoader.readLong
private function readLong($stream, bool $isBigEndian): int { $result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4)); $result = current($result); return (int) substr($result, -8); }
php
private function readLong($stream, bool $isBigEndian): int { $result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4)); $result = current($result); return (int) substr($result, -8); }
[ "private", "function", "readLong", "(", "$", "stream", ",", "bool", "$", "isBigEndian", ")", ":", "int", "{", "$", "result", "=", "unpack", "(", "$", "isBigEndian", "?", "'N1'", ":", "'V1'", ",", "fread", "(", "$", "stream", ",", "4", ")", ")", ";"...
Reads an unsigned long from stream respecting endianness. @param resource $stream
[ "Reads", "an", "unsigned", "long", "from", "stream", "respecting", "endianness", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Loader/MoFileLoader.php#L138-L144
train
Reads and unpacks the next 8 bytes from the stream and returns the result as an integer.
[ 30522, 2797, 3853, 3191, 10052, 1006, 1002, 5460, 1010, 22017, 2140, 1002, 2003, 5638, 6914, 11692, 1007, 1024, 20014, 1063, 1002, 2765, 1027, 4895, 23947, 1006, 1002, 2003, 5638, 6914, 11692, 1029, 1005, 1050, 2487, 1005, 1024, 1005, 1058,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/User/DataUser/UserCollection.php
UserCollection.delete
public function delete($username): bool { $file_path = Grav::instance()['locator']->findResource('account://' . $username . YAML_EXT); return $file_path && unlink($file_path); }
php
public function delete($username): bool { $file_path = Grav::instance()['locator']->findResource('account://' . $username . YAML_EXT); return $file_path && unlink($file_path); }
[ "public", "function", "delete", "(", "$", "username", ")", ":", "bool", "{", "$", "file_path", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", "->", "findResource", "(", "'account://'", ".", "$", "username", ".", "YAML_EXT", ")", ";", "...
Remove user account. @param string $username @return bool True if the action was performed
[ "Remove", "user", "account", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/DataUser/UserCollection.php#L115-L120
train
Delete user account
[ 30522, 2270, 3853, 3972, 12870, 1006, 1002, 5310, 18442, 1007, 1024, 22017, 2140, 1063, 1002, 5371, 1035, 4130, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 8840, 11266, 2953, 1005, 1033, 1011, 1028, 2424, 6072, 8162, 3401,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Route.php
Route.runCallable
protected function runCallable() { $callable = $this->action['uses']; return $callable(...array_values($this->resolveMethodDependencies( $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) ))); }
php
protected function runCallable() { $callable = $this->action['uses']; return $callable(...array_values($this->resolveMethodDependencies( $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) ))); }
[ "protected", "function", "runCallable", "(", ")", "{", "$", "callable", "=", "$", "this", "->", "action", "[", "'uses'", "]", ";", "return", "$", "callable", "(", "...", "array_values", "(", "$", "this", "->", "resolveMethodDependencies", "(", "$", "this",...
Run the route action and return the response. @return mixed
[ "Run", "the", "route", "action", "and", "return", "the", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Route.php#L200-L207
train
Runs the callable and returns the result of the action.
[ 30522, 5123, 3853, 2448, 9289, 20470, 2571, 1006, 1007, 1063, 1002, 2655, 3085, 1027, 1002, 2023, 1011, 1028, 2895, 1031, 1005, 3594, 1005, 1033, 1025, 2709, 1002, 2655, 3085, 1006, 1012, 1012, 1012, 9140, 1035, 5300, 1006, 1002, 2023, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataCollector/QueryCollector.php
QueryCollector.findViewFromHash
protected function findViewFromHash($hash) { $finder = app('view')->getFinder(); if (isset($this->reflection['viewfinderViews'])) { $property = $this->reflection['viewfinderViews']; } else { $reflection = new \ReflectionClass($finder); $property = $reflection->getProperty('views'); $property->setAccessible(true); $this->reflection['viewfinderViews'] = $property; } foreach ($property->getValue($finder) as $name => $path){ if (sha1($path) == $hash || md5($path) == $hash) { return $name; } } }
php
protected function findViewFromHash($hash) { $finder = app('view')->getFinder(); if (isset($this->reflection['viewfinderViews'])) { $property = $this->reflection['viewfinderViews']; } else { $reflection = new \ReflectionClass($finder); $property = $reflection->getProperty('views'); $property->setAccessible(true); $this->reflection['viewfinderViews'] = $property; } foreach ($property->getValue($finder) as $name => $path){ if (sha1($path) == $hash || md5($path) == $hash) { return $name; } } }
[ "protected", "function", "findViewFromHash", "(", "$", "hash", ")", "{", "$", "finder", "=", "app", "(", "'view'", ")", "->", "getFinder", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "reflection", "[", "'viewfinderViews'", "]", ")", ")",...
Find the template name from the hash. @param string $hash @return null|string
[ "Find", "the", "template", "name", "from", "the", "hash", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataCollector/QueryCollector.php#L315-L333
train
Finds the view from the finder views property
[ 30522, 5123, 3853, 2424, 8584, 19699, 5358, 14949, 2232, 1006, 1002, 23325, 1007, 1063, 1002, 2424, 2121, 1027, 10439, 1006, 1005, 3193, 1005, 1007, 1011, 1028, 2131, 23695, 1006, 1007, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/Dumper/IniFileDumper.php
IniFileDumper.formatCatalogue
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $output = ''; foreach ($messages->all($domain) as $source => $target) { $escapeTarget = str_replace('"', '\"', $target); $output .= $source.'="'.$escapeTarget."\"\n"; } return $output; }
php
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $output = ''; foreach ($messages->all($domain) as $source => $target) { $escapeTarget = str_replace('"', '\"', $target); $output .= $source.'="'.$escapeTarget."\"\n"; } return $output; }
[ "public", "function", "formatCatalogue", "(", "MessageCatalogue", "$", "messages", ",", "$", "domain", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "output", "=", "''", ";", "foreach", "(", "$", "messages", "->", "all", "(", "$", "domain...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Dumper/IniFileDumper.php#L26-L36
train
Format the catalogue
[ 30522, 2270, 3853, 4289, 11266, 23067, 9077, 1006, 4471, 11266, 23067, 9077, 1002, 7696, 1010, 1002, 5884, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 6434, 1027, 1005, 1005, 1025, 18921, 6776, 1006, 1002, 7696, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/Table.php
Table.setColumnWidths
public function setColumnWidths(array $widths) { $this->columnWidths = []; foreach ($widths as $index => $width) { $this->setColumnWidth($index, $width); } return $this; }
php
public function setColumnWidths(array $widths) { $this->columnWidths = []; foreach ($widths as $index => $width) { $this->setColumnWidth($index, $width); } return $this; }
[ "public", "function", "setColumnWidths", "(", "array", "$", "widths", ")", "{", "$", "this", "->", "columnWidths", "=", "[", "]", ";", "foreach", "(", "$", "widths", "as", "$", "index", "=>", "$", "width", ")", "{", "$", "this", "->", "setColumnWidth",...
Sets the minimum width of all columns. @param array $widths @return $this
[ "Sets", "the", "minimum", "width", "of", "all", "columns", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L214-L222
train
Set column widths
[ 30522, 2270, 3853, 2275, 25778, 2819, 2078, 9148, 11927, 7898, 1006, 9140, 1002, 9381, 2015, 1007, 1063, 1002, 2023, 1011, 1028, 5930, 9148, 11927, 7898, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 9381, 2015, 2004, 1002, 5950, 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/Form/Extension/Core/Type/MoneyType.php
MoneyType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'scale' => 2, 'grouping' => false, 'rounding_mode' => NumberToLocalizedStringTransformer::ROUND_HALF_UP, 'divisor' => 1, 'currency' => 'EUR', 'compound' => false, ]); $resolver->setAllowedValues('rounding_mode', [ NumberToLocalizedStringTransformer::ROUND_FLOOR, NumberToLocalizedStringTransformer::ROUND_DOWN, NumberToLocalizedStringTransformer::ROUND_HALF_DOWN, NumberToLocalizedStringTransformer::ROUND_HALF_EVEN, NumberToLocalizedStringTransformer::ROUND_HALF_UP, NumberToLocalizedStringTransformer::ROUND_UP, NumberToLocalizedStringTransformer::ROUND_CEILING, ]); $resolver->setAllowedTypes('scale', 'int'); }
php
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'scale' => 2, 'grouping' => false, 'rounding_mode' => NumberToLocalizedStringTransformer::ROUND_HALF_UP, 'divisor' => 1, 'currency' => 'EUR', 'compound' => false, ]); $resolver->setAllowedValues('rounding_mode', [ NumberToLocalizedStringTransformer::ROUND_FLOOR, NumberToLocalizedStringTransformer::ROUND_DOWN, NumberToLocalizedStringTransformer::ROUND_HALF_DOWN, NumberToLocalizedStringTransformer::ROUND_HALF_EVEN, NumberToLocalizedStringTransformer::ROUND_HALF_UP, NumberToLocalizedStringTransformer::ROUND_UP, NumberToLocalizedStringTransformer::ROUND_CEILING, ]); $resolver->setAllowedTypes('scale', 'int'); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setDefaults", "(", "[", "'scale'", "=>", "2", ",", "'grouping'", "=>", "false", ",", "'rounding_mode'", "=>", "NumberToLocalizedStringTransformer", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php#L52-L74
train
Configure options for the parser
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 1002, 10663, 2099, 1007, 1063, 1002, 10663, 2099, 1011, 1028, 2275, 3207, 7011, 11314, 2015, 1006, 1031, 1005, 4094, 1005, 1027, 1028, 1016, 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...
apache/thrift
lib/php/lib/Protocol/TJSONProtocol.php
TJSONProtocol.readMessageBegin
public function readMessageBegin(&$name, &$type, &$seqid) { $this->readJSONArrayStart(); if ($this->readJSONInteger() != self::VERSION) { throw new TProtocolException("Message contained bad version", TProtocolException::BAD_VERSION); } $name = $this->readJSONString(false); $type = $this->readJSONInteger(); $seqid = $this->readJSONInteger(); return true; }
php
public function readMessageBegin(&$name, &$type, &$seqid) { $this->readJSONArrayStart(); if ($this->readJSONInteger() != self::VERSION) { throw new TProtocolException("Message contained bad version", TProtocolException::BAD_VERSION); } $name = $this->readJSONString(false); $type = $this->readJSONInteger(); $seqid = $this->readJSONInteger(); return true; }
[ "public", "function", "readMessageBegin", "(", "&", "$", "name", ",", "&", "$", "type", ",", "&", "$", "seqid", ")", "{", "$", "this", "->", "readJSONArrayStart", "(", ")", ";", "if", "(", "$", "this", "->", "readJSONInteger", "(", ")", "!=", "self",...
Reads the message header @param string $name Function name @param int $type message type TMessageType::CALL or TMessageType::REPLY @parem int $seqid The sequence id of this message
[ "Reads", "the", "message", "header" ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Protocol/TJSONProtocol.php#L666-L679
train
Read message begin.
[ 30522, 2270, 3853, 3191, 7834, 3736, 3351, 4783, 11528, 1006, 1004, 1002, 2171, 1010, 1004, 1002, 2828, 1010, 1004, 1002, 7367, 14702, 2094, 1007, 1063, 1002, 2023, 1011, 1028, 3191, 22578, 7856, 11335, 27268, 8445, 1006, 1007, 1025, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/Mailable.php
Mailable.send
public function send(MailerContract $mailer) { return $this->withLocale($this->locale, function () use ($mailer) { Container::getInstance()->call([$this, 'build']); return $mailer->send($this->buildView(), $this->buildViewData(), function ($message) { $this->buildFrom($message) ->buildRecipients($message) ->buildSubject($message) ->runCallbacks($message) ->buildAttachments($message); }); }); }
php
public function send(MailerContract $mailer) { return $this->withLocale($this->locale, function () use ($mailer) { Container::getInstance()->call([$this, 'build']); return $mailer->send($this->buildView(), $this->buildViewData(), function ($message) { $this->buildFrom($message) ->buildRecipients($message) ->buildSubject($message) ->runCallbacks($message) ->buildAttachments($message); }); }); }
[ "public", "function", "send", "(", "MailerContract", "$", "mailer", ")", "{", "return", "$", "this", "->", "withLocale", "(", "$", "this", "->", "locale", ",", "function", "(", ")", "use", "(", "$", "mailer", ")", "{", "Container", "::", "getInstance", ...
Send the message using the given mailer. @param \Illuminate\Contracts\Mail\Mailer $mailer @return void
[ "Send", "the", "message", "using", "the", "given", "mailer", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L148-L161
train
Sends the message using the given mailer
[ 30522, 2270, 3853, 4604, 1006, 5653, 2121, 8663, 6494, 6593, 1002, 5653, 2121, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2007, 4135, 9289, 2063, 1006, 1002, 2023, 1011, 1028, 2334, 2063, 1010, 3853, 1006, 1007, 2224, 1006, 1002, 5653, 212...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/DateFormatter/IntlDateFormatter.php
IntlDateFormatter.setTimeZoneId
public function setTimeZoneId($timeZoneId) { if (null === $timeZoneId) { $timeZoneId = date_default_timezone_get(); $this->uninitializedTimeZoneId = true; } // Backup original passed time zone $timeZone = $timeZoneId; // Get an Etc/GMT time zone that is accepted for \DateTimeZone if ('GMT' !== $timeZoneId && 0 === strpos($timeZoneId, 'GMT')) { try { $timeZoneId = DateFormat\TimezoneTransformer::getEtcTimeZoneId($timeZoneId); } catch (\InvalidArgumentException $e) { // Does nothing, will fallback to UTC } } try { $this->dateTimeZone = new \DateTimeZone($timeZoneId); if ('GMT' !== $timeZoneId && $this->dateTimeZone->getName() !== $timeZoneId) { $timeZone = $this->getTimeZoneId(); } } catch (\Exception $e) { $timeZoneId = $timeZone = $this->getTimeZoneId(); $this->dateTimeZone = new \DateTimeZone($timeZoneId); } $this->timeZoneId = $timeZone; return true; }
php
public function setTimeZoneId($timeZoneId) { if (null === $timeZoneId) { $timeZoneId = date_default_timezone_get(); $this->uninitializedTimeZoneId = true; } // Backup original passed time zone $timeZone = $timeZoneId; // Get an Etc/GMT time zone that is accepted for \DateTimeZone if ('GMT' !== $timeZoneId && 0 === strpos($timeZoneId, 'GMT')) { try { $timeZoneId = DateFormat\TimezoneTransformer::getEtcTimeZoneId($timeZoneId); } catch (\InvalidArgumentException $e) { // Does nothing, will fallback to UTC } } try { $this->dateTimeZone = new \DateTimeZone($timeZoneId); if ('GMT' !== $timeZoneId && $this->dateTimeZone->getName() !== $timeZoneId) { $timeZone = $this->getTimeZoneId(); } } catch (\Exception $e) { $timeZoneId = $timeZone = $this->getTimeZoneId(); $this->dateTimeZone = new \DateTimeZone($timeZoneId); } $this->timeZoneId = $timeZone; return true; }
[ "public", "function", "setTimeZoneId", "(", "$", "timeZoneId", ")", "{", "if", "(", "null", "===", "$", "timeZoneId", ")", "{", "$", "timeZoneId", "=", "date_default_timezone_get", "(", ")", ";", "$", "this", "->", "uninitializedTimeZoneId", "=", "true", ";"...
Set the formatter's timezone identifier. @param string|null $timeZoneId The time zone ID string of the time zone to use. If NULL or the empty string, the default time zone for the runtime is used. @return bool true on success or false on failure @see http://www.php.net/manual/en/intldateformatter.settimezoneid.php
[ "Set", "the", "formatter", "s", "timezone", "identifier", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php#L517-L550
train
Set the timezone ID
[ 30522, 2270, 3853, 2275, 7292, 15975, 3593, 1006, 1002, 2051, 15975, 3593, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2051, 15975, 3593, 1007, 1063, 1002, 2051, 15975, 3593, 1027, 3058, 1035, 12398, 1035, 2051, 15975, 1035, 2131...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
opencart/opencart
upload/admin/controller/event/statistics.php
ControllerEventStatistics.deleteReview
public function deleteReview(&$route, &$args, &$output) { $this->load->model('report/statistics'); $this->model_report_statistics->removeValue('review', 1); }
php
public function deleteReview(&$route, &$args, &$output) { $this->load->model('report/statistics'); $this->model_report_statistics->removeValue('review', 1); }
[ "public", "function", "deleteReview", "(", "&", "$", "route", ",", "&", "$", "args", ",", "&", "$", "output", ")", "{", "$", "this", "->", "load", "->", "model", "(", "'report/statistics'", ")", ";", "$", "this", "->", "model_report_statistics", "->", ...
admin/model/catalog/review/deleteReview/after
[ "admin", "/", "model", "/", "catalog", "/", "review", "/", "deleteReview", "/", "after" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/admin/controller/event/statistics.php#L11-L15
train
Delete a review
[ 30522, 2270, 3853, 3972, 15141, 6777, 2666, 2860, 1006, 1004, 1002, 2799, 1010, 1004, 1002, 12098, 5620, 1010, 1004, 1002, 6434, 1007, 1063, 1002, 2023, 1011, 1028, 7170, 1011, 1028, 2944, 1006, 1005, 3189, 1013, 6747, 1005, 1007, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Traits/HasAssets.php
HasAssets.css
public static function css($css = null) { if (!is_null($css)) { return self::$css = array_merge(self::$css, (array) $css); } if (!$css = static::getMinifiedCss()) { $css = array_merge(static::$css, static::baseCss()); } $css = array_filter(array_unique($css)); return view('admin::partials.css', compact('css')); }
php
public static function css($css = null) { if (!is_null($css)) { return self::$css = array_merge(self::$css, (array) $css); } if (!$css = static::getMinifiedCss()) { $css = array_merge(static::$css, static::baseCss()); } $css = array_filter(array_unique($css)); return view('admin::partials.css', compact('css')); }
[ "public", "static", "function", "css", "(", "$", "css", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "css", ")", ")", "{", "return", "self", "::", "$", "css", "=", "array_merge", "(", "self", "::", "$", "css", ",", "(", "array", ...
Add css or get all css. @param null $css @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
[ "Add", "css", "or", "get", "all", "css", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/HasAssets.php#L89-L102
train
Get the css to include in the admin
[ 30522, 2270, 10763, 3853, 20116, 2015, 1006, 1002, 20116, 2015, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 20116, 2015, 1007, 1007, 1063, 2709, 2969, 1024, 1024, 1002, 20116, 2015, 1027, 9140, 1035, 13590, 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...
laravel/framework
src/Illuminate/Routing/UrlGenerator.php
UrlGenerator.signedRoute
public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) { $parameters = $this->formatParameters($parameters); if ($expiration) { $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; } ksort($parameters); $key = call_user_func($this->keyResolver); return $this->route($name, $parameters + [ 'signature' => hash_hmac('sha256', $this->route($name, $parameters, $absolute), $key), ], $absolute); }
php
public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) { $parameters = $this->formatParameters($parameters); if ($expiration) { $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; } ksort($parameters); $key = call_user_func($this->keyResolver); return $this->route($name, $parameters + [ 'signature' => hash_hmac('sha256', $this->route($name, $parameters, $absolute), $key), ], $absolute); }
[ "public", "function", "signedRoute", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "expiration", "=", "null", ",", "$", "absolute", "=", "true", ")", "{", "$", "parameters", "=", "$", "this", "->", "formatParameters", "(", "$", "...
Create a signed route URL for a named route. @param string $name @param array $parameters @param \DateTimeInterface|\DateInterval|int $expiration @param bool $absolute @return string
[ "Create", "a", "signed", "route", "URL", "for", "a", "named", "route", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L318-L333
train
Generate a signed route.
[ 30522, 2270, 3853, 2772, 22494, 2618, 1006, 1002, 2171, 1010, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 4654, 16781, 1027, 19701, 1010, 1002, 7619, 1027, 2995, 1007, 1063, 1002, 11709, 1027, 1002, 2023, 1011, 1028, 4289, 28689, 22828, 2015...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Response.php
Response.progress
public static function progress() { static $filesize = null; $args = func_get_args(); $isCurlResource = is_resource($args[0]) && get_resource_type($args[0]) === 'curl'; $notification_code = !$isCurlResource ? $args[0] : false; $bytes_transferred = $isCurlResource ? $args[2] : $args[4]; if ($isCurlResource) { $filesize = $args[1]; } elseif ($notification_code == STREAM_NOTIFY_FILE_SIZE_IS) { $filesize = $args[5]; } if ($bytes_transferred > 0) { if ($notification_code == STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_COMPLETED || $isCurlResource) { $progress = [ 'code' => $notification_code, 'filesize' => $filesize, 'transferred' => $bytes_transferred, 'percent' => $filesize <= 0 ? '-' : round(($bytes_transferred * 100) / $filesize, 1) ]; if (self::$callback !== null) { call_user_func(self::$callback, $progress); } } } }
php
public static function progress() { static $filesize = null; $args = func_get_args(); $isCurlResource = is_resource($args[0]) && get_resource_type($args[0]) === 'curl'; $notification_code = !$isCurlResource ? $args[0] : false; $bytes_transferred = $isCurlResource ? $args[2] : $args[4]; if ($isCurlResource) { $filesize = $args[1]; } elseif ($notification_code == STREAM_NOTIFY_FILE_SIZE_IS) { $filesize = $args[5]; } if ($bytes_transferred > 0) { if ($notification_code == STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_COMPLETED || $isCurlResource) { $progress = [ 'code' => $notification_code, 'filesize' => $filesize, 'transferred' => $bytes_transferred, 'percent' => $filesize <= 0 ? '-' : round(($bytes_transferred * 100) / $filesize, 1) ]; if (self::$callback !== null) { call_user_func(self::$callback, $progress); } } } }
[ "public", "static", "function", "progress", "(", ")", "{", "static", "$", "filesize", "=", "null", ";", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "isCurlResource", "=", "is_resource", "(", "$", "args", "[", "0", "]", ")", "&&", "get_resour...
Progress normalized for cURL and Fopen Accepts a variable length of arguments passed in by stream method
[ "Progress", "normalized", "for", "cURL", "and", "Fopen", "Accepts", "a", "variable", "length", "of", "arguments", "passed", "in", "by", "stream", "method" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Response.php#L218-L249
train
This method is used to notify the user of progression
[ 30522, 2270, 10763, 3853, 5082, 1006, 1007, 1063, 10763, 1002, 6764, 4697, 1027, 19701, 1025, 1002, 12098, 5620, 1027, 4569, 2278, 1035, 2131, 1035, 12098, 5620, 1006, 1007, 1025, 1002, 2003, 10841, 12190, 6072, 8162, 3401, 1027, 2003, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
AnalyzeServiceReferencesPass.process
public function process(ContainerBuilder $container) { $this->container = $container; $this->graph = $container->getCompiler()->getServiceReferenceGraph(); $this->graph->clear(); $this->lazy = false; $this->byConstructor = false; $this->definitions = $container->getDefinitions(); $this->aliases = $container->getAliases(); foreach ($this->aliases as $id => $alias) { $targetId = $this->getDefinitionId((string) $alias); $this->graph->connect($id, $alias, $targetId, null !== $targetId ? $this->container->getDefinition($targetId) : null, null); } try { parent::process($container); } finally { $this->aliases = $this->definitions = []; } }
php
public function process(ContainerBuilder $container) { $this->container = $container; $this->graph = $container->getCompiler()->getServiceReferenceGraph(); $this->graph->clear(); $this->lazy = false; $this->byConstructor = false; $this->definitions = $container->getDefinitions(); $this->aliases = $container->getAliases(); foreach ($this->aliases as $id => $alias) { $targetId = $this->getDefinitionId((string) $alias); $this->graph->connect($id, $alias, $targetId, null !== $targetId ? $this->container->getDefinition($targetId) : null, null); } try { parent::process($container); } finally { $this->aliases = $this->definitions = []; } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "this", "->", "container", "=", "$", "container", ";", "$", "this", "->", "graph", "=", "$", "container", "->", "getCompiler", "(", ")", "->", "getServiceReferenceGrap...
Processes a ContainerBuilder object to populate the service reference graph.
[ "Processes", "a", "ContainerBuilder", "object", "to", "populate", "the", "service", "reference", "graph", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php#L63-L83
train
Process the container builder
[ 30522, 2270, 3853, 2832, 1006, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 1002, 2023, 1011, 1028, 11661, 1027, 1002, 11661, 1025, 1002, 2023, 1011, 1028, 10629, 1027, 1002, 11661, 1011, 1028, 2131, 9006, 22090, 2099, 1006, 1007, 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...
laravel/framework
src/Illuminate/Routing/Router.php
Router.toResponse
public static function toResponse($request, $response) { if ($response instanceof Responsable) { $response = $response->toResponse($request); } if ($response instanceof PsrResponseInterface) { $response = (new HttpFoundationFactory)->createResponse($response); } elseif ($response instanceof Model && $response->wasRecentlyCreated) { $response = new JsonResponse($response, 201); } elseif (! $response instanceof SymfonyResponse && ($response instanceof Arrayable || $response instanceof Jsonable || $response instanceof ArrayObject || $response instanceof JsonSerializable || is_array($response))) { $response = new JsonResponse($response); } elseif (! $response instanceof SymfonyResponse) { $response = new Response($response); } if ($response->getStatusCode() === Response::HTTP_NOT_MODIFIED) { $response->setNotModified(); } return $response->prepare($request); }
php
public static function toResponse($request, $response) { if ($response instanceof Responsable) { $response = $response->toResponse($request); } if ($response instanceof PsrResponseInterface) { $response = (new HttpFoundationFactory)->createResponse($response); } elseif ($response instanceof Model && $response->wasRecentlyCreated) { $response = new JsonResponse($response, 201); } elseif (! $response instanceof SymfonyResponse && ($response instanceof Arrayable || $response instanceof Jsonable || $response instanceof ArrayObject || $response instanceof JsonSerializable || is_array($response))) { $response = new JsonResponse($response); } elseif (! $response instanceof SymfonyResponse) { $response = new Response($response); } if ($response->getStatusCode() === Response::HTTP_NOT_MODIFIED) { $response->setNotModified(); } return $response->prepare($request); }
[ "public", "static", "function", "toResponse", "(", "$", "request", ",", "$", "response", ")", "{", "if", "(", "$", "response", "instanceof", "Responsable", ")", "{", "$", "response", "=", "$", "response", "->", "toResponse", "(", "$", "request", ")", ";"...
Static version of prepareResponse. @param \Symfony\Component\HttpFoundation\Request $request @param mixed $response @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
[ "Static", "version", "of", "prepareResponse", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L730-L756
train
Convert to response
[ 30522, 2270, 10763, 3853, 9538, 13102, 5644, 2063, 1006, 1002, 5227, 1010, 1002, 3433, 1007, 1063, 2065, 1006, 1002, 3433, 6013, 11253, 24501, 26029, 19150, 1007, 1063, 1002, 3433, 1027, 1002, 3433, 1011, 1028, 9538, 13102, 5644, 2063, 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...
apache/thrift
lib/php/lib/Transport/TCurlClient.php
TCurlClient.flush
public function flush() { if (!self::$curlHandle) { register_shutdown_function(array('Thrift\\Transport\\TCurlClient', 'closeCurlHandle')); self::$curlHandle = curl_init(); curl_setopt(self::$curlHandle, CURLOPT_RETURNTRANSFER, true); curl_setopt(self::$curlHandle, CURLOPT_BINARYTRANSFER, true); curl_setopt(self::$curlHandle, CURLOPT_USERAGENT, 'PHP/TCurlClient'); curl_setopt(self::$curlHandle, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt(self::$curlHandle, CURLOPT_FOLLOWLOCATION, true); curl_setopt(self::$curlHandle, CURLOPT_MAXREDIRS, 1); } // God, PHP really has some esoteric ways of doing simple things. $host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : ''); $fullUrl = $this->scheme_ . "://" . $host . $this->uri_; $headers = array(); $defaultHeaders = array('Accept' => 'application/x-thrift', 'Content-Type' => 'application/x-thrift', 'Content-Length' => TStringFuncFactory::create()->strlen($this->request_)); foreach (array_merge($defaultHeaders, $this->headers_) as $key => $value) { $headers[] = "$key: $value"; } curl_setopt(self::$curlHandle, CURLOPT_HTTPHEADER, $headers); if ($this->timeout_ > 0) { curl_setopt(self::$curlHandle, CURLOPT_TIMEOUT, $this->timeout_); } curl_setopt(self::$curlHandle, CURLOPT_POSTFIELDS, $this->request_); $this->request_ = ''; curl_setopt(self::$curlHandle, CURLOPT_URL, $fullUrl); $this->response_ = curl_exec(self::$curlHandle); $responseError = curl_error(self::$curlHandle); $code = curl_getinfo(self::$curlHandle, CURLINFO_HTTP_CODE); // Handle non 200 status code / connect failure if ($this->response_ === false || $code !== 200) { curl_close(self::$curlHandle); self::$curlHandle = null; $this->response_ = null; $error = 'TCurlClient: Could not connect to ' . $fullUrl; if ($responseError) { $error .= ', ' . $responseError; } if ($code) { $error .= ', HTTP status code: ' . $code; } throw new TTransportException($error, TTransportException::UNKNOWN); } }
php
public function flush() { if (!self::$curlHandle) { register_shutdown_function(array('Thrift\\Transport\\TCurlClient', 'closeCurlHandle')); self::$curlHandle = curl_init(); curl_setopt(self::$curlHandle, CURLOPT_RETURNTRANSFER, true); curl_setopt(self::$curlHandle, CURLOPT_BINARYTRANSFER, true); curl_setopt(self::$curlHandle, CURLOPT_USERAGENT, 'PHP/TCurlClient'); curl_setopt(self::$curlHandle, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt(self::$curlHandle, CURLOPT_FOLLOWLOCATION, true); curl_setopt(self::$curlHandle, CURLOPT_MAXREDIRS, 1); } // God, PHP really has some esoteric ways of doing simple things. $host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : ''); $fullUrl = $this->scheme_ . "://" . $host . $this->uri_; $headers = array(); $defaultHeaders = array('Accept' => 'application/x-thrift', 'Content-Type' => 'application/x-thrift', 'Content-Length' => TStringFuncFactory::create()->strlen($this->request_)); foreach (array_merge($defaultHeaders, $this->headers_) as $key => $value) { $headers[] = "$key: $value"; } curl_setopt(self::$curlHandle, CURLOPT_HTTPHEADER, $headers); if ($this->timeout_ > 0) { curl_setopt(self::$curlHandle, CURLOPT_TIMEOUT, $this->timeout_); } curl_setopt(self::$curlHandle, CURLOPT_POSTFIELDS, $this->request_); $this->request_ = ''; curl_setopt(self::$curlHandle, CURLOPT_URL, $fullUrl); $this->response_ = curl_exec(self::$curlHandle); $responseError = curl_error(self::$curlHandle); $code = curl_getinfo(self::$curlHandle, CURLINFO_HTTP_CODE); // Handle non 200 status code / connect failure if ($this->response_ === false || $code !== 200) { curl_close(self::$curlHandle); self::$curlHandle = null; $this->response_ = null; $error = 'TCurlClient: Could not connect to ' . $fullUrl; if ($responseError) { $error .= ', ' . $responseError; } if ($code) { $error .= ', HTTP status code: ' . $code; } throw new TTransportException($error, TTransportException::UNKNOWN); } }
[ "public", "function", "flush", "(", ")", "{", "if", "(", "!", "self", "::", "$", "curlHandle", ")", "{", "register_shutdown_function", "(", "array", "(", "'Thrift\\\\Transport\\\\TCurlClient'", ",", "'closeCurlHandle'", ")", ")", ";", "self", "::", "$", "curlH...
Opens and sends the actual request over the HTTP connection @throws TTransportException if a writing error occurs
[ "Opens", "and", "sends", "the", "actual", "request", "over", "the", "HTTP", "connection" ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TCurlClient.php#L206-L258
train
Flushes the request
[ 30522, 2270, 3853, 13862, 1006, 1007, 1063, 2065, 1006, 999, 2969, 1024, 1024, 1002, 15390, 11774, 2571, 1007, 1063, 4236, 1035, 3844, 7698, 1035, 3853, 1006, 9140, 1006, 1005, 16215, 16338, 1032, 1032, 3665, 1032, 1032, 22975, 3126, 15472,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/NestedForm.php
NestedForm.prepareRecord
protected function prepareRecord($record) { if ($record[static::REMOVE_FLAG_NAME] == 1) { return $record; } $prepared = []; /* @var Field $field */ foreach ($this->fields as $field) { $columns = $field->column(); $value = $this->fetchColumnValue($record, $columns); if (is_null($value)) { continue; } if (method_exists($field, 'prepare')) { $value = $field->prepare($value); } if (($field instanceof \Encore\Admin\Form\Field\Hidden) || $value != $field->original()) { if (is_array($columns)) { foreach ($columns as $name => $column) { Arr::set($prepared, $column, $value[$name]); } } elseif (is_string($columns)) { Arr::set($prepared, $columns, $value); } } } $prepared[static::REMOVE_FLAG_NAME] = $record[static::REMOVE_FLAG_NAME]; return $prepared; }
php
protected function prepareRecord($record) { if ($record[static::REMOVE_FLAG_NAME] == 1) { return $record; } $prepared = []; /* @var Field $field */ foreach ($this->fields as $field) { $columns = $field->column(); $value = $this->fetchColumnValue($record, $columns); if (is_null($value)) { continue; } if (method_exists($field, 'prepare')) { $value = $field->prepare($value); } if (($field instanceof \Encore\Admin\Form\Field\Hidden) || $value != $field->original()) { if (is_array($columns)) { foreach ($columns as $name => $column) { Arr::set($prepared, $column, $value[$name]); } } elseif (is_string($columns)) { Arr::set($prepared, $columns, $value); } } } $prepared[static::REMOVE_FLAG_NAME] = $record[static::REMOVE_FLAG_NAME]; return $prepared; }
[ "protected", "function", "prepareRecord", "(", "$", "record", ")", "{", "if", "(", "$", "record", "[", "static", "::", "REMOVE_FLAG_NAME", "]", "==", "1", ")", "{", "return", "$", "record", ";", "}", "$", "prepared", "=", "[", "]", ";", "/* @var Field ...
Do prepare work before store and update. @param array $record @return array
[ "Do", "prepare", "work", "before", "store", "and", "update", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/NestedForm.php#L256-L292
train
Prepare record by fetching all fields
[ 30522, 5123, 3853, 7374, 2890, 27108, 2094, 1006, 1002, 2501, 1007, 1063, 2065, 1006, 1002, 2501, 1031, 10763, 1024, 1024, 6366, 1035, 5210, 1035, 2171, 1033, 1027, 1027, 1015, 1007, 1063, 2709, 1002, 2501, 1025, 1065, 1002, 4810, 1027, 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/ArchiveProcessor/Loader.php
Loader.prepareCoreMetricsArchive
protected function prepareCoreMetricsArchive($visits, $visitsConverted) { $createSeparateArchiveForCoreMetrics = $this->mustProcessVisitCount($visits) && !$this->doesRequestedPluginIncludeVisitsSummary(); if ($createSeparateArchiveForCoreMetrics) { $requestedPlugin = $this->params->getRequestedPlugin(); $this->params->setRequestedPlugin('VisitsSummary'); $pluginsArchiver = new PluginsArchiver($this->params, $this->isArchiveTemporary()); $metrics = $pluginsArchiver->callAggregateCoreMetrics(); $pluginsArchiver->finalizeArchive(); $this->params->setRequestedPlugin($requestedPlugin); $visits = $metrics['nb_visits']; $visitsConverted = $metrics['nb_visits_converted']; } return array($visits, $visitsConverted); }
php
protected function prepareCoreMetricsArchive($visits, $visitsConverted) { $createSeparateArchiveForCoreMetrics = $this->mustProcessVisitCount($visits) && !$this->doesRequestedPluginIncludeVisitsSummary(); if ($createSeparateArchiveForCoreMetrics) { $requestedPlugin = $this->params->getRequestedPlugin(); $this->params->setRequestedPlugin('VisitsSummary'); $pluginsArchiver = new PluginsArchiver($this->params, $this->isArchiveTemporary()); $metrics = $pluginsArchiver->callAggregateCoreMetrics(); $pluginsArchiver->finalizeArchive(); $this->params->setRequestedPlugin($requestedPlugin); $visits = $metrics['nb_visits']; $visitsConverted = $metrics['nb_visits_converted']; } return array($visits, $visitsConverted); }
[ "protected", "function", "prepareCoreMetricsArchive", "(", "$", "visits", ",", "$", "visitsConverted", ")", "{", "$", "createSeparateArchiveForCoreMetrics", "=", "$", "this", "->", "mustProcessVisitCount", "(", "$", "visits", ")", "&&", "!", "$", "this", "->", "...
Prepares the core metrics if needed. @param $visits @return array
[ "Prepares", "the", "core", "metrics", "if", "needed", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor/Loader.php#L98-L119
train
Prepares core metrics archive for the given visits and visits converted
[ 30522, 5123, 3853, 7374, 17345, 12589, 10286, 5428, 3726, 1006, 1002, 7879, 1010, 1002, 7879, 8663, 26686, 1007, 1063, 1002, 9005, 13699, 25879, 14644, 5428, 3726, 29278, 17345, 12589, 2015, 1027, 1002, 2023, 1011, 1028, 2442, 21572, 9623, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ResponseHeaderBag.php
ResponseHeaderBag.removeCookie
public function removeCookie($name, $path = '/', $domain = null) { if (null === $path) { $path = '/'; } unset($this->cookies[$domain][$path][$name]); if (empty($this->cookies[$domain][$path])) { unset($this->cookies[$domain][$path]); if (empty($this->cookies[$domain])) { unset($this->cookies[$domain]); } } if (empty($this->cookies)) { unset($this->headerNames['set-cookie']); } }
php
public function removeCookie($name, $path = '/', $domain = null) { if (null === $path) { $path = '/'; } unset($this->cookies[$domain][$path][$name]); if (empty($this->cookies[$domain][$path])) { unset($this->cookies[$domain][$path]); if (empty($this->cookies[$domain])) { unset($this->cookies[$domain]); } } if (empty($this->cookies)) { unset($this->headerNames['set-cookie']); } }
[ "public", "function", "removeCookie", "(", "$", "name", ",", "$", "path", "=", "'/'", ",", "$", "domain", "=", "null", ")", "{", "if", "(", "null", "===", "$", "path", ")", "{", "$", "path", "=", "'/'", ";", "}", "unset", "(", "$", "this", "->"...
Removes a cookie from the array, but does not unset it in the browser. @param string $name @param string $path @param string $domain
[ "Removes", "a", "cookie", "from", "the", "array", "but", "does", "not", "unset", "it", "in", "the", "browser", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php#L186-L205
train
Remove a cookie from the response
[ 30522, 2270, 3853, 6366, 3597, 23212, 2063, 1006, 1002, 2171, 1010, 1002, 4130, 1027, 1005, 1013, 1005, 1010, 1002, 5884, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 1005, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Config/Setup.php
Setup.getStreams
public function getStreams() { $schemes = []; foreach ((array) $this->get('streams.schemes') as $scheme => $config) { $type = $config['type'] ?? 'ReadOnlyStream'; if ($type[0] !== '\\') { $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type; } $schemes[$scheme] = $type; } return $schemes; }
php
public function getStreams() { $schemes = []; foreach ((array) $this->get('streams.schemes') as $scheme => $config) { $type = $config['type'] ?? 'ReadOnlyStream'; if ($type[0] !== '\\') { $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type; } $schemes[$scheme] = $type; } return $schemes; }
[ "public", "function", "getStreams", "(", ")", "{", "$", "schemes", "=", "[", "]", ";", "foreach", "(", "(", "array", ")", "$", "this", "->", "get", "(", "'streams.schemes'", ")", "as", "$", "scheme", "=>", "$", "config", ")", "{", "$", "type", "=",...
Get available streams and their types from the configuration. @return array
[ "Get", "available", "streams", "and", "their", "types", "from", "the", "configuration", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/Setup.php#L265-L278
train
Get streams from configuration
[ 30522, 2270, 3853, 4152, 25379, 2015, 1006, 1007, 1063, 1002, 11683, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1006, 9140, 1007, 1002, 2023, 1011, 1028, 2131, 1006, 1005, 9199, 1012, 11683, 1005, 1007, 2004, 1002, 5679, 1027, 1028, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Descriptor.findDefinitionsByTag
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden) { $definitions = []; $tags = $builder->findTags(); asort($tags); foreach ($tags as $tag) { foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) { $definition = $this->resolveServiceDefinition($builder, $serviceId); if ($showHidden xor '.' === ($serviceId[0] ?? null)) { continue; } if (!isset($definitions[$tag])) { $definitions[$tag] = []; } $definitions[$tag][$serviceId] = $definition; } } return $definitions; }
php
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden) { $definitions = []; $tags = $builder->findTags(); asort($tags); foreach ($tags as $tag) { foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) { $definition = $this->resolveServiceDefinition($builder, $serviceId); if ($showHidden xor '.' === ($serviceId[0] ?? null)) { continue; } if (!isset($definitions[$tag])) { $definitions[$tag] = []; } $definitions[$tag][$serviceId] = $definition; } } return $definitions; }
[ "protected", "function", "findDefinitionsByTag", "(", "ContainerBuilder", "$", "builder", ",", "$", "showHidden", ")", "{", "$", "definitions", "=", "[", "]", ";", "$", "tags", "=", "$", "builder", "->", "findTags", "(", ")", ";", "asort", "(", "$", "tag...
@param ContainerBuilder $builder @param bool $showHidden @return array
[ "@param", "ContainerBuilder", "$builder", "@param", "bool", "$showHidden" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php#L257-L280
train
Finds all service definitions tagged with the given tags and returns them as an array.
[ 30522, 5123, 3853, 2424, 3207, 16294, 22753, 14478, 15900, 1006, 11661, 8569, 23891, 2099, 1002, 12508, 1010, 1002, 2265, 27511, 4181, 1007, 1063, 1002, 15182, 1027, 1031, 1033, 1025, 1002, 22073, 1027, 1002, 12508, 1011, 1028, 2424, 15900, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Sqlite.php
Zend_Cache_Backend_Sqlite.remove
public function remove($id) { $this->_checkAndBuildStructure(); $res = $this->_query("SELECT COUNT(*) AS nbr FROM cache WHERE id='$id'"); $result1 = @sqlite_fetch_single($res); $result2 = $this->_query("DELETE FROM cache WHERE id='$id'"); $result3 = $this->_query("DELETE FROM tag WHERE id='$id'"); $this->_automaticVacuum(); return ($result1 && $result2 && $result3); }
php
public function remove($id) { $this->_checkAndBuildStructure(); $res = $this->_query("SELECT COUNT(*) AS nbr FROM cache WHERE id='$id'"); $result1 = @sqlite_fetch_single($res); $result2 = $this->_query("DELETE FROM cache WHERE id='$id'"); $result3 = $this->_query("DELETE FROM tag WHERE id='$id'"); $this->_automaticVacuum(); return ($result1 && $result2 && $result3); }
[ "public", "function", "remove", "(", "$", "id", ")", "{", "$", "this", "->", "_checkAndBuildStructure", "(", ")", ";", "$", "res", "=", "$", "this", "->", "_query", "(", "\"SELECT COUNT(*) AS nbr FROM cache WHERE id='$id'\"", ")", ";", "$", "result1", "=", "...
Remove a cache record @param string $id Cache id @return boolean True if no problem
[ "Remove", "a", "cache", "record" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L190-L199
train
Removes the cache and tag from the cache and tag tables
[ 30522, 2270, 3853, 6366, 1006, 1002, 8909, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 4638, 5685, 8569, 4014, 30524, 1028, 1035, 23032, 1006, 1000, 7276, 4175, 1006, 1008, 1007, 2004, 1050, 19892, 2013, 17053, 2073, 8909, 1027, 1005, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Registry.php
Zend_Registry.isRegistered
public static function isRegistered($index) { if (self::$_registry === null) { return false; } return self::$_registry->offsetExists($index); }
php
public static function isRegistered($index) { if (self::$_registry === null) { return false; } return self::$_registry->offsetExists($index); }
[ "public", "static", "function", "isRegistered", "(", "$", "index", ")", "{", "if", "(", "self", "::", "$", "_registry", "===", "null", ")", "{", "return", "false", ";", "}", "return", "self", "::", "$", "_registry", "->", "offsetExists", "(", "$", "ind...
Returns TRUE if the $index is a named value in the registry, or FALSE if $index was not found in the registry. @param string $index @return boolean
[ "Returns", "TRUE", "if", "the", "$index", "is", "a", "named", "value", "in", "the", "registry", "or", "FALSE", "if", "$index", "was", "not", "found", "in", "the", "registry", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Registry.php#L179-L185
train
Check if the index is registered in the registry
[ 30522, 2270, 10763, 3853, 2003, 2890, 24063, 6850, 1006, 1002, 5950, 1007, 1063, 2065, 1006, 2969, 1024, 1024, 1002, 1035, 15584, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 6270, 1025, 1065, 2709, 2969, 1024, 1024, 1002, 1035, 15584, 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...
guzzle/guzzle
src/HandlerStack.php
HandlerStack.debugCallable
private function debugCallable($fn) { if (is_string($fn)) { return "callable({$fn})"; } if (is_array($fn)) { return is_string($fn[0]) ? "callable({$fn[0]}::{$fn[1]})" : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; } return 'callable(' . spl_object_hash($fn) . ')'; }
php
private function debugCallable($fn) { if (is_string($fn)) { return "callable({$fn})"; } if (is_array($fn)) { return is_string($fn[0]) ? "callable({$fn[0]}::{$fn[1]})" : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; } return 'callable(' . spl_object_hash($fn) . ')'; }
[ "private", "function", "debugCallable", "(", "$", "fn", ")", "{", "if", "(", "is_string", "(", "$", "fn", ")", ")", "{", "return", "\"callable({$fn})\"", ";", "}", "if", "(", "is_array", "(", "$", "fn", ")", ")", "{", "return", "is_string", "(", "$",...
Provides a debug string for a given callable. @param array|callable $fn Function to write as a string. @return string
[ "Provides", "a", "debug", "string", "for", "a", "given", "callable", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/HandlerStack.php#L259-L272
train
Debug function for callable
[ 30522, 2797, 3853, 2139, 8569, 18195, 25425, 3468, 1006, 1002, 1042, 2078, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 1042, 2078, 1007, 1007, 1063, 2709, 1000, 2655, 3085, 1006, 1063, 1002, 1042, 2078, 1065, 1007, 1000, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Concerns/ReplacesAttributes.php
ReplacesAttributes.replaceInArray
protected function replaceInArray($message, $attribute, $rule, $parameters) { return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); }
php
protected function replaceInArray($message, $attribute, $rule, $parameters) { return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); }
[ "protected", "function", "replaceInArray", "(", "$", "message", ",", "$", "attribute", ",", "$", "rule", ",", "$", "parameters", ")", "{", "return", "str_replace", "(", "':other'", ",", "$", "this", "->", "getDisplayableAttribute", "(", "$", "parameters", "[...
Replace all place-holders for the in_array rule. @param string $message @param string $attribute @param string $rule @param array $parameters @return string
[ "Replace", "all", "place", "-", "holders", "for", "the", "in_array", "rule", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php#L148-L151
train
Replace all occurrences of the rule with the value of the attribute in the array
[ 30522, 5123, 3853, 5672, 3981, 11335, 2100, 1006, 1002, 4471, 1010, 1002, 17961, 1010, 1002, 3627, 1010, 1002, 11709, 1007, 1063, 2709, 2358, 2099, 1035, 5672, 1006, 1005, 1024, 2060, 1005, 1010, 1002, 2023, 1011, 1028, 2131, 10521, 13068, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Classification/Linear/DecisionStump.php
DecisionStump.predictProbability
protected function predictProbability(array $sample, $label): float { $predicted = $this->predictSampleBinary($sample); if ((string) $predicted == (string) $label) { return $this->prob[$label]; } return 0.0; }
php
protected function predictProbability(array $sample, $label): float { $predicted = $this->predictSampleBinary($sample); if ((string) $predicted == (string) $label) { return $this->prob[$label]; } return 0.0; }
[ "protected", "function", "predictProbability", "(", "array", "$", "sample", ",", "$", "label", ")", ":", "float", "{", "$", "predicted", "=", "$", "this", "->", "predictSampleBinary", "(", "$", "sample", ")", ";", "if", "(", "(", "string", ")", "$", "p...
Returns the probability of the sample of belonging to the given label Probability of a sample is calculated as the proportion of the label within the labels of the training samples in the decision node @param mixed $label
[ "Returns", "the", "probability", "of", "the", "sample", "of", "belonging", "to", "the", "given", "label" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Linear/DecisionStump.php#L294-L302
train
Returns the probability of the sample with the given label.
[ 30522, 5123, 3853, 16014, 21572, 3676, 8553, 1006, 9140, 1002, 7099, 1010, 1002, 3830, 1007, 1024, 14257, 1063, 1002, 10173, 1027, 1002, 2023, 1011, 1028, 16014, 21559, 10814, 21114, 2854, 1006, 1002, 7099, 1007, 1025, 2065, 1006, 1006, 516...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.substrToString
public static function substrToString($haystack, $needle, $case_sensitive = true) { $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos'; if (static::contains($haystack, $needle, $case_sensitive)) { return mb_substr($haystack, 0, $compare_func($haystack, $needle, $case_sensitive)); } return $haystack; }
php
public static function substrToString($haystack, $needle, $case_sensitive = true) { $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos'; if (static::contains($haystack, $needle, $case_sensitive)) { return mb_substr($haystack, 0, $compare_func($haystack, $needle, $case_sensitive)); } return $haystack; }
[ "public", "static", "function", "substrToString", "(", "$", "haystack", ",", "$", "needle", ",", "$", "case_sensitive", "=", "true", ")", "{", "$", "compare_func", "=", "$", "case_sensitive", "?", "'mb_strpos'", ":", "'mb_stripos'", ";", "if", "(", "static",...
Returns the substring of a string up to a specified needle. if not found, return the whole haystack @param string $haystack @param string $needle @param bool $case_sensitive @return string
[ "Returns", "the", "substring", "of", "a", "string", "up", "to", "a", "specified", "needle", ".", "if", "not", "found", "return", "the", "whole", "haystack" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L192-L201
train
Returns the substring of the string that contains the needle
[ 30522, 2270, 10763, 3853, 4942, 3367, 5339, 14122, 4892, 1006, 1002, 29051, 2696, 3600, 1010, 1002, 12201, 1010, 1002, 2553, 1035, 7591, 1027, 2995, 1007, 1063, 1002, 12826, 1035, 4569, 2278, 1027, 1002, 2553, 1035, 7591, 1029, 1005, 16914,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Simple/ArrayCache.php
ArrayCache.deleteMultiple
public function deleteMultiple($keys) { if (!\is_array($keys) && !$keys instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { $this->delete($key); } return true; }
php
public function deleteMultiple($keys) { if (!\is_array($keys) && !$keys instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { $this->delete($key); } return true; }
[ "public", "function", "deleteMultiple", "(", "$", "keys", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "keys", ")", "&&", "!", "$", "keys", "instanceof", "\\", "Traversable", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ArrayCache.php#L90-L100
train
Delete multiple cache entries
[ 30522, 2270, 3853, 3972, 12870, 12274, 7096, 11514, 2571, 1006, 1002, 6309, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 6309, 1007, 1004, 1004, 999, 1002, 6309, 6013, 11253, 1032, 29053, 3085, 1007, 1063, 5466, 2047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/behaviors/RelationController.php
RelationController.evalToolbarButtons
protected function evalToolbarButtons() { $buttons = $this->getConfig('view[toolbarButtons]'); if ($buttons === false) { return null; } elseif (is_string($buttons)) { return array_map('trim', explode('|', $buttons)); } elseif (is_array($buttons)) { return $buttons; } if ($this->manageMode == 'pivot') { return ['add', 'remove']; } switch ($this->relationType) { case 'hasMany': case 'morphMany': case 'morphToMany': case 'morphedByMany': case 'belongsToMany': return ['create', 'add', 'delete', 'remove']; case 'hasOne': case 'morphOne': case 'belongsTo': return ['create', 'update', 'link', 'delete', 'unlink']; } }
php
protected function evalToolbarButtons() { $buttons = $this->getConfig('view[toolbarButtons]'); if ($buttons === false) { return null; } elseif (is_string($buttons)) { return array_map('trim', explode('|', $buttons)); } elseif (is_array($buttons)) { return $buttons; } if ($this->manageMode == 'pivot') { return ['add', 'remove']; } switch ($this->relationType) { case 'hasMany': case 'morphMany': case 'morphToMany': case 'morphedByMany': case 'belongsToMany': return ['create', 'add', 'delete', 'remove']; case 'hasOne': case 'morphOne': case 'belongsTo': return ['create', 'update', 'link', 'delete', 'unlink']; } }
[ "protected", "function", "evalToolbarButtons", "(", ")", "{", "$", "buttons", "=", "$", "this", "->", "getConfig", "(", "'view[toolbarButtons]'", ")", ";", "if", "(", "$", "buttons", "===", "false", ")", "{", "return", "null", ";", "}", "elseif", "(", "i...
Determine the default buttons based on the model relationship type. @return string
[ "Determine", "the", "default", "buttons", "based", "on", "the", "model", "relationship", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/RelationController.php#L1373-L1404
train
Returns the toolbar buttons for the current relation
[ 30522, 5123, 3853, 9345, 23223, 4747, 8237, 8569, 15474, 2015, 1006, 1007, 1063, 1002, 11287, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 8873, 2290, 1006, 1005, 3193, 1031, 6994, 8237, 8569, 15474, 2015, 1033, 1005, 1007, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/View.php
View.clearCompiledTemplates
public static function clearCompiledTemplates() { $twig = StaticContainer::get(Twig::class); $environment = $twig->getTwigEnvironment(); $environment->clearTemplateCache(); $cacheDirectory = $environment->getCache(); if (!empty($cacheDirectory) && is_dir($cacheDirectory) ) { $environment->clearCacheFiles(); } }
php
public static function clearCompiledTemplates() { $twig = StaticContainer::get(Twig::class); $environment = $twig->getTwigEnvironment(); $environment->clearTemplateCache(); $cacheDirectory = $environment->getCache(); if (!empty($cacheDirectory) && is_dir($cacheDirectory) ) { $environment->clearCacheFiles(); } }
[ "public", "static", "function", "clearCompiledTemplates", "(", ")", "{", "$", "twig", "=", "StaticContainer", "::", "get", "(", "Twig", "::", "class", ")", ";", "$", "environment", "=", "$", "twig", "->", "getTwigEnvironment", "(", ")", ";", "$", "environm...
Clear compiled Twig templates @ignore
[ "Clear", "compiled", "Twig", "templates" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/View.php#L425-L437
train
Clear compiled templates
[ 30522, 2270, 10763, 3853, 3154, 9006, 22090, 11927, 6633, 15725, 2015, 1006, 1007, 1063, 1002, 1056, 16279, 1027, 10763, 8663, 18249, 2121, 1024, 1024, 2131, 1006, 1056, 16279, 1024, 1024, 2465, 1007, 1025, 1002, 4044, 1027, 1002, 1056, 162...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Renderer/Default.php
HTML_QuickForm2_Renderer_Default.outputGroupedErrors
public function outputGroupedErrors() { if (empty($this->errors)) { return ''; } if (!empty($this->options['errors_prefix'])) { $errorHtml = str_replace(array('<qf:message>', '</qf:message>', '{message}'), array('', '', $this->options['errors_prefix']), $this->templatesForClass['special:error']['prefix']); } else { $errorHtml = preg_replace('!<qf:message>.*</qf:message>!isU', '', $this->templatesForClass['special:error']['prefix']); } $errorHtml .= implode($this->templatesForClass['special:error']['separator'], $this->errors); if (!empty($this->options['errors_suffix'])) { $errorHtml .= str_replace(array('<qf:message>', '</qf:message>', '{message}'), array('', '', $this->options['errors_suffix']), $this->templatesForClass['special:error']['suffix']); } else { $errorHtml .= preg_replace('!<qf:message>.*</qf:message>!isU', '', $this->templatesForClass['special:error']['suffix']); } return $errorHtml; }
php
public function outputGroupedErrors() { if (empty($this->errors)) { return ''; } if (!empty($this->options['errors_prefix'])) { $errorHtml = str_replace(array('<qf:message>', '</qf:message>', '{message}'), array('', '', $this->options['errors_prefix']), $this->templatesForClass['special:error']['prefix']); } else { $errorHtml = preg_replace('!<qf:message>.*</qf:message>!isU', '', $this->templatesForClass['special:error']['prefix']); } $errorHtml .= implode($this->templatesForClass['special:error']['separator'], $this->errors); if (!empty($this->options['errors_suffix'])) { $errorHtml .= str_replace(array('<qf:message>', '</qf:message>', '{message}'), array('', '', $this->options['errors_suffix']), $this->templatesForClass['special:error']['suffix']); } else { $errorHtml .= preg_replace('!<qf:message>.*</qf:message>!isU', '', $this->templatesForClass['special:error']['suffix']); } return $errorHtml; }
[ "public", "function", "outputGroupedErrors", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "errors", ")", ")", "{", "return", "''", ";", "}", "if", "(", "!", "empty", "(", "$", "this", "->", "options", "[", "'errors_prefix'", "]", ")", ...
Creates a error list if 'group_errors' option is true @return string HTML with a list of all validation errors
[ "Creates", "a", "error", "list", "if", "group_errors", "option", "is", "true" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Default.php#L432-L455
train
Outputs the grouped errors
[ 30522, 2270, 3853, 6434, 17058, 14728, 18933, 2869, 1006, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 10697, 1007, 1007, 1063, 2709, 1005, 1005, 1025, 1065, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 7047, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Tools.php
Tools.disableRefreshButton
public function disableRefreshButton(bool $disable = true) { $this->tools = $this->tools->map(function (AbstractTool $tool) use ($disable) { if ($tool instanceof RefreshButton) { return $tool->disable($disable); } return $tool; }); }
php
public function disableRefreshButton(bool $disable = true) { $this->tools = $this->tools->map(function (AbstractTool $tool) use ($disable) { if ($tool instanceof RefreshButton) { return $tool->disable($disable); } return $tool; }); }
[ "public", "function", "disableRefreshButton", "(", "bool", "$", "disable", "=", "true", ")", "{", "$", "this", "->", "tools", "=", "$", "this", "->", "tools", "->", "map", "(", "function", "(", "AbstractTool", "$", "tool", ")", "use", "(", "$", "disabl...
Disable refresh button. @return void
[ "Disable", "refresh", "button", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools.php#L102-L111
train
Disable refresh button
[ 30522, 2270, 3853, 4487, 19150, 2890, 19699, 9953, 8569, 15474, 1006, 22017, 2140, 1002, 4487, 19150, 1027, 2995, 1007, 1063, 1002, 2023, 1011, 1028, 5906, 1027, 1002, 2023, 1011, 1028, 5906, 1011, 1028, 4949, 1006, 3853, 1006, 10061, 3406,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MailManager.php
MailManager.registerMailLayouts
public function registerMailLayouts(array $definitions) { if (!$this->registeredLayouts) { $this->registeredLayouts = []; } $this->registeredLayouts = $definitions + $this->registeredLayouts; }
php
public function registerMailLayouts(array $definitions) { if (!$this->registeredLayouts) { $this->registeredLayouts = []; } $this->registeredLayouts = $definitions + $this->registeredLayouts; }
[ "public", "function", "registerMailLayouts", "(", "array", "$", "definitions", ")", "{", "if", "(", "!", "$", "this", "->", "registeredLayouts", ")", "{", "$", "this", "->", "registeredLayouts", "=", "[", "]", ";", "}", "$", "this", "->", "registeredLayout...
Registers mail views and manageable layouts.
[ "Registers", "mail", "views", "and", "manageable", "layouts", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MailManager.php#L450-L457
train
Register the mail layouts
[ 30522, 2270, 3853, 4236, 21397, 8485, 12166, 1006, 9140, 1002, 15182, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 5068, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/Kernel/Traits/Observable.php
Observable.makeClosure
protected function makeClosure($handler) { if (is_callable($handler)) { return $handler; } if (is_string($handler)) { if (!class_exists($handler)) { throw new InvalidArgumentException(sprintf('Class "%s" not exists.', $handler)); } if (!in_array(EventHandlerInterface::class, (new \ReflectionClass($handler))->getInterfaceNames(), true)) { throw new InvalidArgumentException(sprintf('Class "%s" not an instance of "%s".', $handler, EventHandlerInterface::class)); } return function ($payload) use ($handler) { return (new $handler($this->app ?? null))->handle($payload); }; } if ($handler instanceof EventHandlerInterface) { return function () use ($handler) { return $handler->handle(...func_get_args()); }; } throw new InvalidArgumentException('No valid handler is found in arguments.'); }
php
protected function makeClosure($handler) { if (is_callable($handler)) { return $handler; } if (is_string($handler)) { if (!class_exists($handler)) { throw new InvalidArgumentException(sprintf('Class "%s" not exists.', $handler)); } if (!in_array(EventHandlerInterface::class, (new \ReflectionClass($handler))->getInterfaceNames(), true)) { throw new InvalidArgumentException(sprintf('Class "%s" not an instance of "%s".', $handler, EventHandlerInterface::class)); } return function ($payload) use ($handler) { return (new $handler($this->app ?? null))->handle($payload); }; } if ($handler instanceof EventHandlerInterface) { return function () use ($handler) { return $handler->handle(...func_get_args()); }; } throw new InvalidArgumentException('No valid handler is found in arguments.'); }
[ "protected", "function", "makeClosure", "(", "$", "handler", ")", "{", "if", "(", "is_callable", "(", "$", "handler", ")", ")", "{", "return", "$", "handler", ";", "}", "if", "(", "is_string", "(", "$", "handler", ")", ")", "{", "if", "(", "!", "cl...
@param $handler @return \Closure @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException @throws \ReflectionException
[ "@param", "$handler" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Traits/Observable.php#L204-L231
train
Makes a closure that will handle the request
[ 30522, 5123, 3853, 2191, 20464, 2891, 5397, 1006, 1002, 28213, 1007, 1063, 2065, 1006, 2003, 1035, 2655, 3085, 1006, 1002, 28213, 1007, 1007, 1063, 2709, 1002, 28213, 1025, 1065, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 28213, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Admin.php
Admin.menu
public function menu() { if (!empty($this->menu)) { return $this->menu; } $menuModel = config('admin.database.menu_model'); return $this->menu = (new $menuModel())->toTree(); }
php
public function menu() { if (!empty($this->menu)) { return $this->menu; } $menuModel = config('admin.database.menu_model'); return $this->menu = (new $menuModel())->toTree(); }
[ "public", "function", "menu", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "menu", ")", ")", "{", "return", "$", "this", "->", "menu", ";", "}", "$", "menuModel", "=", "config", "(", "'admin.database.menu_model'", ")", ";", "return...
Left sider-bar menu. @return array
[ "Left", "sider", "-", "bar", "menu", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Admin.php#L158-L167
train
Get menu tree
[ 30522, 2270, 3853, 12183, 1006, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 12183, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 12183, 1025, 1065, 1002, 12183, 5302, 9247, 1027, 9530, 8873, 2290, 1006, 1005, 4748, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.setReplyTo
public function setReplyTo($email, $name = null) { if (null !== $this->_replyTo) { /** * @see Zend_Mail_Exception */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception('Reply-To Header set twice'); } $email = $this->_filterEmail($email); $name = $this->_filterName($name); $this->_replyTo = $email; $this->_storeHeader('Reply-To', $this->_formatAddress($email, $name), true); return $this; }
php
public function setReplyTo($email, $name = null) { if (null !== $this->_replyTo) { /** * @see Zend_Mail_Exception */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception('Reply-To Header set twice'); } $email = $this->_filterEmail($email); $name = $this->_filterName($name); $this->_replyTo = $email; $this->_storeHeader('Reply-To', $this->_formatAddress($email, $name), true); return $this; }
[ "public", "function", "setReplyTo", "(", "$", "email", ",", "$", "name", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "_replyTo", ")", "{", "/**\n * @see Zend_Mail_Exception\n */", "// require_once 'Zend/Mail/Exception.ph...
Set Reply-To Header @param string $email @param string $name @return Zend_Mail @throws Zend_Mail_Exception if called more than one time
[ "Set", "Reply", "-", "To", "Header" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L699-L715
train
Set Reply - To
[ 30522, 2270, 3853, 2275, 2890, 22086, 3406, 1006, 1002, 10373, 1010, 1002, 2171, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 1035, 7514, 3406, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2156, 16729, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Filesystem/Filesystem.php
Filesystem.mkdir
public function mkdir($dirs, $mode = 0777) { foreach ($this->toIterable($dirs) as $dir) { if (is_dir($dir)) { continue; } if (!self::box('mkdir', $dir, $mode, true)) { if (!is_dir($dir)) { // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one if (self::$lastError) { throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir); } throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir); } } } }
php
public function mkdir($dirs, $mode = 0777) { foreach ($this->toIterable($dirs) as $dir) { if (is_dir($dir)) { continue; } if (!self::box('mkdir', $dir, $mode, true)) { if (!is_dir($dir)) { // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one if (self::$lastError) { throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir); } throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir); } } } }
[ "public", "function", "mkdir", "(", "$", "dirs", ",", "$", "mode", "=", "0777", ")", "{", "foreach", "(", "$", "this", "->", "toIterable", "(", "$", "dirs", ")", "as", "$", "dir", ")", "{", "if", "(", "is_dir", "(", "$", "dir", ")", ")", "{", ...
Creates a directory recursively. @param string|iterable $dirs The directory path @param int $mode The directory mode @throws IOException On any directory creation failure
[ "Creates", "a", "directory", "recursively", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Filesystem/Filesystem.php#L94-L111
train
Creates directories in the system
[ 30522, 2270, 3853, 12395, 4305, 2099, 1006, 1002, 16101, 2015, 1010, 1002, 5549, 1027, 5718, 2581, 2581, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2000, 21646, 3085, 1006, 1002, 16101, 2015, 1007, 2004, 1002, 16101, 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/Console/Scheduling/CommandBuilder.php
CommandBuilder.buildForegroundCommand
protected function buildForegroundCommand(Event $event) { $output = ProcessUtils::escapeArgument($event->output); return $this->ensureCorrectUser( $event, $event->command.($event->shouldAppendOutput ? ' >> ' : ' > ').$output.' 2>&1' ); }
php
protected function buildForegroundCommand(Event $event) { $output = ProcessUtils::escapeArgument($event->output); return $this->ensureCorrectUser( $event, $event->command.($event->shouldAppendOutput ? ' >> ' : ' > ').$output.' 2>&1' ); }
[ "protected", "function", "buildForegroundCommand", "(", "Event", "$", "event", ")", "{", "$", "output", "=", "ProcessUtils", "::", "escapeArgument", "(", "$", "event", "->", "output", ")", ";", "return", "$", "this", "->", "ensureCorrectUser", "(", "$", "eve...
Build the command for running the event in the foreground. @param \Illuminate\Console\Scheduling\Event $event @return string
[ "Build", "the", "command", "for", "running", "the", "event", "in", "the", "foreground", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/CommandBuilder.php#L31-L38
train
Build the foreground command.
[ 30522, 5123, 3853, 3857, 29278, 13910, 22494, 4859, 9006, 2386, 2094, 1006, 2724, 1002, 2724, 1007, 1063, 1002, 6434, 1027, 2832, 21823, 4877, 1024, 1024, 4019, 2906, 22850, 4765, 1006, 1002, 2724, 1011, 1028, 6434, 1007, 1025, 2709, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/models/ExportModel.php
ExportModel.processExportData
protected function processExportData($columns, $results, $options) { /* * Validate */ if (!$results) { throw new ApplicationException(Lang::get('backend::lang.import_export.empty_error')); } /* * Parse options */ $defaultOptions = [ 'firstRowTitles' => true, 'useOutput' => false, 'fileName' => 'export.csv', 'delimiter' => null, 'enclosure' => null, 'escape' => null ]; $options = array_merge($defaultOptions, $options); $columns = $this->exportExtendColumns($columns); /* * Prepare CSV */ $csv = CsvWriter::createFromFileObject(new SplTempFileObject); $csv->setOutputBOM(CsvWriter::BOM_UTF8); if ($options['delimiter'] !== null) { $csv->setDelimiter($options['delimiter']); } if ($options['enclosure'] !== null) { $csv->setEnclosure($options['enclosure']); } if ($options['escape'] !== null) { $csv->setEscape($options['escape']); } /* * Add headers */ if ($options['firstRowTitles']) { $headers = $this->getColumnHeaders($columns); $csv->insertOne($headers); } /* * Add records */ foreach ($results as $result) { $data = $this->matchDataToColumns($result, $columns); $csv->insertOne($data); } /* * Output */ if ($options['useOutput']) { $csv->output($options['fileName']); } /* * Save for download */ $csvName = uniqid('oc'); $csvPath = temp_path().'/'.$csvName; $output = $csv->__toString(); File::put($csvPath, $output); return $csvName; }
php
protected function processExportData($columns, $results, $options) { /* * Validate */ if (!$results) { throw new ApplicationException(Lang::get('backend::lang.import_export.empty_error')); } /* * Parse options */ $defaultOptions = [ 'firstRowTitles' => true, 'useOutput' => false, 'fileName' => 'export.csv', 'delimiter' => null, 'enclosure' => null, 'escape' => null ]; $options = array_merge($defaultOptions, $options); $columns = $this->exportExtendColumns($columns); /* * Prepare CSV */ $csv = CsvWriter::createFromFileObject(new SplTempFileObject); $csv->setOutputBOM(CsvWriter::BOM_UTF8); if ($options['delimiter'] !== null) { $csv->setDelimiter($options['delimiter']); } if ($options['enclosure'] !== null) { $csv->setEnclosure($options['enclosure']); } if ($options['escape'] !== null) { $csv->setEscape($options['escape']); } /* * Add headers */ if ($options['firstRowTitles']) { $headers = $this->getColumnHeaders($columns); $csv->insertOne($headers); } /* * Add records */ foreach ($results as $result) { $data = $this->matchDataToColumns($result, $columns); $csv->insertOne($data); } /* * Output */ if ($options['useOutput']) { $csv->output($options['fileName']); } /* * Save for download */ $csvName = uniqid('oc'); $csvPath = temp_path().'/'.$csvName; $output = $csv->__toString(); File::put($csvPath, $output); return $csvName; }
[ "protected", "function", "processExportData", "(", "$", "columns", ",", "$", "results", ",", "$", "options", ")", "{", "/*\n * Validate\n */", "if", "(", "!", "$", "results", ")", "{", "throw", "new", "ApplicationException", "(", "Lang", "::", ...
Converts a data collection to a CSV file.
[ "Converts", "a", "data", "collection", "to", "a", "CSV", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L71-L147
train
Process export data
[ 30522, 5123, 3853, 2832, 10288, 6442, 2850, 2696, 1006, 1002, 7753, 1010, 1002, 3463, 1010, 1002, 7047, 1007, 1063, 1013, 1008, 1008, 9398, 3686, 1008, 1013, 2065, 1006, 999, 1002, 3463, 1007, 1063, 5466, 2047, 4646, 10288, 24422, 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...
octobercms/october
modules/cms/classes/Router.php
Router.getRouterObject
protected function getRouterObject() { if ($this->routerObj !== null) { return $this->routerObj; } /* * Load up each route rule */ $router = new RainRouter(); foreach ($this->getUrlMap() as $pageInfo) { $router->route($pageInfo['file'], $pageInfo['pattern']); } /* * Sort all the rules */ $router->sortRules(); return $this->routerObj = $router; }
php
protected function getRouterObject() { if ($this->routerObj !== null) { return $this->routerObj; } /* * Load up each route rule */ $router = new RainRouter(); foreach ($this->getUrlMap() as $pageInfo) { $router->route($pageInfo['file'], $pageInfo['pattern']); } /* * Sort all the rules */ $router->sortRules(); return $this->routerObj = $router; }
[ "protected", "function", "getRouterObject", "(", ")", "{", "if", "(", "$", "this", "->", "routerObj", "!==", "null", ")", "{", "return", "$", "this", "->", "routerObj", ";", "}", "/*\n * Load up each route rule\n */", "$", "router", "=", "new", ...
Autoloads the URL map only allowing a single execution. @return array Returns the URL map.
[ "Autoloads", "the", "URL", "map", "only", "allowing", "a", "single", "execution", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Router.php#L184-L204
train
Get router object
[ 30522, 5123, 3853, 2131, 22494, 3334, 16429, 20614, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2799, 3217, 2497, 3501, 999, 1027, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2799, 3217, 2497, 3501, 1025, 1065, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/console/OctoberFresh.php
OctoberFresh.handle
public function handle() { if (!$this->confirmToProceed('Are you sure?')) { return; } $demoThemePath = themes_path().'/demo'; if (File::exists($demoThemePath)) { Artisan::call('plugin:remove', ['name' => 'October.Demo', '--force' => true]); File::deleteDirectory($demoThemePath); $this->info('Demo has been removed! Enjoy a fresh start.'); } else { $this->error('Demo theme is already removed.'); } }
php
public function handle() { if (!$this->confirmToProceed('Are you sure?')) { return; } $demoThemePath = themes_path().'/demo'; if (File::exists($demoThemePath)) { Artisan::call('plugin:remove', ['name' => 'October.Demo', '--force' => true]); File::deleteDirectory($demoThemePath); $this->info('Demo has been removed! Enjoy a fresh start.'); } else { $this->error('Demo theme is already removed.'); } }
[ "public", "function", "handle", "(", ")", "{", "if", "(", "!", "$", "this", "->", "confirmToProceed", "(", "'Are you sure?'", ")", ")", "{", "return", ";", "}", "$", "demoThemePath", "=", "themes_path", "(", ")", ".", "'/demo'", ";", "if", "(", "File",...
Execute the console command.
[ "Execute", "the", "console", "command", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/OctoberFresh.php#L33-L50
train
Remove demo theme
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 12210, 14399, 3217, 3401, 2098, 1006, 1005, 2024, 2017, 2469, 1029, 1005, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 9703, 10760, 4168, 15069, 1027, 6991, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
PHPMailer/PHPMailer
src/PHPMailer.php
PHPMailer.setMessageType
protected function setMessageType() { $type = []; if ($this->alternativeExists()) { $type[] = 'alt'; } if ($this->inlineImageExists()) { $type[] = 'inline'; } if ($this->attachmentExists()) { $type[] = 'attach'; } $this->message_type = implode('_', $type); if ('' == $this->message_type) { //The 'plain' message_type refers to the message having a single body element, not that it is plain-text $this->message_type = 'plain'; } }
php
protected function setMessageType() { $type = []; if ($this->alternativeExists()) { $type[] = 'alt'; } if ($this->inlineImageExists()) { $type[] = 'inline'; } if ($this->attachmentExists()) { $type[] = 'attach'; } $this->message_type = implode('_', $type); if ('' == $this->message_type) { //The 'plain' message_type refers to the message having a single body element, not that it is plain-text $this->message_type = 'plain'; } }
[ "protected", "function", "setMessageType", "(", ")", "{", "$", "type", "=", "[", "]", ";", "if", "(", "$", "this", "->", "alternativeExists", "(", ")", ")", "{", "$", "type", "[", "]", "=", "'alt'", ";", "}", "if", "(", "$", "this", "->", "inline...
Set the message type. PHPMailer only supports some preset message types, not arbitrary MIME structures.
[ "Set", "the", "message", "type", ".", "PHPMailer", "only", "supports", "some", "preset", "message", "types", "not", "arbitrary", "MIME", "structures", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L2772-L2789
train
Set message type
[ 30522, 5123, 3853, 2275, 7834, 3736, 18150, 18863, 1006, 1007, 1063, 1002, 2828, 1027, 1031, 1033, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 4522, 10288, 5130, 1006, 1007, 1007, 1063, 1002, 2828, 1031, 1033, 1027, 1005, 12456, 1005, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Util/OrderedHashMap.php
OrderedHashMap.offsetSet
public function offsetSet($key, $value) { if (null === $key || !isset($this->elements[$key])) { if (null === $key) { $key = [] === $this->orderedKeys // If the array is empty, use 0 as key ? 0 // Imitate PHP behavior of generating a key that equals // the highest existing integer key + 1 : 1 + (int) max($this->orderedKeys); } $this->orderedKeys[] = (string) $key; } $this->elements[$key] = $value; }
php
public function offsetSet($key, $value) { if (null === $key || !isset($this->elements[$key])) { if (null === $key) { $key = [] === $this->orderedKeys // If the array is empty, use 0 as key ? 0 // Imitate PHP behavior of generating a key that equals // the highest existing integer key + 1 : 1 + (int) max($this->orderedKeys); } $this->orderedKeys[] = (string) $key; } $this->elements[$key] = $value; }
[ "public", "function", "offsetSet", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "null", "===", "$", "key", "||", "!", "isset", "(", "$", "this", "->", "elements", "[", "$", "key", "]", ")", ")", "{", "if", "(", "null", "===", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Util/OrderedHashMap.php#L124-L140
train
Set the value of the element at the specified offset
[ 30522, 2270, 3853, 16396, 13462, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3145, 1064, 1064, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3787, 1031, 1002, 3145, 1033, 1007, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Bus/Queueable.php
Queueable.dispatchNextJobInChain
public function dispatchNextJobInChain() { if (! empty($this->chained)) { dispatch(tap(unserialize(array_shift($this->chained)), function ($next) { $next->chained = $this->chained; $next->onConnection($next->connection ?: $this->chainConnection); $next->onQueue($next->queue ?: $this->chainQueue); $next->chainConnection = $this->chainConnection; $next->chainQueue = $this->chainQueue; })); } }
php
public function dispatchNextJobInChain() { if (! empty($this->chained)) { dispatch(tap(unserialize(array_shift($this->chained)), function ($next) { $next->chained = $this->chained; $next->onConnection($next->connection ?: $this->chainConnection); $next->onQueue($next->queue ?: $this->chainQueue); $next->chainConnection = $this->chainConnection; $next->chainQueue = $this->chainQueue; })); } }
[ "public", "function", "dispatchNextJobInChain", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "chained", ")", ")", "{", "dispatch", "(", "tap", "(", "unserialize", "(", "array_shift", "(", "$", "this", "->", "chained", ")", ")", ",", ...
Dispatch the next job on the chain. @return void
[ "Dispatch", "the", "next", "job", "on", "the", "chain", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Bus/Queueable.php#L136-L149
train
Dispatch next job in chain
[ 30522, 2270, 3853, 18365, 2638, 18413, 5558, 8428, 24925, 2078, 1006, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 22075, 1007, 1007, 1063, 18365, 1006, 11112, 1006, 4895, 8043, 4818, 4697, 1006, 9140, 1035, 5670, 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...
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.onlyOne
public function onlyOne($tempDir = null, callable $whenOverlapping = null) { if ($tempDir === null || !is_dir($tempDir)) { $tempDir = $this->tempDir; } $this->lockFile = implode('/', [ trim($tempDir), trim($this->id) . '.lock', ]); if ($whenOverlapping) { $this->whenOverlapping = $whenOverlapping; } else { $this->whenOverlapping = function () { return false; }; } return $this; }
php
public function onlyOne($tempDir = null, callable $whenOverlapping = null) { if ($tempDir === null || !is_dir($tempDir)) { $tempDir = $this->tempDir; } $this->lockFile = implode('/', [ trim($tempDir), trim($this->id) . '.lock', ]); if ($whenOverlapping) { $this->whenOverlapping = $whenOverlapping; } else { $this->whenOverlapping = function () { return false; }; } return $this; }
[ "public", "function", "onlyOne", "(", "$", "tempDir", "=", "null", ",", "callable", "$", "whenOverlapping", "=", "null", ")", "{", "if", "(", "$", "tempDir", "===", "null", "||", "!", "is_dir", "(", "$", "tempDir", ")", ")", "{", "$", "tempDir", "=",...
This will prevent the Job from overlapping. It prevents another instance of the same Job of being executed if the previous is still running. The job id is used as a filename for the lock file. @param string $tempDir The directory path for the lock files @param callable $whenOverlapping A callback to ignore job overlapping @return self
[ "This", "will", "prevent", "the", "Job", "from", "overlapping", ".", "It", "prevents", "another", "instance", "of", "the", "same", "Job", "of", "being", "executed", "if", "the", "previous", "is", "still", "running", ".", "The", "job", "id", "is", "used", ...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L223-L241
train
Only one file
[ 30522, 2270, 3853, 2069, 5643, 1006, 1002, 8915, 8737, 4305, 2099, 1027, 19701, 1010, 2655, 3085, 1002, 2043, 7840, 2721, 14853, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 8915, 8737, 4305, 2099, 1027, 1027, 1027, 19701, 1064, 1064, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php
DataUriNormalizer.getMimeType
private function getMimeType(\SplFileInfo $object) { if ($object instanceof File) { return $object->getMimeType(); } if ($this->mimeTypeGuesser instanceof DeprecatedMimeTypeGuesserInterface && $mimeType = $this->mimeTypeGuesser->guess($object->getPathname())) { return $mimeType; } elseif ($this->mimeTypeGuesser && $mimeType = $this->mimeTypeGuesser->guessMimeType($object->getPathname())) { return $mimeType; } return 'application/octet-stream'; }
php
private function getMimeType(\SplFileInfo $object) { if ($object instanceof File) { return $object->getMimeType(); } if ($this->mimeTypeGuesser instanceof DeprecatedMimeTypeGuesserInterface && $mimeType = $this->mimeTypeGuesser->guess($object->getPathname())) { return $mimeType; } elseif ($this->mimeTypeGuesser && $mimeType = $this->mimeTypeGuesser->guessMimeType($object->getPathname())) { return $mimeType; } return 'application/octet-stream'; }
[ "private", "function", "getMimeType", "(", "\\", "SplFileInfo", "$", "object", ")", "{", "if", "(", "$", "object", "instanceof", "File", ")", "{", "return", "$", "object", "->", "getMimeType", "(", ")", ";", "}", "if", "(", "$", "this", "->", "mimeType...
Gets the mime type of the object. Defaults to application/octet-stream. @param \SplFileInfo $object @return string
[ "Gets", "the", "mime", "type", "of", "the", "object", ".", "Defaults", "to", "application", "/", "octet", "-", "stream", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php#L151-L164
train
Returns the mime type of the file
[ 30522, 2797, 3853, 2131, 4328, 11368, 18863, 1006, 1032, 11867, 10270, 9463, 2378, 14876, 1002, 4874, 1007, 1063, 2065, 1006, 1002, 4874, 6013, 11253, 5371, 1007, 1063, 2709, 1002, 4874, 1011, 1028, 2131, 4328, 11368, 18863, 1006, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
HasRelationships.getMorphClass
public function getMorphClass() { $morphMap = Relation::morphMap(); if (! empty($morphMap) && in_array(static::class, $morphMap)) { return array_search(static::class, $morphMap, true); } return static::class; }
php
public function getMorphClass() { $morphMap = Relation::morphMap(); if (! empty($morphMap) && in_array(static::class, $morphMap)) { return array_search(static::class, $morphMap, true); } return static::class; }
[ "public", "function", "getMorphClass", "(", ")", "{", "$", "morphMap", "=", "Relation", "::", "morphMap", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "morphMap", ")", "&&", "in_array", "(", "static", "::", "class", ",", "$", "morphMap", ")", ")...
Get the class name for polymorphic relations. @return string
[ "Get", "the", "class", "name", "for", "polymorphic", "relations", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L701-L710
train
Get the morph class name
[ 30522, 2270, 3853, 2131, 5302, 14536, 16257, 27102, 1006, 1007, 1063, 1002, 22822, 8458, 2863, 2361, 1027, 7189, 1024, 1024, 22822, 8458, 2863, 2361, 1006, 1007, 1025, 2065, 1006, 999, 4064, 1006, 1002, 22822, 8458, 2863, 2361, 1007, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
TagAwareAdapter.deleteItems
public function deleteItems(array $keys) { foreach ($keys as $key) { if ('' !== $key && \is_string($key)) { $keys[] = static::TAGS_PREFIX.$key; } } return $this->pool->deleteItems($keys); }
php
public function deleteItems(array $keys) { foreach ($keys as $key) { if ('' !== $key && \is_string($key)) { $keys[] = static::TAGS_PREFIX.$key; } } return $this->pool->deleteItems($keys); }
[ "public", "function", "deleteItems", "(", "array", "$", "keys", ")", "{", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "if", "(", "''", "!==", "$", "key", "&&", "\\", "is_string", "(", "$", "key", ")", ")", "{", "$", "keys", "[", "]...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php#L235-L244
train
Delete items from the cache
[ 30522, 2270, 3853, 3972, 12870, 4221, 5244, 1006, 9140, 1002, 6309, 1007, 1063, 18921, 6776, 1006, 1002, 6309, 2004, 1002, 3145, 1007, 1063, 2065, 1006, 1005, 1005, 999, 1027, 1027, 1002, 3145, 1004, 1004, 1032, 2003, 1035, 5164, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Http/Concerns/InteractsWithInput.php
InteractsWithInput.anyFilled
public function anyFilled($keys) { $keys = is_array($keys) ? $keys : func_get_args(); foreach ($keys as $key) { if ($this->filled($key)) { return true; } } return false; }
php
public function anyFilled($keys) { $keys = is_array($keys) ? $keys : func_get_args(); foreach ($keys as $key) { if ($this->filled($key)) { return true; } } return false; }
[ "public", "function", "anyFilled", "(", "$", "keys", ")", "{", "$", "keys", "=", "is_array", "(", "$", "keys", ")", "?", "$", "keys", ":", "func_get_args", "(", ")", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "if", "(", "$", ...
Determine if the request contains a non-empty value for any of the given inputs. @param string|array $keys @return bool
[ "Determine", "if", "the", "request", "contains", "a", "non", "-", "empty", "value", "for", "any", "of", "the", "given", "inputs", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Concerns/InteractsWithInput.php#L140-L151
train
Any filled in the array
[ 30522, 2270, 3853, 2151, 8873, 11001, 1006, 1002, 6309, 1007, 1063, 1002, 6309, 1027, 2003, 1035, 9140, 1006, 1002, 6309, 1007, 1029, 1002, 6309, 1024, 4569, 2278, 1035, 2131, 1035, 12098, 5620, 1006, 1007, 1025, 18921, 6776, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/twig/ContentTokenParser.php
ContentTokenParser.parse
public function parse(Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $paramNames = []; $nodes = [$name]; $end = false; while (!$end) { $current = $stream->next(); switch ($current->getType()) { case Twig_Token::NAME_TYPE: $paramNames[] = $current->getValue(); $stream->expect(Twig_Token::OPERATOR_TYPE, '='); $nodes[] = $this->parser->getExpressionParser()->parseExpression(); break; case Twig_Token::BLOCK_END_TYPE: $end = true; break; default: throw new Twig_Error_Syntax( sprintf('Invalid syntax in the content tag. Line %s', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext() ); break; } } return new ContentNode(new Twig_Node($nodes), $paramNames, $token->getLine(), $this->getTag()); }
php
public function parse(Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $paramNames = []; $nodes = [$name]; $end = false; while (!$end) { $current = $stream->next(); switch ($current->getType()) { case Twig_Token::NAME_TYPE: $paramNames[] = $current->getValue(); $stream->expect(Twig_Token::OPERATOR_TYPE, '='); $nodes[] = $this->parser->getExpressionParser()->parseExpression(); break; case Twig_Token::BLOCK_END_TYPE: $end = true; break; default: throw new Twig_Error_Syntax( sprintf('Invalid syntax in the content tag. Line %s', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext() ); break; } } return new ContentNode(new Twig_Node($nodes), $paramNames, $token->getLine(), $this->getTag()); }
[ "public", "function", "parse", "(", "Twig_Token", "$", "token", ")", "{", "$", "lineno", "=", "$", "token", "->", "getLine", "(", ")", ";", "$", "stream", "=", "$", "this", "->", "parser", "->", "getStream", "(", ")", ";", "$", "name", "=", "$", ...
Parses a token and returns a node. @param Twig_Token $token A Twig_Token instance @return Twig_Node A Twig_Node instance
[ "Parses", "a", "token", "and", "returns", "a", "node", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/ContentTokenParser.php#L28-L63
train
Parse the content tag
[ 30522, 2270, 3853, 11968, 3366, 1006, 1056, 16279, 1035, 19204, 1002, 19204, 1007, 1063, 1002, 17517, 2080, 1027, 1002, 19204, 1011, 1028, 2131, 4179, 1006, 1007, 1025, 1002, 5460, 1027, 1002, 2023, 1011, 1028, 11968, 8043, 1011, 1028, 4152...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Page.php
Page.getMenuTypeInfo
public static function getMenuTypeInfo(string $type) { $result = []; if ($type === 'cms-page') { $theme = Theme::getActiveTheme(); $pages = self::listInTheme($theme, true); $references = []; foreach ($pages as $page) { $references[$page->getBaseFileName()] = $page->title . ' [' . $page->getBaseFileName() . ']'; } $result = [ 'references' => $references, 'nesting' => false, 'dynamicItems' => false ]; } return $result; }
php
public static function getMenuTypeInfo(string $type) { $result = []; if ($type === 'cms-page') { $theme = Theme::getActiveTheme(); $pages = self::listInTheme($theme, true); $references = []; foreach ($pages as $page) { $references[$page->getBaseFileName()] = $page->title . ' [' . $page->getBaseFileName() . ']'; } $result = [ 'references' => $references, 'nesting' => false, 'dynamicItems' => false ]; } return $result; }
[ "public", "static", "function", "getMenuTypeInfo", "(", "string", "$", "type", ")", "{", "$", "result", "=", "[", "]", ";", "if", "(", "$", "type", "===", "'cms-page'", ")", "{", "$", "theme", "=", "Theme", "::", "getActiveTheme", "(", ")", ";", "$",...
Handler for the pages.menuitem.getTypeInfo event. Returns a menu item type information. The type information is returned as array with the following elements: - references - a list of the item type reference options. The options are returned in the ["key"] => "title" format for options that don't have sub-options, and in the format ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional, required only if the menu item type requires references. - nesting - Boolean value indicating whether the item type supports nested items. Optional, false if omitted. - dynamicItems - Boolean value indicating whether the item type could generate new menu items. Optional, false if omitted. - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to resolve the item URL. @param string $type Specifies the menu item type @return array Returns an array
[ "Handler", "for", "the", "pages", ".", "menuitem", ".", "getTypeInfo", "event", ".", "Returns", "a", "menu", "item", "type", "information", ".", "The", "type", "information", "is", "returned", "as", "array", "with", "the", "following", "elements", ":", "-", ...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Page.php#L150-L171
train
Returns the menu information for a given type
[ 30522, 2270, 10763, 3853, 2131, 3549, 4904, 18863, 2378, 14876, 1006, 5164, 1002, 2828, 1007, 1063, 1002, 2765, 1027, 1031, 1033, 1025, 2065, 1006, 1002, 2828, 1027, 1027, 1027, 1005, 4642, 2015, 1011, 3931, 1005, 1007, 1063, 1002, 4323, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/LaravelDebugbar.php
LaravelDebugbar.collect
public function collect() { /** @var Request $request */ $request = $this->app['request']; $this->data = [ '__meta' => [ 'id' => $this->getCurrentRequestId(), 'datetime' => date('Y-m-d H:i:s'), 'utime' => microtime(true), 'method' => $request->getMethod(), 'uri' => $request->getRequestUri(), 'ip' => $request->getClientIp() ] ]; foreach ($this->collectors as $name => $collector) { $this->data[$name] = $collector->collect(); } // Remove all invalid (non UTF-8) characters array_walk_recursive( $this->data, function (&$item) { if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) { $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8'); } } ); if ($this->storage !== null) { $this->storage->save($this->getCurrentRequestId(), $this->data); } return $this->data; }
php
public function collect() { /** @var Request $request */ $request = $this->app['request']; $this->data = [ '__meta' => [ 'id' => $this->getCurrentRequestId(), 'datetime' => date('Y-m-d H:i:s'), 'utime' => microtime(true), 'method' => $request->getMethod(), 'uri' => $request->getRequestUri(), 'ip' => $request->getClientIp() ] ]; foreach ($this->collectors as $name => $collector) { $this->data[$name] = $collector->collect(); } // Remove all invalid (non UTF-8) characters array_walk_recursive( $this->data, function (&$item) { if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) { $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8'); } } ); if ($this->storage !== null) { $this->storage->save($this->getCurrentRequestId(), $this->data); } return $this->data; }
[ "public", "function", "collect", "(", ")", "{", "/** @var Request $request */", "$", "request", "=", "$", "this", "->", "app", "[", "'request'", "]", ";", "$", "this", "->", "data", "=", "[", "'__meta'", "=>", "[", "'id'", "=>", "$", "this", "->", "get...
Collects the data from the collectors @return array
[ "Collects", "the", "data", "from", "the", "collectors" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/LaravelDebugbar.php#L798-L833
train
Collect all data from the collector
[ 30522, 2270, 3853, 8145, 1006, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 5227, 1002, 5227, 1008, 1013, 1002, 5227, 1027, 1002, 2023, 1011, 1028, 10439, 1031, 1005, 5227, 1005, 1033, 1025, 1002, 2023, 1011, 1028, 2951, 1027, 1031, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/AbstractMedia.php
AbstractMedia.orderMedia
protected function orderMedia($media) { if (null === $this->media_order) { /** @var Page $page */ $page = Grav::instance()['pages']->get($this->getPath()); if ($page && isset($page->header()->media_order)) { $this->media_order = array_map('trim', explode(',', $page->header()->media_order)); } } if (!empty($this->media_order) && is_array($this->media_order)) { $media = Utils::sortArrayByArray($media, $this->media_order); } else { ksort($media, SORT_NATURAL | SORT_FLAG_CASE); } return $media; }
php
protected function orderMedia($media) { if (null === $this->media_order) { /** @var Page $page */ $page = Grav::instance()['pages']->get($this->getPath()); if ($page && isset($page->header()->media_order)) { $this->media_order = array_map('trim', explode(',', $page->header()->media_order)); } } if (!empty($this->media_order) && is_array($this->media_order)) { $media = Utils::sortArrayByArray($media, $this->media_order); } else { ksort($media, SORT_NATURAL | SORT_FLAG_CASE); } return $media; }
[ "protected", "function", "orderMedia", "(", "$", "media", ")", "{", "if", "(", "null", "===", "$", "this", "->", "media_order", ")", "{", "/** @var Page $page */", "$", "page", "=", "Grav", "::", "instance", "(", ")", "[", "'pages'", "]", "->", "get", ...
Order the media based on the page's media_order @param array $media @return array
[ "Order", "the", "media", "based", "on", "the", "page", "s", "media_order" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AbstractMedia.php#L179-L197
train
Order media by page header
[ 30522, 5123, 3853, 2344, 16969, 1006, 1002, 2865, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 2865, 1035, 2344, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 3931, 1002, 3931, 1008, 1013, 1002, 3931, 1027, 24665, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Form.php
Form.getSaveData
public function getSaveData() { $this->defineFormFields(); $result = []; /* * Source data */ $data = $this->arrayName ? post($this->arrayName) : post(); if (!$data) { $data = []; } /* * Spin over each field and extract the postback value */ foreach ($this->allFields as $field) { /* * Disabled and hidden should be omitted from data set */ if ($field->disabled || $field->hidden) { continue; } /* * Handle HTML array, eg: item[key][another] */ $parts = HtmlHelper::nameToArray($field->fieldName); if (($value = $this->dataArrayGet($data, $parts)) !== null) { /* * Number fields should be converted to integers */ if ($field->type === 'number') { $value = !strlen(trim($value)) ? null : (float) $value; } $this->dataArraySet($result, $parts, $value); } } /* * Give widgets an opportunity to process the data. */ foreach ($this->formWidgets as $field => $widget) { $parts = HtmlHelper::nameToArray($field); $widgetValue = $widget->getSaveValue($this->dataArrayGet($result, $parts)); $this->dataArraySet($result, $parts, $widgetValue); } return $result; }
php
public function getSaveData() { $this->defineFormFields(); $result = []; /* * Source data */ $data = $this->arrayName ? post($this->arrayName) : post(); if (!$data) { $data = []; } /* * Spin over each field and extract the postback value */ foreach ($this->allFields as $field) { /* * Disabled and hidden should be omitted from data set */ if ($field->disabled || $field->hidden) { continue; } /* * Handle HTML array, eg: item[key][another] */ $parts = HtmlHelper::nameToArray($field->fieldName); if (($value = $this->dataArrayGet($data, $parts)) !== null) { /* * Number fields should be converted to integers */ if ($field->type === 'number') { $value = !strlen(trim($value)) ? null : (float) $value; } $this->dataArraySet($result, $parts, $value); } } /* * Give widgets an opportunity to process the data. */ foreach ($this->formWidgets as $field => $widget) { $parts = HtmlHelper::nameToArray($field); $widgetValue = $widget->getSaveValue($this->dataArrayGet($result, $parts)); $this->dataArraySet($result, $parts, $widgetValue); } return $result; }
[ "public", "function", "getSaveData", "(", ")", "{", "$", "this", "->", "defineFormFields", "(", ")", ";", "$", "result", "=", "[", "]", ";", "/*\n * Source data\n */", "$", "data", "=", "$", "this", "->", "arrayName", "?", "post", "(", "$",...
Returns post data from a submitted form. @return array
[ "Returns", "post", "data", "from", "a", "submitted", "form", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L1125-L1178
train
Get the data to save
[ 30522, 2270, 3853, 4152, 10696, 2850, 2696, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 9375, 14192, 15155, 1006, 1007, 1025, 1002, 2765, 1027, 1031, 1033, 1025, 1013, 1008, 1008, 3120, 2951, 1008, 1013, 1002, 2951, 1027, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Helper/OneVsRest.php
OneVsRest.train
public function train(array $samples, array $targets): void { // Clears previous stuff. $this->reset(); $this->trainByLabel($samples, $targets); }
php
public function train(array $samples, array $targets): void { // Clears previous stuff. $this->reset(); $this->trainByLabel($samples, $targets); }
[ "public", "function", "train", "(", "array", "$", "samples", ",", "array", "$", "targets", ")", ":", "void", "{", "// Clears previous stuff.", "$", "this", "->", "reset", "(", ")", ";", "$", "this", "->", "trainByLabel", "(", "$", "samples", ",", "$", ...
Train a binary classifier in the OvR style
[ "Train", "a", "binary", "classifier", "in", "the", "OvR", "style" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Helper/OneVsRest.php#L31-L37
train
Train the term classification by label
[ 30522, 2270, 3853, 3345, 1006, 9140, 1002, 8168, 1010, 9140, 1002, 7889, 1007, 1024, 11675, 1063, 1013, 1013, 28837, 3025, 4933, 1012, 1002, 2023, 1011, 1028, 25141, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 3345, 3762, 20470, 2884, 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...
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.findPackages
public function findPackages($searches = []) { $packages = ['total' => 0, 'not_found' => []]; $inflector = new Inflector(); foreach ($searches as $search) { $repository = ''; // if this is an object, get the search data from the key if (is_object($search)) { $search = (array)$search; $key = key($search); $repository = $search[$key]; $search = $key; } $found = $this->findPackage($search); if ($found) { // set override repository if provided if ($repository) { $found->override_repository = $repository; } if (!isset($packages[$found->package_type])) { $packages[$found->package_type] = []; } $packages[$found->package_type][$found->slug] = $found; $packages['total']++; } else { // make a best guess at the type based on the repo URL if (Utils::contains($repository, '-theme')) { $type = 'themes'; } else { $type = 'plugins'; } $not_found = new \stdClass(); $not_found->name = $inflector::camelize($search); $not_found->slug = $search; $not_found->package_type = $type; $not_found->install_path = str_replace('%name%', $search, $this->install_paths[$type]); $not_found->override_repository = $repository; $packages['not_found'][$search] = $not_found; } } return $packages; }
php
public function findPackages($searches = []) { $packages = ['total' => 0, 'not_found' => []]; $inflector = new Inflector(); foreach ($searches as $search) { $repository = ''; // if this is an object, get the search data from the key if (is_object($search)) { $search = (array)$search; $key = key($search); $repository = $search[$key]; $search = $key; } $found = $this->findPackage($search); if ($found) { // set override repository if provided if ($repository) { $found->override_repository = $repository; } if (!isset($packages[$found->package_type])) { $packages[$found->package_type] = []; } $packages[$found->package_type][$found->slug] = $found; $packages['total']++; } else { // make a best guess at the type based on the repo URL if (Utils::contains($repository, '-theme')) { $type = 'themes'; } else { $type = 'plugins'; } $not_found = new \stdClass(); $not_found->name = $inflector::camelize($search); $not_found->slug = $search; $not_found->package_type = $type; $not_found->install_path = str_replace('%name%', $search, $this->install_paths[$type]); $not_found->override_repository = $repository; $packages['not_found'][$search] = $not_found; } } return $packages; }
[ "public", "function", "findPackages", "(", "$", "searches", "=", "[", "]", ")", "{", "$", "packages", "=", "[", "'total'", "=>", "0", ",", "'not_found'", "=>", "[", "]", "]", ";", "$", "inflector", "=", "new", "Inflector", "(", ")", ";", "foreach", ...
Searches for a list of Packages in the repository @param array $searches An array of either slugs or names @return array Array of found Packages Format: ['total' => int, 'not_found' => array, <found-slugs>]
[ "Searches", "for", "a", "list", "of", "Packages", "in", "the", "repository" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L663-L709
train
findPackages Find packages by search data
[ 30522, 2270, 3853, 2424, 23947, 13923, 1006, 1002, 17193, 1027, 1031, 1033, 1007, 1063, 1002, 14555, 1027, 1031, 1005, 2561, 1005, 1027, 1028, 1014, 1010, 1005, 2025, 1035, 2179, 1005, 1027, 1028, 1031, 1033, 1033, 1025, 1002, 1999, 21031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php
ScriptDataGenerator.generateDataForLocale
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale) { $localeBundle = $reader->read($tempDir, $displayLocale); // isset() on \ResourceBundle returns true even if the value is null if (isset($localeBundle['Scripts']) && null !== $localeBundle['Scripts']) { $data = [ 'Version' => $localeBundle['Version'], 'Names' => iterator_to_array($localeBundle['Scripts']), ]; $this->scriptCodes = array_merge($this->scriptCodes, array_keys($data['Names'])); return $data; } }
php
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale) { $localeBundle = $reader->read($tempDir, $displayLocale); // isset() on \ResourceBundle returns true even if the value is null if (isset($localeBundle['Scripts']) && null !== $localeBundle['Scripts']) { $data = [ 'Version' => $localeBundle['Version'], 'Names' => iterator_to_array($localeBundle['Scripts']), ]; $this->scriptCodes = array_merge($this->scriptCodes, array_keys($data['Names'])); return $data; } }
[ "protected", "function", "generateDataForLocale", "(", "BundleReaderInterface", "$", "reader", ",", "$", "tempDir", ",", "$", "displayLocale", ")", "{", "$", "localeBundle", "=", "$", "reader", "->", "read", "(", "$", "tempDir", ",", "$", "displayLocale", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php#L61-L76
train
Generate data for a locale
[ 30522, 5123, 3853, 7013, 6790, 29278, 4135, 9289, 2063, 1006, 14012, 16416, 4063, 18447, 2121, 12172, 1002, 8068, 1010, 1002, 8915, 8737, 4305, 2099, 1010, 1002, 4653, 4135, 9289, 2063, 1007, 1063, 1002, 2334, 15878, 8630, 2571, 1027, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/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...
php-ai/php-ml
src/Association/Apriori.php
Apriori.frequency
private function frequency(array $sample): int { return count(array_filter($this->samples, function ($entry) use ($sample) { return $this->subset($entry, $sample); })); }
php
private function frequency(array $sample): int { return count(array_filter($this->samples, function ($entry) use ($sample) { return $this->subset($entry, $sample); })); }
[ "private", "function", "frequency", "(", "array", "$", "sample", ")", ":", "int", "{", "return", "count", "(", "array_filter", "(", "$", "this", "->", "samples", ",", "function", "(", "$", "entry", ")", "use", "(", "$", "sample", ")", "{", "return", ...
Counts occurrences of $sample as subset in data pool. @see \Phpml\Association\Apriori::samples @param mixed[] $sample
[ "Counts", "occurrences", "of", "$sample", "as", "subset", "in", "data", "pool", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L289-L294
train
Returns the frequency of the sample in the result
[ 30522, 2797, 3853, 6075, 1006, 9140, 1002, 7099, 1007, 1024, 20014, 1063, 2709, 4175, 1006, 9140, 1035, 11307, 1006, 1002, 2023, 1011, 1028, 8168, 1010, 3853, 1006, 1002, 4443, 1007, 2224, 1006, 1002, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/RouteListCommand.php
RouteListCommand.getRoutes
protected function getRoutes() { $routes = collect($this->routes)->map(function ($route) { return $this->getRouteInformation($route); })->filter()->all(); if ($sort = $this->option('sort')) { $routes = $this->sortRoutes($sort, $routes); } if ($this->option('reverse')) { $routes = array_reverse($routes); } return $this->pluckColumns($routes); }
php
protected function getRoutes() { $routes = collect($this->routes)->map(function ($route) { return $this->getRouteInformation($route); })->filter()->all(); if ($sort = $this->option('sort')) { $routes = $this->sortRoutes($sort, $routes); } if ($this->option('reverse')) { $routes = array_reverse($routes); } return $this->pluckColumns($routes); }
[ "protected", "function", "getRoutes", "(", ")", "{", "$", "routes", "=", "collect", "(", "$", "this", "->", "routes", ")", "->", "map", "(", "function", "(", "$", "route", ")", "{", "return", "$", "this", "->", "getRouteInformation", "(", "$", "route",...
Compile the routes into a displayable format. @return array
[ "Compile", "the", "routes", "into", "a", "displayable", "format", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/RouteListCommand.php#L86-L101
train
Get routes information
[ 30522, 5123, 3853, 2131, 22494, 4570, 1006, 1007, 1063, 1002, 5847, 1027, 8145, 1006, 1002, 2023, 1011, 1028, 5847, 1007, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 2799, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 22494, 9589, 14192, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Form.php
Form.initialize
public function initialize() { if (null !== $this->parent) { throw new RuntimeException('Only root forms should be initialized.'); } // Guarantee that the *_SET_DATA events have been triggered once the // form is initialized. This makes sure that dynamically added or // removed fields are already visible after initialization. if (!$this->defaultDataSet) { $this->setData($this->config->getData()); } return $this; }
php
public function initialize() { if (null !== $this->parent) { throw new RuntimeException('Only root forms should be initialized.'); } // Guarantee that the *_SET_DATA events have been triggered once the // form is initialized. This makes sure that dynamically added or // removed fields are already visible after initialization. if (!$this->defaultDataSet) { $this->setData($this->config->getData()); } return $this; }
[ "public", "function", "initialize", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "parent", ")", "{", "throw", "new", "RuntimeException", "(", "'Only root forms should be initialized.'", ")", ";", "}", "// Guarantee that the *_SET_DATA events have been t...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L472-L486
train
Initialize the form
[ 30522, 2270, 3853, 3988, 4697, 1006, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 6687, 1007, 1063, 5466, 2047, 2448, 7292, 10288, 24422, 1006, 1005, 2069, 7117, 3596, 2323, 2022, 3988, 3550, 1012, 1005, 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...
opencart/opencart
upload/admin/controller/customer/gdpr.php
ControllerCustomerGdpr.approve
public function approve() { $this->load->language('customer/gdpr'); $json = array(); if (!$this->user->hasPermission('modify', 'customer/gdpr')) { $json['error'] = $this->language->get('error_permission'); } else { $gdprs = array(); if (isset($this->request->post['selected'])) { $gdprs = $this->request->post['selected']; } if (isset($this->request->get['gdpr_id'])) { $gdprs[] = $this->request->get['gdpr_id']; } $this->load->model('customer/gdpr'); foreach ($gdprs as $gdpr_id) { $gdpr_info = $this->model_customer_gdpr->getGdpr($gdpr_id); if ($gdpr_info) { // If we remove we want to change the status to processing // to give time for store owners to process orders and refunds. if ($gdpr_info['action'] == 'export') { $this->model_customer_gdpr->editStatus($gdpr_id, 3); } else { $this->model_customer_gdpr->editStatus($gdpr_id, 2); } } } $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); }
php
public function approve() { $this->load->language('customer/gdpr'); $json = array(); if (!$this->user->hasPermission('modify', 'customer/gdpr')) { $json['error'] = $this->language->get('error_permission'); } else { $gdprs = array(); if (isset($this->request->post['selected'])) { $gdprs = $this->request->post['selected']; } if (isset($this->request->get['gdpr_id'])) { $gdprs[] = $this->request->get['gdpr_id']; } $this->load->model('customer/gdpr'); foreach ($gdprs as $gdpr_id) { $gdpr_info = $this->model_customer_gdpr->getGdpr($gdpr_id); if ($gdpr_info) { // If we remove we want to change the status to processing // to give time for store owners to process orders and refunds. if ($gdpr_info['action'] == 'export') { $this->model_customer_gdpr->editStatus($gdpr_id, 3); } else { $this->model_customer_gdpr->editStatus($gdpr_id, 2); } } } $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); }
[ "public", "function", "approve", "(", ")", "{", "$", "this", "->", "load", "->", "language", "(", "'customer/gdpr'", ")", ";", "$", "json", "=", "array", "(", ")", ";", "if", "(", "!", "$", "this", "->", "user", "->", "hasPermission", "(", "'modify'"...
/* Action Statuses EXPORT unverified = 0 pending = 1 complete = 3 REMOVE unverified = 0 pending = 1 processing = 2 delete = 3 DENY unverified = 0 pending = 1 processing = 2 denied = -1
[ "/", "*", "Action", "Statuses" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/admin/controller/customer/gdpr.php#L161-L200
train
Approve the customer gdprs
[ 30522, 2270, 3853, 14300, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 7170, 1011, 1028, 2653, 1006, 1005, 8013, 1013, 14230, 2099, 1005, 1007, 1025, 1002, 1046, 3385, 1027, 9140, 1006, 1007, 1025, 2065, 1006, 999, 1002, 2023, 1011, 1028, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Encoder/JsonEncode.php
JsonEncode.encode
public function encode($data, $format, array $context = []) { $jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS]; $encodedJson = json_encode($data, $jsonEncodeOptions); if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new NotEncodableValueException(json_last_error_msg()); } return $encodedJson; }
php
public function encode($data, $format, array $context = []) { $jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS]; $encodedJson = json_encode($data, $jsonEncodeOptions); if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new NotEncodableValueException(json_last_error_msg()); } return $encodedJson; }
[ "public", "function", "encode", "(", "$", "data", ",", "$", "format", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "jsonEncodeOptions", "=", "$", "context", "[", "self", "::", "OPTIONS", "]", "??", "$", "this", "->", "defaultContext", ...
Encodes PHP data to a JSON string. {@inheritdoc}
[ "Encodes", "PHP", "data", "to", "a", "JSON", "string", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/JsonEncode.php#L48-L58
train
Encodes the given data into JSON
[ 30522, 2270, 3853, 4372, 16044, 1006, 1002, 2951, 1010, 1002, 4289, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 1002, 1046, 3385, 2368, 16044, 7361, 9285, 1027, 1002, 6123, 1031, 2969, 1024, 1024, 7047, 1033, 1029, 1029, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Lists.php
Lists.getColumnValueRaw
public function getColumnValueRaw($record, $column) { $columnName = $column->columnName; /* * Handle taking value from model relation. */ if ($column->valueFrom && $column->relation) { $columnName = $column->relation; if (!array_key_exists($columnName, $record->getRelations())) { $value = null; } elseif ($this->isColumnRelated($column, true)) { $value = $record->{$columnName}->lists($column->valueFrom); } elseif ($this->isColumnRelated($column) || $this->isColumnPivot($column)) { $value = $record->{$columnName} ? $column->getValueFromData($record->{$columnName}) : null; } else { $value = null; } } /* * Handle taking value from model attribute. */ elseif ($column->valueFrom) { $value = $column->getValueFromData($record); } /* * Otherwise, if the column is a relation, it will be a custom select, * so prevent the Model from attempting to load the relation * if the value is NULL. */ else { if ($record->hasRelation($columnName) && array_key_exists($columnName, $record->attributes)) { $value = $record->attributes[$columnName]; // Load the value from the relationship counter if useRelationCount is specified } elseif ($column->relation && @$column->config['useRelationCount']) { $value = $record->{"{$column->relation}_count"}; } else { $value = $record->{$columnName}; } } /** * @event backend.list.overrideColumnValueRaw * Overrides the raw column value in a list widget. * * If a value is returned from this event, it will be used as the raw value for the provided column. * `$value` is passed by reference so modifying the variable in place is also supported. Example usage: * * Event::listen('backend.list.overrideColumnValueRaw', function($listWidget, $record, $column, &$value) { * $value .= '-modified'; * }); * * Or * * $listWidget->bindEvent('list.overrideColumnValueRaw', function ($record, $column, $value) { * return 'No values for you!'; * }); * */ if ($response = $this->fireSystemEvent('backend.list.overrideColumnValueRaw', [$record, $column, &$value])) { $value = $response; } return $value; }
php
public function getColumnValueRaw($record, $column) { $columnName = $column->columnName; /* * Handle taking value from model relation. */ if ($column->valueFrom && $column->relation) { $columnName = $column->relation; if (!array_key_exists($columnName, $record->getRelations())) { $value = null; } elseif ($this->isColumnRelated($column, true)) { $value = $record->{$columnName}->lists($column->valueFrom); } elseif ($this->isColumnRelated($column) || $this->isColumnPivot($column)) { $value = $record->{$columnName} ? $column->getValueFromData($record->{$columnName}) : null; } else { $value = null; } } /* * Handle taking value from model attribute. */ elseif ($column->valueFrom) { $value = $column->getValueFromData($record); } /* * Otherwise, if the column is a relation, it will be a custom select, * so prevent the Model from attempting to load the relation * if the value is NULL. */ else { if ($record->hasRelation($columnName) && array_key_exists($columnName, $record->attributes)) { $value = $record->attributes[$columnName]; // Load the value from the relationship counter if useRelationCount is specified } elseif ($column->relation && @$column->config['useRelationCount']) { $value = $record->{"{$column->relation}_count"}; } else { $value = $record->{$columnName}; } } /** * @event backend.list.overrideColumnValueRaw * Overrides the raw column value in a list widget. * * If a value is returned from this event, it will be used as the raw value for the provided column. * `$value` is passed by reference so modifying the variable in place is also supported. Example usage: * * Event::listen('backend.list.overrideColumnValueRaw', function($listWidget, $record, $column, &$value) { * $value .= '-modified'; * }); * * Or * * $listWidget->bindEvent('list.overrideColumnValueRaw', function ($record, $column, $value) { * return 'No values for you!'; * }); * */ if ($response = $this->fireSystemEvent('backend.list.overrideColumnValueRaw', [$record, $column, &$value])) { $value = $response; } return $value; }
[ "public", "function", "getColumnValueRaw", "(", "$", "record", ",", "$", "column", ")", "{", "$", "columnName", "=", "$", "column", "->", "columnName", ";", "/*\n * Handle taking value from model relation.\n */", "if", "(", "$", "column", "->", "valu...
Returns a raw column value @return string
[ "Returns", "a", "raw", "column", "value" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L965-L1035
train
Returns the raw value of a column
[ 30522, 2270, 3853, 2131, 25778, 2819, 2078, 10175, 13094, 10376, 1006, 1002, 2501, 1010, 1002, 5930, 1007, 1063, 1002, 5930, 18442, 1027, 1002, 5930, 1011, 1028, 5930, 18442, 1025, 1013, 1008, 1008, 5047, 2635, 3643, 2013, 2944, 7189, 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...
z-song/laravel-admin
src/Form/Field/MultipleFile.php
MultipleFile.sortFiles
protected function sortFiles($order) { $order = explode(',', $order); $new = []; $original = $this->original(); foreach ($order as $item) { $new[] = Arr::get($original, $item); } return $new; }
php
protected function sortFiles($order) { $order = explode(',', $order); $new = []; $original = $this->original(); foreach ($order as $item) { $new[] = Arr::get($original, $item); } return $new; }
[ "protected", "function", "sortFiles", "(", "$", "order", ")", "{", "$", "order", "=", "explode", "(", "','", ",", "$", "order", ")", ";", "$", "new", "=", "[", "]", ";", "$", "original", "=", "$", "this", "->", "original", "(", ")", ";", "foreach...
Sort files. @param string $order @return array
[ "Sort", "files", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/MultipleFile.php#L117-L129
train
Sort files by given order
[ 30522, 5123, 3853, 4066, 8873, 4244, 1006, 1002, 2344, 1007, 1063, 1002, 2344, 1027, 15044, 1006, 1005, 1010, 1005, 1010, 1002, 2344, 1007, 1025, 1002, 2047, 1027, 1031, 1033, 1025, 1002, 2434, 1027, 1002, 2023, 1011, 1028, 2434, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid.php
Grid.disablePagination
public function disablePagination(bool $disable = true) { $this->model->usePaginate(!$disable); return $this->option('show_pagination', !$disable); }
php
public function disablePagination(bool $disable = true) { $this->model->usePaginate(!$disable); return $this->option('show_pagination', !$disable); }
[ "public", "function", "disablePagination", "(", "bool", "$", "disable", "=", "true", ")", "{", "$", "this", "->", "model", "->", "usePaginate", "(", "!", "$", "disable", ")", ";", "return", "$", "this", "->", "option", "(", "'show_pagination'", ",", "!",...
Disable grid pagination. @return $this
[ "Disable", "grid", "pagination", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L465-L470
train
Disable pagination.
[ 30522, 2270, 3853, 4487, 19150, 4502, 20876, 3508, 1006, 22017, 2140, 1002, 4487, 19150, 1027, 2995, 1007, 1063, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 2224, 4502, 20876, 2618, 1006, 999, 1002, 4487, 19150, 1007, 1025, 2709, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/FormFactory.php
FormFactory.createNamed
public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = []) { return $this->createNamedBuilder($name, $type, $data, $options)->getForm(); }
php
public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = []) { return $this->createNamedBuilder($name, $type, $data, $options)->getForm(); }
[ "public", "function", "createNamed", "(", "$", "name", ",", "$", "type", "=", "'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType'", ",", "$", "data", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "c...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormFactory.php#L36-L39
train
Create Form with named builder
[ 30522, 2270, 3853, 3443, 18442, 2094, 1006, 1002, 2171, 1010, 1002, 2828, 1027, 1005, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 2433, 1032, 5331, 1032, 4563, 1032, 2828, 1032, 2433, 13874, 1005, 1010, 1002, 2951, 1027, 19701, 1010, 9140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.findSettingItem
public function findSettingItem($owner, $code) { if ($this->items === null) { $this->loadItems(); } $owner = strtolower($owner); $code = strtolower($code); foreach ($this->items as $item) { if (strtolower($item->owner) == $owner && strtolower($item->code) == $code) { return $item; } } return false; }
php
public function findSettingItem($owner, $code) { if ($this->items === null) { $this->loadItems(); } $owner = strtolower($owner); $code = strtolower($code); foreach ($this->items as $item) { if (strtolower($item->owner) == $owner && strtolower($item->code) == $code) { return $item; } } return false; }
[ "public", "function", "findSettingItem", "(", "$", "owner", ",", "$", "code", ")", "{", "if", "(", "$", "this", "->", "items", "===", "null", ")", "{", "$", "this", "->", "loadItems", "(", ")", ";", "}", "$", "owner", "=", "strtolower", "(", "$", ...
Locates a setting item object by it's owner and code @param string $owner @param string $code @return mixed The item object or FALSE if nothing is found
[ "Locates", "a", "setting", "item", "object", "by", "it", "s", "owner", "and", "code" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L342-L358
train
Find SettingItem
[ 30522, 2270, 3853, 4858, 18319, 3070, 4221, 2213, 1006, 1002, 3954, 1010, 1002, 3642, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5167, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 7170, 4221, 5244, 1006, 1007, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/PageUrl.php
PageUrl.normalizeUrl
public static function normalizeUrl($url) { foreach (self::$urlPrefixMap as $prefix => $id) { if (strtolower(substr($url, 0, strlen($prefix))) == $prefix) { return array( 'url' => substr($url, strlen($prefix)), 'prefixId' => $id ); } } return array('url' => $url, 'prefixId' => null); }
php
public static function normalizeUrl($url) { foreach (self::$urlPrefixMap as $prefix => $id) { if (strtolower(substr($url, 0, strlen($prefix))) == $prefix) { return array( 'url' => substr($url, strlen($prefix)), 'prefixId' => $id ); } } return array('url' => $url, 'prefixId' => null); }
[ "public", "static", "function", "normalizeUrl", "(", "$", "url", ")", "{", "foreach", "(", "self", "::", "$", "urlPrefixMap", "as", "$", "prefix", "=>", "$", "id", ")", "{", "if", "(", "strtolower", "(", "substr", "(", "$", "url", ",", "0", ",", "s...
Extract the prefix from a URL. Return the prefix ID and the rest. @param string $url @return array
[ "Extract", "the", "prefix", "from", "a", "URL", ".", "Return", "the", "prefix", "ID", "and", "the", "rest", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/PageUrl.php#L339-L351
train
Normalize URL to prefix
[ 30522, 2270, 10763, 3853, 3671, 4697, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1063, 18921, 6776, 1006, 2969, 1024, 1024, 1002, 24471, 14277, 2890, 8873, 2595, 2863, 2361, 2004, 1002, 17576, 1027, 1028, 1002, 8909, 1007, 1063, 2065, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Plugin.php
Plugin.getSubscribedEvents
public static function getSubscribedEvents() { $methods = get_class_methods(get_called_class()); $list = []; foreach ($methods as $method) { if (strpos($method, 'on') === 0) { $list[$method] = [$method, 0]; } } return $list; }
php
public static function getSubscribedEvents() { $methods = get_class_methods(get_called_class()); $list = []; foreach ($methods as $method) { if (strpos($method, 'on') === 0) { $list[$method] = [$method, 0]; } } return $list; }
[ "public", "static", "function", "getSubscribedEvents", "(", ")", "{", "$", "methods", "=", "get_class_methods", "(", "get_called_class", "(", ")", ")", ";", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "methods", "as", "$", "method", ")", "{", ...
By default assign all methods as listeners using the default priority. @return array
[ "By", "default", "assign", "all", "methods", "as", "listeners", "using", "the", "default", "priority", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugin.php#L50-L62
train
Get all the subscribed events
[ 30522, 2270, 10763, 3853, 4152, 12083, 29234, 24844, 11187, 1006, 1007, 1063, 1002, 4725, 1027, 2131, 1035, 2465, 1035, 4725, 1006, 2131, 1035, 2170, 1035, 2465, 1006, 1007, 1007, 1025, 1002, 2862, 1027, 1031, 1033, 1025, 18921, 6776, 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/Security/Core/Encoder/BCryptPasswordEncoder.php
BCryptPasswordEncoder.encodePassword
public function encodePassword($raw, $salt) { if ($this->isPasswordTooLong($raw)) { throw new BadCredentialsException('Invalid password.'); } $options = ['cost' => $this->cost]; if ($salt) { // Ignore $salt, the auto-generated one is always the best } return password_hash($raw, PASSWORD_BCRYPT, $options); }
php
public function encodePassword($raw, $salt) { if ($this->isPasswordTooLong($raw)) { throw new BadCredentialsException('Invalid password.'); } $options = ['cost' => $this->cost]; if ($salt) { // Ignore $salt, the auto-generated one is always the best } return password_hash($raw, PASSWORD_BCRYPT, $options); }
[ "public", "function", "encodePassword", "(", "$", "raw", ",", "$", "salt", ")", "{", "if", "(", "$", "this", "->", "isPasswordTooLong", "(", "$", "raw", ")", ")", "{", "throw", "new", "BadCredentialsException", "(", "'Invalid password.'", ")", ";", "}", ...
Encodes the raw password. It doesn't work with PHP versions lower than 5.3.7, since the password compat library uses CRYPT_BLOWFISH hash type with the "$2y$" salt prefix (which is not available in the early PHP versions). @see https://github.com/ircmaxell/password_compat/issues/10#issuecomment-11203833 It is almost best to **not** pass a salt and let PHP generate one for you. @param string $raw The password to encode @param string $salt The salt @return string The encoded password @throws BadCredentialsException when the given password is too long @see http://lxr.php.net/xref/PHP_5_5/ext/standard/password.c#111
[ "Encodes", "the", "raw", "password", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php#L65-L78
train
Encode a password using the BCRYPT algorithm
[ 30522, 2270, 3853, 4372, 16044, 15194, 18351, 1006, 1002, 6315, 1010, 1002, 5474, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 15194, 18351, 3406, 12898, 3070, 1006, 1002, 6315, 1007, 1007, 1063, 5466, 2047, 2919, 16748, 16454, 263...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.php
Zend_Db_Statement.fetchAll
public function fetchAll($style = null, $col = null) { $data = array(); if ($style === Zend_Db::FETCH_COLUMN && $col === null) { $col = 0; } if ($col === null) { while ($row = $this->fetch($style)) { $data[] = $row; } } else { while (false !== ($val = $this->fetchColumn($col))) { $data[] = $val; } } return $data; }
php
public function fetchAll($style = null, $col = null) { $data = array(); if ($style === Zend_Db::FETCH_COLUMN && $col === null) { $col = 0; } if ($col === null) { while ($row = $this->fetch($style)) { $data[] = $row; } } else { while (false !== ($val = $this->fetchColumn($col))) { $data[] = $val; } } return $data; }
[ "public", "function", "fetchAll", "(", "$", "style", "=", "null", ",", "$", "col", "=", "null", ")", "{", "$", "data", "=", "array", "(", ")", ";", "if", "(", "$", "style", "===", "Zend_Db", "::", "FETCH_COLUMN", "&&", "$", "col", "===", "null", ...
Returns an array containing all of the result set rows. @param int $style OPTIONAL Fetch mode. @param int $col OPTIONAL Column number, if fetch mode is by column. @return array Collection of rows, each in a format by the fetch mode.
[ "Returns", "an", "array", "containing", "all", "of", "the", "result", "set", "rows", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement.php#L334-L350
train
Fetch all rows from the result set
[ 30522, 2270, 3853, 18584, 8095, 1006, 1002, 2806, 1027, 19701, 1010, 1002, 8902, 1027, 19701, 1007, 1063, 1002, 2951, 1027, 9140, 1006, 1007, 1025, 2065, 1006, 1002, 2806, 1027, 1027, 1027, 16729, 2094, 1035, 16962, 1024, 1024, 18584, 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
libs/Zend/Db/Select.php
Zend_Db_Select.reset
public function reset($part = null) { if ($part == null) { $this->_parts = self::$_partsInit; } else if (array_key_exists($part, self::$_partsInit)) { $this->_parts[$part] = self::$_partsInit[$part]; } return $this; }
php
public function reset($part = null) { if ($part == null) { $this->_parts = self::$_partsInit; } else if (array_key_exists($part, self::$_partsInit)) { $this->_parts[$part] = self::$_partsInit[$part]; } return $this; }
[ "public", "function", "reset", "(", "$", "part", "=", "null", ")", "{", "if", "(", "$", "part", "==", "null", ")", "{", "$", "this", "->", "_parts", "=", "self", "::", "$", "_partsInit", ";", "}", "else", "if", "(", "array_key_exists", "(", "$", ...
Clear parts of the Select object, or an individual part. @param string $part OPTIONAL @return Zend_Db_Select
[ "Clear", "parts", "of", "the", "Select", "object", "or", "an", "individual", "part", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L717-L725
train
Reset the part of the grammar
[ 30522, 2270, 3853, 25141, 1006, 1002, 2112, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2112, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 3033, 1027, 2969, 1024, 1024, 1002, 1035, 3033, 5498, 2102, 1025, 1065, 2842, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/SessionGuard.php
SessionGuard.fireAuthenticatedEvent
protected function fireAuthenticatedEvent($user) { if (isset($this->events)) { $this->events->dispatch(new Events\Authenticated( $this->name, $user )); } }
php
protected function fireAuthenticatedEvent($user) { if (isset($this->events)) { $this->events->dispatch(new Events\Authenticated( $this->name, $user )); } }
[ "protected", "function", "fireAuthenticatedEvent", "(", "$", "user", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", ")", ")", "{", "$", "this", "->", "events", "->", "dispatch", "(", "new", "Events", "\\", "Authenticated", "(", "$", "t...
Fire the authenticated event if the dispatcher is set. @param \Illuminate\Contracts\Auth\Authenticatable $user @return void
[ "Fire", "the", "authenticated", "event", "if", "the", "dispatcher", "is", "set", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L614-L621
train
Fires the authenticated event
[ 30522, 5123, 3853, 2543, 4887, 10760, 16778, 12921, 18697, 3372, 1006, 1002, 5310, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2824, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 2824, 1011, 1028, 18365, 1006, 2047, 2824,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/Http/Environment.php
Environment.mock
public static function mock(array $settings = []) { //Validates if default protocol is HTTPS to set default port 443 if ((isset($settings['HTTPS']) && $settings['HTTPS'] !== 'off') || ((isset($settings['REQUEST_SCHEME']) && $settings['REQUEST_SCHEME'] === 'https'))) { $defscheme = 'https'; $defport = 443; } else { $defscheme = 'http'; $defport = 80; } $data = array_merge([ 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'REQUEST_SCHEME' => $defscheme, 'SCRIPT_NAME' => '', 'REQUEST_URI' => '', 'QUERY_STRING' => '', 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => $defport, 'HTTP_HOST' => 'localhost', 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_USER_AGENT' => 'Slim Framework', 'REMOTE_ADDR' => '127.0.0.1', 'REQUEST_TIME' => time(), 'REQUEST_TIME_FLOAT' => microtime(true), ], $settings); return new static($data); }
php
public static function mock(array $settings = []) { //Validates if default protocol is HTTPS to set default port 443 if ((isset($settings['HTTPS']) && $settings['HTTPS'] !== 'off') || ((isset($settings['REQUEST_SCHEME']) && $settings['REQUEST_SCHEME'] === 'https'))) { $defscheme = 'https'; $defport = 443; } else { $defscheme = 'http'; $defport = 80; } $data = array_merge([ 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'REQUEST_SCHEME' => $defscheme, 'SCRIPT_NAME' => '', 'REQUEST_URI' => '', 'QUERY_STRING' => '', 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => $defport, 'HTTP_HOST' => 'localhost', 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_USER_AGENT' => 'Slim Framework', 'REMOTE_ADDR' => '127.0.0.1', 'REQUEST_TIME' => time(), 'REQUEST_TIME_FLOAT' => microtime(true), ], $settings); return new static($data); }
[ "public", "static", "function", "mock", "(", "array", "$", "settings", "=", "[", "]", ")", "{", "//Validates if default protocol is HTTPS to set default port 443", "if", "(", "(", "isset", "(", "$", "settings", "[", "'HTTPS'", "]", ")", "&&", "$", "settings", ...
{@inheritdoc} @return self
[ "{" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Environment.php#L24-L56
train
Mocks the current instance of the class
[ 30522, 2270, 10763, 3853, 12934, 1006, 9140, 1002, 10906, 1027, 1031, 1033, 1007, 1063, 1013, 1013, 9398, 8520, 2065, 12398, 8778, 2003, 16770, 2000, 2275, 12398, 3417, 4008, 2509, 2065, 1006, 1006, 26354, 3388, 1006, 1002, 10906, 1031, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.having
public function having($column, $operator = null, $value = null, $boolean = 'and') { $type = 'Basic'; // Here we will make some assumptions about the operator. If only 2 values are // passed to the method, we will assume that the operator is an equals sign // and keep going. Otherwise, we'll require the operator to be passed in. [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); // If the given operator is not found in the list of valid operators we will // assume that the developer is just short-cutting the '=' operators and // we will set the operators to '=' and set the values appropriately. if ($this->invalidOperator($operator)) { [$value, $operator] = [$operator, '=']; } $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); if (! $value instanceof Expression) { $this->addBinding($value, 'having'); } return $this; }
php
public function having($column, $operator = null, $value = null, $boolean = 'and') { $type = 'Basic'; // Here we will make some assumptions about the operator. If only 2 values are // passed to the method, we will assume that the operator is an equals sign // and keep going. Otherwise, we'll require the operator to be passed in. [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); // If the given operator is not found in the list of valid operators we will // assume that the developer is just short-cutting the '=' operators and // we will set the operators to '=' and set the values appropriately. if ($this->invalidOperator($operator)) { [$value, $operator] = [$operator, '=']; } $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); if (! $value instanceof Expression) { $this->addBinding($value, 'having'); } return $this; }
[ "public", "function", "having", "(", "$", "column", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ",", "$", "boolean", "=", "'and'", ")", "{", "$", "type", "=", "'Basic'", ";", "// Here we will make some assumptions about the operator. If ...
Add a "having" clause to the query. @param string $column @param string|null $operator @param string|null $value @param string $boolean @return $this
[ "Add", "a", "having", "clause", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1697-L1722
train
Add having clause to the query
[ 30522, 2270, 3853, 2383, 1006, 1002, 5930, 1010, 1002, 6872, 1027, 19701, 1010, 1002, 3643, 1027, 19701, 1010, 1002, 22017, 20898, 1027, 1005, 1998, 1005, 1007, 1063, 1002, 2828, 1027, 1005, 3937, 1005, 1025, 1013, 1013, 2182, 2057, 2097, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Formatter/OutputFormatter.php
OutputFormatter.createStyleFromString
private function createStyleFromString(string $string) { if (isset($this->styles[$string])) { return $this->styles[$string]; } if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) { return false; } $style = new OutputFormatterStyle(); foreach ($matches as $match) { array_shift($match); $match[0] = strtolower($match[0]); if ('fg' == $match[0]) { $style->setForeground(strtolower($match[1])); } elseif ('bg' == $match[0]) { $style->setBackground(strtolower($match[1])); } elseif ('href' === $match[0]) { $style->setHref($match[1]); } elseif ('options' === $match[0]) { preg_match_all('([^,;]+)', strtolower($match[1]), $options); $options = array_shift($options); foreach ($options as $option) { $style->setOption($option); } } else { return false; } } return $style; }
php
private function createStyleFromString(string $string) { if (isset($this->styles[$string])) { return $this->styles[$string]; } if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) { return false; } $style = new OutputFormatterStyle(); foreach ($matches as $match) { array_shift($match); $match[0] = strtolower($match[0]); if ('fg' == $match[0]) { $style->setForeground(strtolower($match[1])); } elseif ('bg' == $match[0]) { $style->setBackground(strtolower($match[1])); } elseif ('href' === $match[0]) { $style->setHref($match[1]); } elseif ('options' === $match[0]) { preg_match_all('([^,;]+)', strtolower($match[1]), $options); $options = array_shift($options); foreach ($options as $option) { $style->setOption($option); } } else { return false; } } return $style; }
[ "private", "function", "createStyleFromString", "(", "string", "$", "string", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "styles", "[", "$", "string", "]", ")", ")", "{", "return", "$", "this", "->", "styles", "[", "$", "string", "]", ";",...
Tries to create new style instance from string. @return OutputFormatterStyle|false False if string is not format string
[ "Tries", "to", "create", "new", "style", "instance", "from", "string", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Formatter/OutputFormatter.php#L200-L233
train
Create OutputFormatterStyle from string
[ 30522, 2797, 3853, 9005, 27983, 19699, 22225, 18886, 3070, 1006, 5164, 1002, 5164, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 6782, 1031, 1002, 5164, 1033, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 6782, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Constraints/IpValidator.php
IpValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof Ip) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Ip'); } if (null === $value || '' === $value) { return; } if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $value = (string) $value; if (null !== $constraint->normalizer) { $value = ($constraint->normalizer)($value); } switch ($constraint->version) { case Ip::V4: $flag = FILTER_FLAG_IPV4; break; case Ip::V6: $flag = FILTER_FLAG_IPV6; break; case Ip::V4_NO_PRIV: $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::V6_NO_PRIV: $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::ALL_NO_PRIV: $flag = FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::V4_NO_RES: $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; break; case Ip::V6_NO_RES: $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; break; case Ip::ALL_NO_RES: $flag = FILTER_FLAG_NO_RES_RANGE; break; case Ip::V4_ONLY_PUBLIC: $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; break; case Ip::V6_ONLY_PUBLIC: $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; break; case Ip::ALL_ONLY_PUBLIC: $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; break; default: $flag = null; break; } if (!filter_var($value, FILTER_VALIDATE_IP, $flag)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Ip::INVALID_IP_ERROR) ->addViolation(); } }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof Ip) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Ip'); } if (null === $value || '' === $value) { return; } if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $value = (string) $value; if (null !== $constraint->normalizer) { $value = ($constraint->normalizer)($value); } switch ($constraint->version) { case Ip::V4: $flag = FILTER_FLAG_IPV4; break; case Ip::V6: $flag = FILTER_FLAG_IPV6; break; case Ip::V4_NO_PRIV: $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::V6_NO_PRIV: $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::ALL_NO_PRIV: $flag = FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::V4_NO_RES: $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; break; case Ip::V6_NO_RES: $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; break; case Ip::ALL_NO_RES: $flag = FILTER_FLAG_NO_RES_RANGE; break; case Ip::V4_ONLY_PUBLIC: $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; break; case Ip::V6_ONLY_PUBLIC: $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; break; case Ip::ALL_ONLY_PUBLIC: $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; break; default: $flag = null; break; } if (!filter_var($value, FILTER_VALIDATE_IP, $flag)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Ip::INVALID_IP_ERROR) ->addViolation(); } }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "Ip", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESPACE__", "."...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/IpValidator.php#L30-L106
train
Validate the value against the constraints
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 12997, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 1006, 1002, 27142, 1010, 1035, 1035, 3415, 15327, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Console/CreateUserCommand.php
CreateUserCommand.handle
public function handle() { $userModel = config('admin.database.users_model'); $roleModel = config('admin.database.roles_model'); $username = $this->ask('Please enter a username to login'); $password = bcrypt($this->secret('Please enter a password to login')); $name = $this->ask('Please enter a name to display'); $roles = $roleModel::all(); /** @var array $selected */ $selected = $this->choice('Please choose a role for the user', $roles->pluck('name')->toArray(), null, null, true); $roles = $roles->filter(function ($role) use ($selected) { return in_array($role->name, $selected); }); $user = new $userModel(compact('username', 'password', 'name')); $user->save(); $user->roles()->attach($roles); $this->info("User [$name] created successfully."); }
php
public function handle() { $userModel = config('admin.database.users_model'); $roleModel = config('admin.database.roles_model'); $username = $this->ask('Please enter a username to login'); $password = bcrypt($this->secret('Please enter a password to login')); $name = $this->ask('Please enter a name to display'); $roles = $roleModel::all(); /** @var array $selected */ $selected = $this->choice('Please choose a role for the user', $roles->pluck('name')->toArray(), null, null, true); $roles = $roles->filter(function ($role) use ($selected) { return in_array($role->name, $selected); }); $user = new $userModel(compact('username', 'password', 'name')); $user->save(); $user->roles()->attach($roles); $this->info("User [$name] created successfully."); }
[ "public", "function", "handle", "(", ")", "{", "$", "userModel", "=", "config", "(", "'admin.database.users_model'", ")", ";", "$", "roleModel", "=", "config", "(", "'admin.database.roles_model'", ")", ";", "$", "username", "=", "$", "this", "->", "ask", "("...
Execute the console command.
[ "Execute", "the", "console", "command", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/CreateUserCommand.php#L26-L53
train
Create a new user
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 5310, 5302, 9247, 1027, 9530, 8873, 2290, 1006, 1005, 4748, 10020, 1012, 7809, 1012, 5198, 1035, 2944, 1005, 1007, 1025, 1002, 2535, 5302, 9247, 1027, 9530, 8873, 2290, 1006, 1005, 4748, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php
Connection.bind
public function bind($dn = null, $password = null) { if (!$this->connection) { $this->connect(); } if (false === @ldap_bind($this->connection, $dn, $password)) { throw new ConnectionException(ldap_error($this->connection)); } $this->bound = true; }
php
public function bind($dn = null, $password = null) { if (!$this->connection) { $this->connect(); } if (false === @ldap_bind($this->connection, $dn, $password)) { throw new ConnectionException(ldap_error($this->connection)); } $this->bound = true; }
[ "public", "function", "bind", "(", "$", "dn", "=", "null", ",", "$", "password", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "connection", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "}", "if", "(", "false", "===", "@",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php#L47-L58
train
Binds to the current connection
[ 30522, 2270, 3853, 14187, 1006, 1002, 1040, 2078, 1027, 19701, 1010, 1002, 20786, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 4434, 1007, 1063, 1002, 2023, 1011, 1028, 7532, 1006, 1007, 1025, 1065, 2065, 1006, 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...
z-song/laravel-admin
src/Grid/Column.php
Column.htmlEntityEncode
protected function htmlEntityEncode($item) { if (is_array($item)) { array_walk_recursive($item, function (&$value) { $value = htmlentities($value); }); } else { $item = htmlentities($item); } return $item; }
php
protected function htmlEntityEncode($item) { if (is_array($item)) { array_walk_recursive($item, function (&$value) { $value = htmlentities($value); }); } else { $item = htmlentities($item); } return $item; }
[ "protected", "function", "htmlEntityEncode", "(", "$", "item", ")", "{", "if", "(", "is_array", "(", "$", "item", ")", ")", "{", "array_walk_recursive", "(", "$", "item", ",", "function", "(", "&", "$", "value", ")", "{", "$", "value", "=", "htmlentiti...
Convert characters to HTML entities recursively. @param array|string $item @return mixed
[ "Convert", "characters", "to", "HTML", "entities", "recursively", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L539-L550
train
HTML - Entity - Encode
[ 30522, 5123, 3853, 16129, 4765, 3012, 2368, 16044, 1006, 1002, 8875, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 8875, 1007, 1007, 1063, 9140, 1035, 3328, 1035, 28667, 9236, 3512, 1006, 1002, 8875, 1010, 3853, 1006, 1004, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/VarExporter/Instantiator.php
Instantiator.instantiate
public static function instantiate(string $class, array $properties = [], array $privateProperties = []) { $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); if (Registry::$cloneable[$class]) { $wrappedInstance = [clone Registry::$prototypes[$class]]; } elseif (Registry::$instantiableWithoutConstructor[$class]) { $wrappedInstance = [$reflector->newInstanceWithoutConstructor()]; } elseif (null === Registry::$prototypes[$class]) { throw new NotInstantiableTypeException($class); } elseif ($reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize'))) { $wrappedInstance = [unserialize('C:'.\strlen($class).':"'.$class.'":0:{}')]; } else { $wrappedInstance = [unserialize('O:'.\strlen($class).':"'.$class.'":0:{}')]; } if ($properties) { $privateProperties[$class] = isset($privateProperties[$class]) ? $properties + $privateProperties[$class] : $properties; } foreach ($privateProperties as $class => $properties) { if (!$properties) { continue; } foreach ($properties as $name => $value) { // because they're also used for "unserialization", hydrators // deal with array of instances, so we need to wrap values $properties[$name] = [$value]; } (Hydrator::$hydrators[$class] ?? Hydrator::getHydrator($class))($properties, $wrappedInstance); } return $wrappedInstance[0]; }
php
public static function instantiate(string $class, array $properties = [], array $privateProperties = []) { $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); if (Registry::$cloneable[$class]) { $wrappedInstance = [clone Registry::$prototypes[$class]]; } elseif (Registry::$instantiableWithoutConstructor[$class]) { $wrappedInstance = [$reflector->newInstanceWithoutConstructor()]; } elseif (null === Registry::$prototypes[$class]) { throw new NotInstantiableTypeException($class); } elseif ($reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize'))) { $wrappedInstance = [unserialize('C:'.\strlen($class).':"'.$class.'":0:{}')]; } else { $wrappedInstance = [unserialize('O:'.\strlen($class).':"'.$class.'":0:{}')]; } if ($properties) { $privateProperties[$class] = isset($privateProperties[$class]) ? $properties + $privateProperties[$class] : $properties; } foreach ($privateProperties as $class => $properties) { if (!$properties) { continue; } foreach ($properties as $name => $value) { // because they're also used for "unserialization", hydrators // deal with array of instances, so we need to wrap values $properties[$name] = [$value]; } (Hydrator::$hydrators[$class] ?? Hydrator::getHydrator($class))($properties, $wrappedInstance); } return $wrappedInstance[0]; }
[ "public", "static", "function", "instantiate", "(", "string", "$", "class", ",", "array", "$", "properties", "=", "[", "]", ",", "array", "$", "privateProperties", "=", "[", "]", ")", "{", "$", "reflector", "=", "Registry", "::", "$", "reflectors", "[", ...
Creates an object and sets its properties without calling its constructor nor any other methods. For example: // creates an empty instance of Foo Instantiator::instantiate(Foo::class); // creates a Foo instance and sets one of its properties Instantiator::instantiate(Foo::class, ['propertyName' => $propertyValue]); // creates a Foo instance and sets a private property defined on its parent Bar class Instantiator::instantiate(Foo::class, [], [ Bar::class => ['privateBarProperty' => $propertyValue], ]); Instances of ArrayObject, ArrayIterator and SplObjectHash can be created by using the special "\0" property name to define their internal value: // creates an SplObjectHash where $info1 is attached to $obj1, etc. Instantiator::instantiate(SplObjectStorage::class, ["\0" => [$obj1, $info1, $obj2, $info2...]]); // creates an ArrayObject populated with $inputArray Instantiator::instantiate(ArrayObject::class, ["\0" => [$inputArray]]); @param string $class The class of the instance to create @param array $properties The properties to set on the instance @param array $privateProperties The private properties to set on the instance, keyed by their declaring class @return object The created instance @throws ExceptionInterface When the instance cannot be created
[ "Creates", "an", "object", "and", "sets", "its", "properties", "without", "calling", "its", "constructor", "nor", "any", "other", "methods", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarExporter/Instantiator.php#L60-L93
train
Instantiates a class
[ 30522, 2270, 10763, 3853, 7107, 13143, 1006, 5164, 1002, 2465, 1010, 9140, 1002, 5144, 1027, 1031, 1033, 1010, 9140, 1002, 2797, 21572, 4842, 7368, 1027, 1031, 1033, 1007, 1063, 1002, 8339, 2953, 1027, 15584, 1024, 1024, 1002, 8339, 5668, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/LoggingTranslator.php
LoggingTranslator.setLocale
public function setLocale($locale) { $prev = $this->translator->getLocale(); $this->translator->setLocale($locale); $this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale)); }
php
public function setLocale($locale) { $prev = $this->translator->getLocale(); $this->translator->setLocale($locale); $this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale)); }
[ "public", "function", "setLocale", "(", "$", "locale", ")", "{", "$", "prev", "=", "$", "this", "->", "translator", "->", "getLocale", "(", ")", ";", "$", "this", "->", "translator", "->", "setLocale", "(", "$", "locale", ")", ";", "$", "this", "->",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/LoggingTranslator.php#L83-L88
train
Set the locale of the translator
[ 30522, 2270, 3853, 2275, 4135, 9289, 2063, 1006, 1002, 2334, 2063, 1007, 1063, 1002, 3653, 2615, 1027, 1002, 2023, 1011, 1028, 11403, 1011, 1028, 2131, 4135, 9289, 2063, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 11403, 1011, 1028, 2275, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/IP.php
IP.getIpFromHeader
public static function getIpFromHeader() { $general = Config::getInstance()->General; $clientHeaders = @$general['proxy_client_headers']; if (!is_array($clientHeaders)) { $clientHeaders = array(); } $default = '0.0.0.0'; if (isset($_SERVER['REMOTE_ADDR'])) { $default = $_SERVER['REMOTE_ADDR']; } $ipString = self::getNonProxyIpFromHeader($default, $clientHeaders); return IPUtils::sanitizeIp($ipString); }
php
public static function getIpFromHeader() { $general = Config::getInstance()->General; $clientHeaders = @$general['proxy_client_headers']; if (!is_array($clientHeaders)) { $clientHeaders = array(); } $default = '0.0.0.0'; if (isset($_SERVER['REMOTE_ADDR'])) { $default = $_SERVER['REMOTE_ADDR']; } $ipString = self::getNonProxyIpFromHeader($default, $clientHeaders); return IPUtils::sanitizeIp($ipString); }
[ "public", "static", "function", "getIpFromHeader", "(", ")", "{", "$", "general", "=", "Config", "::", "getInstance", "(", ")", "->", "General", ";", "$", "clientHeaders", "=", "@", "$", "general", "[", "'proxy_client_headers'", "]", ";", "if", "(", "!", ...
Returns the most accurate IP address available for the current user, in IPv4 format. This could be the proxy client's IP address. @return string IP address in presentation format.
[ "Returns", "the", "most", "accurate", "IP", "address", "available", "for", "the", "current", "user", "in", "IPv4", "format", ".", "This", "could", "be", "the", "proxy", "client", "s", "IP", "address", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/IP.php#L46-L61
train
Get the IP address from the client headers
[ 30522, 2270, 10763, 3853, 2131, 11514, 19699, 5358, 4974, 2121, 1006, 1007, 1063, 1002, 2236, 1027, 9530, 8873, 2290, 1024, 1024, 2131, 7076, 26897, 1006, 1007, 1011, 1028, 2236, 1025, 1002, 7396, 4974, 2545, 1027, 1030, 1002, 2236, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php
ProxyCacheWarmer.warmUp
public function warmUp($cacheDir) { foreach ($this->registry->getManagers() as $em) { // we need the directory no matter the proxy cache generation strategy if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) { if (false === @mkdir($proxyCacheDir, 0777, true)) { throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir)); } } elseif (!is_writable($proxyCacheDir)) { throw new \RuntimeException(sprintf('The Doctrine Proxy directory "%s" is not writeable for the current system user.', $proxyCacheDir)); } // if proxies are autogenerated we don't need to generate them in the cache warmer if ($em->getConfiguration()->getAutoGenerateProxyClasses()) { continue; } $classes = $em->getMetadataFactory()->getAllMetadata(); $em->getProxyFactory()->generateProxyClasses($classes); } }
php
public function warmUp($cacheDir) { foreach ($this->registry->getManagers() as $em) { // we need the directory no matter the proxy cache generation strategy if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) { if (false === @mkdir($proxyCacheDir, 0777, true)) { throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir)); } } elseif (!is_writable($proxyCacheDir)) { throw new \RuntimeException(sprintf('The Doctrine Proxy directory "%s" is not writeable for the current system user.', $proxyCacheDir)); } // if proxies are autogenerated we don't need to generate them in the cache warmer if ($em->getConfiguration()->getAutoGenerateProxyClasses()) { continue; } $classes = $em->getMetadataFactory()->getAllMetadata(); $em->getProxyFactory()->generateProxyClasses($classes); } }
[ "public", "function", "warmUp", "(", "$", "cacheDir", ")", "{", "foreach", "(", "$", "this", "->", "registry", "->", "getManagers", "(", ")", "as", "$", "em", ")", "{", "// we need the directory no matter the proxy cache generation strategy", "if", "(", "!", "is...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php#L47-L68
train
Warms up the Doctrine Proxy classes
[ 30522, 2270, 3853, 4010, 6279, 1006, 1002, 17053, 4305, 2099, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 15584, 1011, 1028, 2131, 24805, 15776, 1006, 1007, 2004, 1002, 7861, 1007, 1063, 1013, 1013, 2057, 2342, 1996, 14176, 2053,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...