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
z-song/laravel-admin
src/Form/EmbeddedForm.php
EmbeddedForm.fill
public function fill(array $data) { $this->fields->each(function (Field $field) use ($data) { $field->fill($data); }); return $this; }
php
public function fill(array $data) { $this->fields->each(function (Field $field) use ($data) { $field->fill($data); }); return $this; }
[ "public", "function", "fill", "(", "array", "$", "data", ")", "{", "$", "this", "->", "fields", "->", "each", "(", "function", "(", "Field", "$", "field", ")", "use", "(", "$", "data", ")", "{", "$", "field", "->", "fill", "(", "$", "data", ")", ...
Fill data to all fields in form. @param array $data @return $this
[ "Fill", "data", "to", "all", "fields", "in", "form", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/EmbeddedForm.php#L201-L208
train
Fill the fields with the given data
[ 30522, 2270, 3853, 6039, 1006, 9140, 1002, 2951, 1007, 1063, 1002, 2023, 1011, 1028, 4249, 1011, 1028, 2169, 1006, 3853, 1006, 2492, 1002, 2492, 1007, 2224, 1006, 1002, 2951, 1007, 1063, 1002, 2492, 1011, 1028, 6039, 1006, 1002, 2951, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/FormField.php
FormField.displayAs
public function displayAs($type, $config = []) { $this->type = strtolower($type) ?: $this->type; $this->config = $this->evalConfig($config); return $this; }
php
public function displayAs($type, $config = []) { $this->type = strtolower($type) ?: $this->type; $this->config = $this->evalConfig($config); return $this; }
[ "public", "function", "displayAs", "(", "$", "type", ",", "$", "config", "=", "[", "]", ")", "{", "$", "this", "->", "type", "=", "strtolower", "(", "$", "type", ")", "?", ":", "$", "this", "->", "type", ";", "$", "this", "->", "config", "=", "...
Specifies a field control rendering mode. Supported modes are: - text - creates a text field. Default for varchar column types. - textarea - creates a textarea control. Default for text column types. - dropdown - creates a drop-down list. Default for reference-based columns. - radio - creates a set of radio buttons. - checkbox - creates a single checkbox. - checkboxlist - creates a checkbox list. - switch - creates a switch field. @param string $type Specifies a render mode as described above @param array $config A list of render mode specific config.
[ "Specifies", "a", "field", "control", "rendering", "mode", ".", "Supported", "modes", "are", ":", "-", "text", "-", "creates", "a", "text", "field", ".", "Default", "for", "varchar", "column", "types", ".", "-", "textarea", "-", "creates", "a", "textarea",...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormField.php#L255-L261
train
Display as type and config
[ 30522, 2270, 3853, 4653, 3022, 1006, 1002, 2828, 1010, 1002, 9530, 8873, 2290, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 2828, 1027, 2358, 5339, 12898, 13777, 1006, 1002, 2828, 1007, 1029, 1024, 1002, 2023, 1011, 1028, 2828, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/PostgresBuilder.php
PostgresBuilder.hasTable
public function hasTable($table) { [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; return count($this->connection->select( $this->grammar->compileTableExists(), [$schema, $table] )) > 0; }
php
public function hasTable($table) { [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; return count($this->connection->select( $this->grammar->compileTableExists(), [$schema, $table] )) > 0; }
[ "public", "function", "hasTable", "(", "$", "table", ")", "{", "[", "$", "schema", ",", "$", "table", "]", "=", "$", "this", "->", "parseSchemaAndTable", "(", "$", "table", ")", ";", "$", "table", "=", "$", "this", "->", "connection", "->", "getTable...
Determine if the given table exists. @param string $table @return bool
[ "Determine", "if", "the", "given", "table", "exists", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/PostgresBuilder.php#L13-L22
train
Checks if a table exists in the database.
[ 30522, 2270, 3853, 2038, 10880, 1006, 1002, 2795, 1007, 1063, 1031, 1002, 8040, 28433, 1010, 1002, 2795, 1033, 1027, 1002, 2023, 1011, 1028, 11968, 8583, 5403, 2863, 5685, 10880, 1006, 1002, 2795, 1007, 1025, 1002, 2795, 1027, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/FactoryBuilder.php
FactoryBuilder.expandAttributes
protected function expandAttributes(array $attributes) { foreach ($attributes as &$attribute) { if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { $attribute = $attribute($attributes); } if ($attribute instanceof static) { $attribute = $attribute->create()->getKey(); } if ($attribute instanceof Model) { $attribute = $attribute->getKey(); } } return $attributes; }
php
protected function expandAttributes(array $attributes) { foreach ($attributes as &$attribute) { if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { $attribute = $attribute($attributes); } if ($attribute instanceof static) { $attribute = $attribute->create()->getKey(); } if ($attribute instanceof Model) { $attribute = $attribute->getKey(); } } return $attributes; }
[ "protected", "function", "expandAttributes", "(", "array", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "&", "$", "attribute", ")", "{", "if", "(", "is_callable", "(", "$", "attribute", ")", "&&", "!", "is_string", "(", "$", "att...
Expand all attributes to their underlying values. @param array $attributes @return array
[ "Expand", "all", "attributes", "to", "their", "underlying", "values", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/FactoryBuilder.php#L359-L376
train
Expand attributes to array
[ 30522, 5123, 3853, 7818, 19321, 3089, 8569, 4570, 1006, 9140, 1002, 12332, 1007, 1063, 18921, 6776, 1006, 1002, 12332, 2004, 1004, 1002, 17961, 1007, 1063, 2065, 1006, 2003, 1035, 2655, 3085, 1006, 1002, 17961, 1007, 1004, 1004, 999, 2003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Collection/AbstractIndexCollection.php
AbstractIndexCollection.current
public function current() { $value = current($this->entries); $key = key($this->entries); return $this->loadElement($key, $value); }
php
public function current() { $value = current($this->entries); $key = key($this->entries); return $this->loadElement($key, $value); }
[ "public", "function", "current", "(", ")", "{", "$", "value", "=", "current", "(", "$", "this", "->", "entries", ")", ";", "$", "key", "=", "key", "(", "$", "this", "->", "entries", ")", ";", "return", "$", "this", "->", "loadElement", "(", "$", ...
{@inheritDoc}
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Collection/AbstractIndexCollection.php#L85-L91
train
Return the current element
[ 30522, 2270, 3853, 2783, 1006, 1007, 1063, 1002, 3643, 1027, 2783, 1006, 1002, 2023, 1011, 1028, 10445, 1007, 1025, 1002, 3145, 1027, 3145, 1006, 1002, 2023, 1011, 1028, 10445, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 7170, 12260, 3672, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/JsonSerializableNormalizer.php
JsonSerializableNormalizer.normalize
public function normalize($object, $format = null, array $context = []) { if ($this->isCircularReference($object, $context)) { return $this->handleCircularReference($object); } if (!$object instanceof \JsonSerializable) { throw new InvalidArgumentException(sprintf('The object must implement "%s".', \JsonSerializable::class)); } if (!$this->serializer instanceof NormalizerInterface) { throw new LogicException('Cannot normalize object because injected serializer is not a normalizer'); } return $this->serializer->normalize($object->jsonSerialize(), $format, $context); }
php
public function normalize($object, $format = null, array $context = []) { if ($this->isCircularReference($object, $context)) { return $this->handleCircularReference($object); } if (!$object instanceof \JsonSerializable) { throw new InvalidArgumentException(sprintf('The object must implement "%s".', \JsonSerializable::class)); } if (!$this->serializer instanceof NormalizerInterface) { throw new LogicException('Cannot normalize object because injected serializer is not a normalizer'); } return $this->serializer->normalize($object->jsonSerialize(), $format, $context); }
[ "public", "function", "normalize", "(", "$", "object", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "isCircularReference", "(", "$", "object", ",", "$", "context", ")", ")", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php#L27-L42
train
Normalize an object
[ 30522, 2270, 3853, 3671, 4697, 1006, 1002, 4874, 1010, 1002, 4289, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 6895, 11890, 7934, 2890, 25523, 1006, 1002, 4874, 1010, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Notification/Manager.php
Manager.notify
public static function notify($id, Notification $notification) { self::checkId($id); self::removeOldestNotificationsIfThereAreTooMany(); self::addNotification($id, $notification); }
php
public static function notify($id, Notification $notification) { self::checkId($id); self::removeOldestNotificationsIfThereAreTooMany(); self::addNotification($id, $notification); }
[ "public", "static", "function", "notify", "(", "$", "id", ",", "Notification", "$", "notification", ")", "{", "self", "::", "checkId", "(", "$", "id", ")", ";", "self", "::", "removeOldestNotificationsIfThereAreTooMany", "(", ")", ";", "self", "::", "addNoti...
Posts a notification that will be shown in Piwik's status bar. If a notification with the same ID has been posted and has not been closed/removed, it will be replaced with `$notification`. @param string $id A unique identifier for this notification. The ID must be a valid HTML element ID. It can only contain alphanumeric characters (underscores can be used). @param Notification $notification The notification to post. @api
[ "Posts", "a", "notification", "that", "will", "be", "shown", "in", "Piwik", "s", "status", "bar", ".", "If", "a", "notification", "with", "the", "same", "ID", "has", "been", "posted", "and", "has", "not", "been", "closed", "/", "removed", "it", "will", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Notification/Manager.php#L41-L47
train
Notify a notification
[ 30522, 2270, 10763, 3853, 2025, 8757, 1006, 1002, 8909, 1010, 26828, 1002, 26828, 1007, 1063, 2969, 1024, 1024, 4638, 3593, 1006, 1002, 8909, 1007, 1025, 2969, 1024, 1024, 6366, 11614, 4355, 17048, 9031, 5332, 6199, 5886, 14644, 18903, 2077...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.whereKeyNot
public function whereKeyNot($id) { if (is_array($id) || $id instanceof Arrayable) { $this->query->whereNotIn($this->model->getQualifiedKeyName(), $id); return $this; } return $this->where($this->model->getQualifiedKeyName(), '!=', $id); }
php
public function whereKeyNot($id) { if (is_array($id) || $id instanceof Arrayable) { $this->query->whereNotIn($this->model->getQualifiedKeyName(), $id); return $this; } return $this->where($this->model->getQualifiedKeyName(), '!=', $id); }
[ "public", "function", "whereKeyNot", "(", "$", "id", ")", "{", "if", "(", "is_array", "(", "$", "id", ")", "||", "$", "id", "instanceof", "Arrayable", ")", "{", "$", "this", "->", "query", "->", "whereNotIn", "(", "$", "this", "->", "model", "->", ...
Add a where clause on the primary key to the query. @param mixed $id @return $this
[ "Add", "a", "where", "clause", "on", "the", "primary", "key", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L203-L212
train
Filter the query by key not equal to the value of the primary key
[ 30522, 2270, 3853, 2073, 14839, 17048, 1006, 1002, 8909, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 8909, 1007, 1064, 1064, 1002, 8909, 6013, 11253, 9140, 3085, 1007, 1063, 1002, 2023, 1011, 1028, 23032, 1011, 1028, 2073, 17048, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.getArrayableAppends
protected function getArrayableAppends() { if (! count($this->appends)) { return []; } return $this->getArrayableItems( array_combine($this->appends, $this->appends) ); }
php
protected function getArrayableAppends() { if (! count($this->appends)) { return []; } return $this->getArrayableItems( array_combine($this->appends, $this->appends) ); }
[ "protected", "function", "getArrayableAppends", "(", ")", "{", "if", "(", "!", "count", "(", "$", "this", "->", "appends", ")", ")", "{", "return", "[", "]", ";", "}", "return", "$", "this", "->", "getArrayableItems", "(", "array_combine", "(", "$", "t...
Get all of the appendable values that are arrayable. @return array
[ "Get", "all", "of", "the", "appendable", "values", "that", "are", "arrayable", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L218-L227
train
Returns array of arrayable append items
[ 30522, 5123, 3853, 2131, 2906, 29539, 3468, 29098, 10497, 2015, 1006, 1007, 1063, 2065, 1006, 999, 4175, 1006, 1002, 2023, 1011, 1028, 10439, 10497, 2015, 1007, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 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...
overtrue/wechat
src/Kernel/Http/Response.php
Response.toArray
public function toArray() { $content = $this->removeControlCharacters($this->getBodyContents()); if (false !== stripos($this->getHeaderLine('Content-Type'), 'xml') || 0 === stripos($content, '<xml')) { return XML::parse($content); } $array = json_decode($content, true, 512, JSON_BIGINT_AS_STRING); if (JSON_ERROR_NONE === json_last_error()) { return (array) $array; } return []; }
php
public function toArray() { $content = $this->removeControlCharacters($this->getBodyContents()); if (false !== stripos($this->getHeaderLine('Content-Type'), 'xml') || 0 === stripos($content, '<xml')) { return XML::parse($content); } $array = json_decode($content, true, 512, JSON_BIGINT_AS_STRING); if (JSON_ERROR_NONE === json_last_error()) { return (array) $array; } return []; }
[ "public", "function", "toArray", "(", ")", "{", "$", "content", "=", "$", "this", "->", "removeControlCharacters", "(", "$", "this", "->", "getBodyContents", "(", ")", ")", ";", "if", "(", "false", "!==", "stripos", "(", "$", "this", "->", "getHeaderLine...
Build to array. @return array
[ "Build", "to", "array", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Http/Response.php#L69-L84
train
Convert response to array
[ 30522, 2270, 3853, 2000, 2906, 9447, 1006, 1007, 1063, 1002, 4180, 1027, 30524, 1027, 6167, 2891, 1006, 1002, 2023, 1011, 1028, 2131, 4974, 2121, 4179, 1006, 1005, 4180, 1011, 2828, 1005, 1007, 1010, 1005, 20950, 1005, 1007, 1064, 1064, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.initializeWithUrlAndRootPath
public function initializeWithUrlAndRootPath($url, $root_path) { $this->initializeWithUrl($url); $this->root_path = $root_path; return $this; }
php
public function initializeWithUrlAndRootPath($url, $root_path) { $this->initializeWithUrl($url); $this->root_path = $root_path; return $this; }
[ "public", "function", "initializeWithUrlAndRootPath", "(", "$", "url", ",", "$", "root_path", ")", "{", "$", "this", "->", "initializeWithUrl", "(", "$", "url", ")", ";", "$", "this", "->", "root_path", "=", "$", "root_path", ";", "return", "$", "this", ...
Initialize the URI class by providing url and root_path arguments @param string $url @param string $root_path @return $this
[ "Initialize", "the", "URI", "class", "by", "providing", "url", "and", "root_path", "arguments" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L96-L102
train
Initialize the current class with the url and root path
[ 30522, 2270, 3853, 3988, 4697, 24415, 3126, 3122, 3217, 4140, 15069, 1006, 1002, 24471, 2140, 1010, 1002, 7117, 1035, 4130, 1007, 1063, 1002, 2023, 1011, 1028, 3988, 4697, 24415, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1025, 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/Security/Core/Authentication/AuthenticationTrustResolver.php
AuthenticationTrustResolver.isAnonymous
public function isAnonymous(TokenInterface $token = null) { if (null === $token) { return false; } if (null !== $this->anonymousClass) { return $token instanceof $this->anonymousClass; } return $token instanceof AnonymousToken; }
php
public function isAnonymous(TokenInterface $token = null) { if (null === $token) { return false; } if (null !== $this->anonymousClass) { return $token instanceof $this->anonymousClass; } return $token instanceof AnonymousToken; }
[ "public", "function", "isAnonymous", "(", "TokenInterface", "$", "token", "=", "null", ")", "{", "if", "(", "null", "===", "$", "token", ")", "{", "return", "false", ";", "}", "if", "(", "null", "!==", "$", "this", "->", "anonymousClass", ")", "{", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php#L45-L56
train
Returns true if the token is an anonymous token false if otherwise.
[ 30522, 2270, 3853, 18061, 8540, 24335, 3560, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 19204, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 19701, 999, 1027, 1027, 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/Form/Extension/Validator/ValidatorTypeGuesser.php
ValidatorTypeGuesser.guess
protected function guess($class, $property, \Closure $closure, $defaultValue = null) { $guesses = []; $classMetadata = $this->metadataFactory->getMetadataFor($class); if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) { foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) { foreach ($memberMetadata->getConstraints() as $constraint) { if ($guess = $closure($constraint)) { $guesses[] = $guess; } } } } if (null !== $defaultValue) { $guesses[] = new ValueGuess($defaultValue, Guess::LOW_CONFIDENCE); } return Guess::getBestGuess($guesses); }
php
protected function guess($class, $property, \Closure $closure, $defaultValue = null) { $guesses = []; $classMetadata = $this->metadataFactory->getMetadataFor($class); if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) { foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) { foreach ($memberMetadata->getConstraints() as $constraint) { if ($guess = $closure($constraint)) { $guesses[] = $guess; } } } } if (null !== $defaultValue) { $guesses[] = new ValueGuess($defaultValue, Guess::LOW_CONFIDENCE); } return Guess::getBestGuess($guesses); }
[ "protected", "function", "guess", "(", "$", "class", ",", "$", "property", ",", "\\", "Closure", "$", "closure", ",", "$", "defaultValue", "=", "null", ")", "{", "$", "guesses", "=", "[", "]", ";", "$", "classMetadata", "=", "$", "this", "->", "metad...
Iterates over the constraints of a property, executes a constraints on them and returns the best guess. @param string $class The class to read the constraints from @param string $property The property for which to find constraints @param \Closure $closure The closure that returns a guess for a given constraint @param mixed $defaultValue The default value assumed if no other value can be guessed @return Guess|null The guessed value with the highest confidence
[ "Iterates", "over", "the", "constraints", "of", "a", "property", "executes", "a", "constraints", "on", "them", "and", "returns", "the", "best", "guess", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php#L250-L270
train
Guesses the value of a property on a class.
[ 30522, 5123, 3853, 3984, 1006, 1002, 2465, 1010, 1002, 3200, 1010, 1032, 8503, 1002, 8503, 1010, 1002, 12398, 10175, 5657, 1027, 19701, 1007, 1063, 1002, 3984, 2229, 1027, 1031, 1033, 1025, 1002, 2465, 11368, 8447, 2696, 1027, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php
RemoveAbstractDefinitionsPass.process
public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { if ($definition->isAbstract()) { $container->removeDefinition($id); $container->log($this, sprintf('Removed service "%s"; reason: abstract.', $id)); } } }
php
public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { if ($definition->isAbstract()) { $container->removeDefinition($id); $container->log($this, sprintf('Removed service "%s"; reason: abstract.', $id)); } } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "foreach", "(", "$", "container", "->", "getDefinitions", "(", ")", "as", "$", "id", "=>", "$", "definition", ")", "{", "if", "(", "$", "definition", "->", "isAbstract", ...
Removes abstract definitions from the ContainerBuilder.
[ "Removes", "abstract", "definitions", "from", "the", "ContainerBuilder", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php#L24-L32
train
Remove abstract services from the container
[ 30522, 2270, 3853, 2832, 1006, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 18921, 6776, 1006, 1002, 11661, 1011, 1028, 2131, 3207, 16294, 22753, 2015, 1006, 1007, 2004, 1002, 8909, 1027, 1028, 1002, 6210, 1007, 1063, 2065, 1006, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Form.php
Form.dataArraySet
protected function dataArraySet(array &$array, array $parts, $value) { if ($parts === null) { return $value; } while (count($parts) > 1) { $key = array_shift($parts); if (!isset($array[$key]) || !is_array($array[$key])) { $array[$key] = []; } $array =& $array[$key]; } $array[array_shift($parts)] = $value; return $array; }
php
protected function dataArraySet(array &$array, array $parts, $value) { if ($parts === null) { return $value; } while (count($parts) > 1) { $key = array_shift($parts); if (!isset($array[$key]) || !is_array($array[$key])) { $array[$key] = []; } $array =& $array[$key]; } $array[array_shift($parts)] = $value; return $array; }
[ "protected", "function", "dataArraySet", "(", "array", "&", "$", "array", ",", "array", "$", "parts", ",", "$", "value", ")", "{", "if", "(", "$", "parts", "===", "null", ")", "{", "return", "$", "value", ";", "}", "while", "(", "count", "(", "$", ...
Variant to array_set() but preserves dots in key names. @param array $array @param array $parts @param string $value @return array
[ "Variant", "to", "array_set", "()", "but", "preserves", "dots", "in", "key", "names", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L1374-L1393
train
Array Set Method
[ 30522, 5123, 3853, 2951, 2906, 9447, 13462, 1006, 9140, 1004, 1002, 9140, 1010, 9140, 1002, 3033, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 1002, 3033, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 1002, 3643, 1025, 1065, 2096, 1006, 4175, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Filter.php
Filter.datesFromAjax
protected function datesFromAjax($ajaxDates) { $dates = []; $dateRegex = '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/'; if (null !== $ajaxDates) { if (!is_array($ajaxDates)) { if(preg_match($dateRegex, $ajaxDates)) { $dates = [$ajaxDates]; } } else { foreach ($ajaxDates as $i => $date) { if (preg_match($dateRegex, $date)) { $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', $date); } elseif (empty($date)) { if($i == 0) { $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '0000-00-00 00:00:00'); } else { $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '2999-12-31 23:59:59'); } } else { $dates = []; break; } } } } return $dates; }
php
protected function datesFromAjax($ajaxDates) { $dates = []; $dateRegex = '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/'; if (null !== $ajaxDates) { if (!is_array($ajaxDates)) { if(preg_match($dateRegex, $ajaxDates)) { $dates = [$ajaxDates]; } } else { foreach ($ajaxDates as $i => $date) { if (preg_match($dateRegex, $date)) { $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', $date); } elseif (empty($date)) { if($i == 0) { $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '0000-00-00 00:00:00'); } else { $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '2999-12-31 23:59:59'); } } else { $dates = []; break; } } } } return $dates; }
[ "protected", "function", "datesFromAjax", "(", "$", "ajaxDates", ")", "{", "$", "dates", "=", "[", "]", ";", "$", "dateRegex", "=", "'/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/'", ";", "if", "(", "null", "!==", "$", "ajaxDates", ")", "{", "if", "(", "!", ...
Convert an array from the posted dates @param array $dates @return array
[ "Convert", "an", "array", "from", "the", "posted", "dates" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L971-L999
train
Parse dates from ajax
[ 30522, 5123, 3853, 5246, 19699, 9626, 3900, 2595, 1006, 1002, 18176, 27122, 1007, 1063, 1002, 5246, 1027, 1031, 1033, 1025, 1002, 3058, 2890, 3351, 2595, 1027, 1005, 1013, 1032, 1040, 1063, 1018, 1065, 1011, 1032, 1040, 1063, 1016, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/OptionsResolver/OptionsResolver.php
OptionsResolver.setDefined
public function setDefined($optionNames) { if ($this->locked) { throw new AccessException('Options cannot be defined from a lazy option or normalizer.'); } foreach ((array) $optionNames as $option) { $this->defined[$option] = true; } return $this; }
php
public function setDefined($optionNames) { if ($this->locked) { throw new AccessException('Options cannot be defined from a lazy option or normalizer.'); } foreach ((array) $optionNames as $option) { $this->defined[$option] = true; } return $this; }
[ "public", "function", "setDefined", "(", "$", "optionNames", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "AccessException", "(", "'Options cannot be defined from a lazy option or normalizer.'", ")", ";", "}", "foreach", "(", "(", ...
Defines a valid option name. Defines an option name without setting a default value. The option will be accepted when passed to {@link resolve()}. When not passed, the option will not be included in the resolved options. @param string|string[] $optionNames One or more option names @return $this @throws AccessException If called from a lazy option or normalizer
[ "Defines", "a", "valid", "option", "name", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L355-L366
train
Set the defined options
[ 30522, 2270, 3853, 2275, 3207, 23460, 2094, 1006, 1002, 5724, 18442, 2015, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 3229, 10288, 24422, 1006, 1005, 7047, 3685, 2022, 4225, 2013, 1037, 13971, 5724, 2030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CurrencyDataGenerator.php
CurrencyDataGenerator.generateDataForLocale
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale) { $localeBundle = $reader->read($tempDir, $displayLocale); if (isset($localeBundle['Currencies']) && null !== $localeBundle['Currencies']) { $data = [ 'Version' => $localeBundle['Version'], 'Names' => $this->generateSymbolNamePairs($localeBundle), ]; $this->currencyCodes = array_merge($this->currencyCodes, array_keys($data['Names'])); return $data; } }
php
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale) { $localeBundle = $reader->read($tempDir, $displayLocale); if (isset($localeBundle['Currencies']) && null !== $localeBundle['Currencies']) { $data = [ 'Version' => $localeBundle['Version'], 'Names' => $this->generateSymbolNamePairs($localeBundle), ]; $this->currencyCodes = array_merge($this->currencyCodes, 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/CurrencyDataGenerator.php#L96-L110
train
Generate data for 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/Mime/Header/ParameterizedHeader.php
ParameterizedHeader.toTokens
protected function toTokens(string $string = null): array { $tokens = parent::toTokens(parent::getBodyAsString()); // Try creating any parameters foreach ($this->parameters as $name => $value) { if (null !== $value) { // Add the semi-colon separator $tokens[\count($tokens) - 1] .= ';'; $tokens = array_merge($tokens, $this->generateTokenLines(' '.$this->createParameter($name, $value))); } } return $tokens; }
php
protected function toTokens(string $string = null): array { $tokens = parent::toTokens(parent::getBodyAsString()); // Try creating any parameters foreach ($this->parameters as $name => $value) { if (null !== $value) { // Add the semi-colon separator $tokens[\count($tokens) - 1] .= ';'; $tokens = array_merge($tokens, $this->generateTokenLines(' '.$this->createParameter($name, $value))); } } return $tokens; }
[ "protected", "function", "toTokens", "(", "string", "$", "string", "=", "null", ")", ":", "array", "{", "$", "tokens", "=", "parent", "::", "toTokens", "(", "parent", "::", "getBodyAsString", "(", ")", ")", ";", "// Try creating any parameters", "foreach", "...
Generate a list of all tokens in the final header. This doesn't need to be overridden in theory, but it is for implementation reasons to prevent potential breakage of attributes.
[ "Generate", "a", "list", "of", "all", "tokens", "in", "the", "final", "header", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Header/ParameterizedHeader.php#L90-L104
train
Generate the tokens from the body of the message
[ 30522, 5123, 3853, 2000, 18715, 6132, 1006, 5164, 1002, 5164, 1027, 19701, 1007, 1024, 9140, 1063, 1002, 19204, 2015, 1027, 6687, 1024, 1024, 2000, 18715, 6132, 1006, 6687, 1024, 1024, 2131, 23684, 12054, 18886, 3070, 1006, 1007, 1007, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Diagnostics/Diagnostic/DiagnosticResult.php
DiagnosticResult.getStatus
public function getStatus() { $status = self::STATUS_OK; foreach ($this->getItems() as $item) { if ($item->getStatus() === self::STATUS_ERROR) { return self::STATUS_ERROR; } if ($item->getStatus() === self::STATUS_WARNING) { $status = self::STATUS_WARNING; } } return $status; }
php
public function getStatus() { $status = self::STATUS_OK; foreach ($this->getItems() as $item) { if ($item->getStatus() === self::STATUS_ERROR) { return self::STATUS_ERROR; } if ($item->getStatus() === self::STATUS_WARNING) { $status = self::STATUS_WARNING; } } return $status; }
[ "public", "function", "getStatus", "(", ")", "{", "$", "status", "=", "self", "::", "STATUS_OK", ";", "foreach", "(", "$", "this", "->", "getItems", "(", ")", "as", "$", "item", ")", "{", "if", "(", "$", "item", "->", "getStatus", "(", ")", "===", ...
Returns the worst status of the items. @return string One of the `STATUS_*` constants.
[ "Returns", "the", "worst", "status", "of", "the", "items", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Diagnostics/Diagnostic/DiagnosticResult.php#L105-L120
train
Get the status of the tree
[ 30522, 2270, 3853, 4152, 29336, 2271, 1006, 1007, 1063, 1002, 3570, 1027, 2969, 1024, 1024, 3570, 1035, 7929, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 4221, 5244, 1006, 1007, 2004, 1002, 8875, 1007, 1063, 2065, 1006, 1002, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/Controller.php
Controller.getNextMissingDbUrlInfoGeoIp2
private function getNextMissingDbUrlInfoGeoIp2() { $missingDbs = GeoIP2AutoUpdater::getMissingDatabases(); if (!empty($missingDbs)) { $missingDbKey = $missingDbs[0]; $missingDbName = GeoIp2::$dbNames[$missingDbKey][0]; $url = GeoIP2AutoUpdater::getConfiguredUrl($missingDbKey); $link = '<a href="' . $url . '">' . $missingDbName . '</a>'; return array( 'to_download' => $missingDbKey, 'to_download_label' => Piwik::translate('UserCountry_DownloadingDb', $link) . '...', ); } return false; }
php
private function getNextMissingDbUrlInfoGeoIp2() { $missingDbs = GeoIP2AutoUpdater::getMissingDatabases(); if (!empty($missingDbs)) { $missingDbKey = $missingDbs[0]; $missingDbName = GeoIp2::$dbNames[$missingDbKey][0]; $url = GeoIP2AutoUpdater::getConfiguredUrl($missingDbKey); $link = '<a href="' . $url . '">' . $missingDbName . '</a>'; return array( 'to_download' => $missingDbKey, 'to_download_label' => Piwik::translate('UserCountry_DownloadingDb', $link) . '...', ); } return false; }
[ "private", "function", "getNextMissingDbUrlInfoGeoIp2", "(", ")", "{", "$", "missingDbs", "=", "GeoIP2AutoUpdater", "::", "getMissingDatabases", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "missingDbs", ")", ")", "{", "$", "missingDbKey", "=", "$", "mi...
Gets information for the first missing GeoIP2 database (if any). @return array|bool
[ "Gets", "information", "for", "the", "first", "missing", "GeoIP2", "database", "(", "if", "any", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/Controller.php#L456-L472
train
Get next missing database URL info
[ 30522, 2797, 3853, 2131, 2638, 18413, 15630, 7741, 18939, 3126, 4115, 14876, 3351, 10448, 2361, 2475, 1006, 1007, 1063, 1002, 4394, 18939, 2015, 1027, 20248, 11514, 2475, 4887, 24826, 17299, 24932, 1024, 1024, 2131, 15630, 7741, 2850, 2696, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/API.php
API.setLocationProvider
public function setLocationProvider($providerId) { Piwik::checkUserHasSuperUserAccess(); if (!UserCountry::isGeoLocationAdminEnabled()) { throw new \Exception('Setting geo location has been disabled in config.'); } $provider = LocationProvider::setCurrentProvider($providerId); if ($provider === false) { throw new Exception("Invalid provider ID: '$providerId'."); } }
php
public function setLocationProvider($providerId) { Piwik::checkUserHasSuperUserAccess(); if (!UserCountry::isGeoLocationAdminEnabled()) { throw new \Exception('Setting geo location has been disabled in config.'); } $provider = LocationProvider::setCurrentProvider($providerId); if ($provider === false) { throw new Exception("Invalid provider ID: '$providerId'."); } }
[ "public", "function", "setLocationProvider", "(", "$", "providerId", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "if", "(", "!", "UserCountry", "::", "isGeoLocationAdminEnabled", "(", ")", ")", "{", "throw", "new", "\\", "Exception", ...
Set the location provider @param string $providerId The ID of the provider to use eg 'default', 'geoip2_php', ... @throws Exception if ID is invalid
[ "Set", "the", "location", "provider" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/API.php#L389-L401
train
Sets the location provider to use for geo location.
[ 30522, 2270, 3853, 2275, 4135, 10719, 21572, 17258, 2121, 1006, 1002, 10802, 3593, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1025, 2065, 1006, 999, 5310, 3597, 16671, 285...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/PrivacyManager/ReportsPurger.php
ReportsPurger.getArchiveTablesToPurge
private function getArchiveTablesToPurge() { // get month for which reports as old or older than, should be deleted // reports whose creation date <= this month will be deleted // (NOTE: we ignore how far we are in the current month) $toRemoveDate = Date::factory('today')->subMonth(1 + $this->deleteReportsOlderThan); // find all archive tables that are older than N months $oldNumericTables = array(); $oldBlobTables = array(); foreach (DbHelper::getTablesInstalled() as $table) { $type = ArchiveTableCreator::getTypeFromTableName($table); if ($type === false) { continue; } $date = ArchiveTableCreator::getDateFromTableName($table); list($year, $month) = explode('_', $date); if (self::shouldReportBePurged($year, $month, $toRemoveDate)) { if ($type == ArchiveTableCreator::NUMERIC_TABLE) { $oldNumericTables[] = $table; } else { $oldBlobTables[] = $table; } } } return array($oldNumericTables, $oldBlobTables); }
php
private function getArchiveTablesToPurge() { // get month for which reports as old or older than, should be deleted // reports whose creation date <= this month will be deleted // (NOTE: we ignore how far we are in the current month) $toRemoveDate = Date::factory('today')->subMonth(1 + $this->deleteReportsOlderThan); // find all archive tables that are older than N months $oldNumericTables = array(); $oldBlobTables = array(); foreach (DbHelper::getTablesInstalled() as $table) { $type = ArchiveTableCreator::getTypeFromTableName($table); if ($type === false) { continue; } $date = ArchiveTableCreator::getDateFromTableName($table); list($year, $month) = explode('_', $date); if (self::shouldReportBePurged($year, $month, $toRemoveDate)) { if ($type == ArchiveTableCreator::NUMERIC_TABLE) { $oldNumericTables[] = $table; } else { $oldBlobTables[] = $table; } } } return array($oldNumericTables, $oldBlobTables); }
[ "private", "function", "getArchiveTablesToPurge", "(", ")", "{", "// get month for which reports as old or older than, should be deleted", "// reports whose creation date <= this month will be deleted", "// (NOTE: we ignore how far we are in the current month)", "$", "toRemoveDate", "=", "Da...
Utility function that finds every archive table whose reports are considered old. @return array An array of two arrays. The first holds the numeric archive table names, and the second holds the blob archive table names.
[ "Utility", "function", "that", "finds", "every", "archive", "table", "whose", "reports", "are", "considered", "old", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/ReportsPurger.php#L212-L240
train
Get archive tables that should be purged
[ 30522, 2797, 3853, 2131, 2906, 5428, 19510, 3085, 16033, 5311, 3351, 1006, 1007, 1063, 1013, 1013, 2131, 3204, 2005, 2029, 4311, 2004, 2214, 2030, 3080, 2084, 1010, 2323, 2022, 17159, 1013, 1013, 4311, 3005, 4325, 3058, 1026, 1027, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Archive/DataCollection.php
DataCollection.set
public function set($idSite, $period, $name, $value) { $row = & $this->get($idSite, $period); $row[$name] = $value; }
php
public function set($idSite, $period, $name, $value) { $row = & $this->get($idSite, $period); $row[$name] = $value; }
[ "public", "function", "set", "(", "$", "idSite", ",", "$", "period", ",", "$", "name", ",", "$", "value", ")", "{", "$", "row", "=", "&", "$", "this", "->", "get", "(", "$", "idSite", ",", "$", "period", ")", ";", "$", "row", "[", "$", "name"...
Set data for a specific site & period. If there is no data for the given site ID & period, it is set to the default row. @param int $idSite @param string $period eg, '2012-01-01,2012-01-31' @param string $name eg 'nb_visits' @param string $value eg 5
[ "Set", "data", "for", "a", "specific", "site", "&", "period", ".", "If", "there", "is", "no", "data", "for", "the", "given", "site", "ID", "&", "period", "it", "is", "set", "to", "the", "default", "row", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataCollection.php#L149-L153
train
Set a value in the header for the given site & period
[ 30522, 2270, 3853, 2275, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 2171, 1010, 1002, 3643, 1007, 1063, 1002, 5216, 1027, 1004, 1002, 2023, 1011, 1028, 2131, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 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...
laravel/framework
src/Illuminate/Cache/CacheManager.php
CacheManager.createApcDriver
protected function createApcDriver(array $config) { $prefix = $this->getPrefix($config); return $this->repository(new ApcStore(new ApcWrapper, $prefix)); }
php
protected function createApcDriver(array $config) { $prefix = $this->getPrefix($config); return $this->repository(new ApcStore(new ApcWrapper, $prefix)); }
[ "protected", "function", "createApcDriver", "(", "array", "$", "config", ")", "{", "$", "prefix", "=", "$", "this", "->", "getPrefix", "(", "$", "config", ")", ";", "return", "$", "this", "->", "repository", "(", "new", "ApcStore", "(", "new", "ApcWrappe...
Create an instance of the APC cache driver. @param array $config @return \Illuminate\Cache\Repository
[ "Create", "an", "instance", "of", "the", "APC", "cache", "driver", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/CacheManager.php#L131-L136
train
Create an instance of the Apc driver
[ 30522, 5123, 3853, 3443, 9331, 19797, 24352, 1006, 9140, 1002, 9530, 8873, 2290, 1007, 1063, 1002, 17576, 1027, 1002, 2023, 1011, 1028, 2131, 28139, 8873, 2595, 1006, 1002, 9530, 8873, 2290, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 22409, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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._formatAddress
protected function _formatAddress($email, $name) { if ($name === '' || $name === null || $name === $email) { return $email; } else { $encodedName = $this->_encodeHeader($name); if ($encodedName === $name && strcspn($name, '()<>[]:;@\\,') != strlen($name)) { $format = '"%s" <%s>'; } else { $format = '%s <%s>'; } return sprintf($format, $encodedName, $email); } }
php
protected function _formatAddress($email, $name) { if ($name === '' || $name === null || $name === $email) { return $email; } else { $encodedName = $this->_encodeHeader($name); if ($encodedName === $name && strcspn($name, '()<>[]:;@\\,') != strlen($name)) { $format = '"%s" <%s>'; } else { $format = '%s <%s>'; } return sprintf($format, $encodedName, $email); } }
[ "protected", "function", "_formatAddress", "(", "$", "email", ",", "$", "name", ")", "{", "if", "(", "$", "name", "===", "''", "||", "$", "name", "===", "null", "||", "$", "name", "===", "$", "email", ")", "{", "return", "$", "email", ";", "}", "...
Formats e-mail address @param string $email @param string $name @return string
[ "Formats", "e", "-", "mail", "address" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L1261-L1274
train
Formats an email address
[ 30522, 5123, 3853, 1035, 4289, 4215, 16200, 4757, 1006, 1002, 10373, 1010, 1002, 2171, 1007, 1063, 2065, 1006, 1002, 2171, 1027, 1027, 1027, 1005, 1005, 1064, 1064, 1002, 2171, 1027, 1027, 1027, 19701, 1064, 1064, 1002, 2171, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form.php
Form.handleFileDelete
protected function handleFileDelete(array $input = []) { if (array_key_exists(Field::FILE_DELETE_FLAG, $input)) { $input[Field::FILE_DELETE_FLAG] = $input['key']; unset($input['key']); } request()->replace($input); return $input; }
php
protected function handleFileDelete(array $input = []) { if (array_key_exists(Field::FILE_DELETE_FLAG, $input)) { $input[Field::FILE_DELETE_FLAG] = $input['key']; unset($input['key']); } request()->replace($input); return $input; }
[ "protected", "function", "handleFileDelete", "(", "array", "$", "input", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "Field", "::", "FILE_DELETE_FLAG", ",", "$", "input", ")", ")", "{", "$", "input", "[", "Field", "::", "FILE_DELETE_FLAG",...
@param array $input @return array
[ "@param", "array", "$input" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L681-L691
train
Handle file delete request
[ 30522, 5123, 3853, 5047, 8873, 3709, 12260, 2618, 1006, 9140, 1002, 7953, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 9140, 1035, 3145, 1035, 6526, 1006, 2492, 1024, 1024, 5371, 1035, 3972, 12870, 1035, 5210, 1010, 1002, 7953, 1007, 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...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.randomizeFilter
public function randomizeFilter($original, $offset = 0) { if (!\is_array($original)) { return $original; } if ($original instanceof \Traversable) { $original = iterator_to_array($original, false); } $sorted = []; $random = array_slice($original, $offset); shuffle($random); $sizeOf = \count($original); for ($x = 0; $x < $sizeOf; $x++) { if ($x < $offset) { $sorted[] = $original[$x]; } else { $sorted[] = array_shift($random); } } return $sorted; }
php
public function randomizeFilter($original, $offset = 0) { if (!\is_array($original)) { return $original; } if ($original instanceof \Traversable) { $original = iterator_to_array($original, false); } $sorted = []; $random = array_slice($original, $offset); shuffle($random); $sizeOf = \count($original); for ($x = 0; $x < $sizeOf; $x++) { if ($x < $offset) { $sorted[] = $original[$x]; } else { $sorted[] = array_shift($random); } } return $sorted; }
[ "public", "function", "randomizeFilter", "(", "$", "original", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "original", ")", ")", "{", "return", "$", "original", ";", "}", "if", "(", "$", "original", "instanceof...
Returns array in a random order. @param array $original @param int $offset Can be used to return only slice of the array. @return array
[ "Returns", "array", "in", "a", "random", "order", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L248-L272
train
Randomize the array of the array
[ 30522, 2270, 3853, 6721, 4697, 8873, 21928, 1006, 1002, 2434, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 2434, 1007, 1007, 1063, 2709, 1002, 2434, 1025, 1065, 2065, 1006, 1002, 2434, 60...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Static.php
Zend_Cache_Backend_Static.remove
public function remove($id) { if (!$this->_verifyPath($id)) { Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path'); } $fileName = basename($id); if ($this->_tagged === null && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) { $this->_tagged = $tagged; } elseif (!$this->_tagged) { return false; } if (isset($this->_tagged[$id])) { $extension = $this->_tagged[$id]['extension']; } else { $extension = $this->_options['file_extension']; } if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); $file = realpath($pathName) . '/' . $fileName . $extension; if (!file_exists($file)) { return false; } return unlink($file); }
php
public function remove($id) { if (!$this->_verifyPath($id)) { Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path'); } $fileName = basename($id); if ($this->_tagged === null && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) { $this->_tagged = $tagged; } elseif (!$this->_tagged) { return false; } if (isset($this->_tagged[$id])) { $extension = $this->_tagged[$id]['extension']; } else { $extension = $this->_options['file_extension']; } if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); $file = realpath($pathName) . '/' . $fileName . $extension; if (!file_exists($file)) { return false; } return unlink($file); }
[ "public", "function", "remove", "(", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "_verifyPath", "(", "$", "id", ")", ")", "{", "Zend_Cache", "::", "throwException", "(", "'Invalid cache id: does not match expected public_dir path'", ")", ";", "}", ...
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/Static.php#L295-L320
train
Remove cache entry
[ 30522, 2270, 3853, 6366, 1006, 1002, 8909, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 20410, 15069, 1006, 1002, 8909, 1007, 1007, 1063, 16729, 2094, 1035, 17053, 1024, 1024, 5466, 10288, 24422, 1006, 1005, 19528, 17053, 8909...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Overlay/Controller.php
Controller.renderSidebar
public function renderSidebar() { $period = Common::getRequestVar('period'); $date = Common::getRequestVar('date'); $currentUrl = Common::getRequestVar('currentUrl'); $segment = Request::getRawSegmentFromRequest(); $currentUrl = Common::unsanitizeInputValue($currentUrl); $segmentSidebar = ''; $normalizedCurrentUrl = PageUrl::excludeQueryParametersFromUrl($currentUrl, $this->idSite); $normalizedCurrentUrl = Common::unsanitizeInputValue($normalizedCurrentUrl); // load the appropriate row of the page urls report using the label filter ArchivingHelper::reloadConfig(); $path = ArchivingHelper::getActionExplodedNames($normalizedCurrentUrl, Action::TYPE_PAGE_URL); $path = array_map('urlencode', $path); $label = implode('>', $path); $params = array( 'idSite' => $this->idSite, 'date' => $date, 'period' => $period, 'label' => $label, 'format' => 'original', 'format_metrics' => 0, ); if (!empty($segment)) { $params['segment'] = $segment; } $dataTable = Request::processRequest('Actions.getPageUrls', $params); $formatter = new Metrics\Formatter\Html(); $data = array(); if ($dataTable->getRowsCount() > 0) { $row = $dataTable->getFirstRow(); $translations = Metrics::getDefaultMetricTranslations(); $showMetrics = array('nb_hits', 'nb_visits', 'nb_users', 'nb_uniq_visitors', 'bounce_rate', 'exit_rate', 'avg_time_on_page'); $segmentSidebar = $row->getMetadata('segment'); if (!empty($segmentSidebar) && !empty($segment)) { $segmentSidebar = $segment . ';' . $segmentSidebar; } foreach ($showMetrics as $metric) { $value = $row->getColumn($metric); if ($value === false) { // skip unique visitors for period != day continue; } if ($metric == 'bounce_rate' || $metric == 'exit_rate' ) { $value = $formatter->getPrettyPercentFromQuotient($value); } else if ($metric == 'avg_time_on_page') { $value = $formatter->getPrettyTimeFromSeconds($value, $displayAsSentence = true); } $data[] = array( 'name' => $translations[$metric], 'value' => $value ); } } // generate page url string foreach ($path as &$part) { $part = preg_replace(';^/;', '', urldecode($part)); } $page = '/' . implode('/', $path); $page = preg_replace(';/index$;', '/', $page); if ($page == '/') { $page = '/index'; } // render template $view = new View('@Overlay/renderSidebar'); $view->data = $data; $view->location = $page; $view->normalizedUrl = $normalizedCurrentUrl; $view->label = $label; $view->idSite = $this->idSite; $view->period = $period; $view->date = $date; $view->segment = $segmentSidebar; $view->segmentDescription = $this->segmentFormatter->getHumanReadable($segment, $this->idSite); $this->outputCORSHeaders(); return $view->render(); }
php
public function renderSidebar() { $period = Common::getRequestVar('period'); $date = Common::getRequestVar('date'); $currentUrl = Common::getRequestVar('currentUrl'); $segment = Request::getRawSegmentFromRequest(); $currentUrl = Common::unsanitizeInputValue($currentUrl); $segmentSidebar = ''; $normalizedCurrentUrl = PageUrl::excludeQueryParametersFromUrl($currentUrl, $this->idSite); $normalizedCurrentUrl = Common::unsanitizeInputValue($normalizedCurrentUrl); // load the appropriate row of the page urls report using the label filter ArchivingHelper::reloadConfig(); $path = ArchivingHelper::getActionExplodedNames($normalizedCurrentUrl, Action::TYPE_PAGE_URL); $path = array_map('urlencode', $path); $label = implode('>', $path); $params = array( 'idSite' => $this->idSite, 'date' => $date, 'period' => $period, 'label' => $label, 'format' => 'original', 'format_metrics' => 0, ); if (!empty($segment)) { $params['segment'] = $segment; } $dataTable = Request::processRequest('Actions.getPageUrls', $params); $formatter = new Metrics\Formatter\Html(); $data = array(); if ($dataTable->getRowsCount() > 0) { $row = $dataTable->getFirstRow(); $translations = Metrics::getDefaultMetricTranslations(); $showMetrics = array('nb_hits', 'nb_visits', 'nb_users', 'nb_uniq_visitors', 'bounce_rate', 'exit_rate', 'avg_time_on_page'); $segmentSidebar = $row->getMetadata('segment'); if (!empty($segmentSidebar) && !empty($segment)) { $segmentSidebar = $segment . ';' . $segmentSidebar; } foreach ($showMetrics as $metric) { $value = $row->getColumn($metric); if ($value === false) { // skip unique visitors for period != day continue; } if ($metric == 'bounce_rate' || $metric == 'exit_rate' ) { $value = $formatter->getPrettyPercentFromQuotient($value); } else if ($metric == 'avg_time_on_page') { $value = $formatter->getPrettyTimeFromSeconds($value, $displayAsSentence = true); } $data[] = array( 'name' => $translations[$metric], 'value' => $value ); } } // generate page url string foreach ($path as &$part) { $part = preg_replace(';^/;', '', urldecode($part)); } $page = '/' . implode('/', $path); $page = preg_replace(';/index$;', '/', $page); if ($page == '/') { $page = '/index'; } // render template $view = new View('@Overlay/renderSidebar'); $view->data = $data; $view->location = $page; $view->normalizedUrl = $normalizedCurrentUrl; $view->label = $label; $view->idSite = $this->idSite; $view->period = $period; $view->date = $date; $view->segment = $segmentSidebar; $view->segmentDescription = $this->segmentFormatter->getHumanReadable($segment, $this->idSite); $this->outputCORSHeaders(); return $view->render(); }
[ "public", "function", "renderSidebar", "(", ")", "{", "$", "period", "=", "Common", "::", "getRequestVar", "(", "'period'", ")", ";", "$", "date", "=", "Common", "::", "getRequestVar", "(", "'date'", ")", ";", "$", "currentUrl", "=", "Common", "::", "get...
Render the area left of the iframe
[ "Render", "the", "area", "left", "of", "the", "iframe" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Overlay/Controller.php#L64-L158
train
Render the sidebar of the page
[ 30522, 2270, 3853, 17552, 7363, 8237, 1006, 1007, 1063, 1002, 2558, 1027, 2691, 1024, 1024, 2131, 2890, 15500, 10755, 1006, 1005, 2558, 1005, 1007, 1025, 1002, 3058, 1027, 2691, 1024, 1024, 2131, 2890, 15500, 10755, 1006, 1005, 3058, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Renderer/Php.php
Php.originalRender
public function originalRender() { Piwik::checkObjectTypeIs($this->table, array('Simple', 'DataTable')); if ($this->table instanceof Simple) { $array = $this->renderSimpleTable($this->table); } elseif ($this->table instanceof DataTable) { $array = $this->renderTable($this->table); } if ($this->serialize) { $array = serialize($array); } return $array; }
php
public function originalRender() { Piwik::checkObjectTypeIs($this->table, array('Simple', 'DataTable')); if ($this->table instanceof Simple) { $array = $this->renderSimpleTable($this->table); } elseif ($this->table instanceof DataTable) { $array = $this->renderTable($this->table); } if ($this->serialize) { $array = serialize($array); } return $array; }
[ "public", "function", "originalRender", "(", ")", "{", "Piwik", "::", "checkObjectTypeIs", "(", "$", "this", "->", "table", ",", "array", "(", "'Simple'", ",", "'DataTable'", ")", ")", ";", "if", "(", "$", "this", "->", "table", "instanceof", "Simple", "...
Converts the current data table to an array @return array @throws Exception
[ "Converts", "the", "current", "data", "table", "to", "an", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Php.php#L172-L186
train
Returns the original array of the table
[ 30522, 2270, 3853, 2434, 7389, 4063, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 16429, 20614, 13874, 2483, 1006, 1002, 2023, 1011, 1028, 2795, 1010, 9140, 1006, 1005, 3722, 1005, 1010, 1005, 2951, 10880, 1005, 1007, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Queue/Worker.php
Worker.kill
public function kill($status = 0) { $this->events->dispatch(new Events\WorkerStopping($status)); if (extension_loaded('posix')) { posix_kill(getmypid(), SIGKILL); } exit($status); }
php
public function kill($status = 0) { $this->events->dispatch(new Events\WorkerStopping($status)); if (extension_loaded('posix')) { posix_kill(getmypid(), SIGKILL); } exit($status); }
[ "public", "function", "kill", "(", "$", "status", "=", "0", ")", "{", "$", "this", "->", "events", "->", "dispatch", "(", "new", "Events", "\\", "WorkerStopping", "(", "$", "status", ")", ")", ";", "if", "(", "extension_loaded", "(", "'posix'", ")", ...
Kill the process. @param int $status @return void
[ "Kill", "the", "process", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Worker.php#L574-L583
train
Kills the current process
[ 30522, 2270, 3853, 3102, 1006, 1002, 3570, 1027, 1014, 1007, 1063, 1002, 2023, 1011, 1028, 2824, 1011, 1028, 18365, 1006, 2047, 2824, 1032, 3667, 14399, 4691, 1006, 1002, 3570, 1007, 1007, 1025, 2065, 1006, 5331, 1035, 8209, 1006, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/MiddlewareNameResolver.php
MiddlewareNameResolver.resolve
public static function resolve($name, $map, $middlewareGroups) { // When the middleware is simply a Closure, we will return this Closure instance // directly so that Closures can be registered as middleware inline, which is // convenient on occasions when the developers are experimenting with them. if ($name instanceof Closure) { return $name; } if (isset($map[$name]) && $map[$name] instanceof Closure) { return $map[$name]; } // If the middleware is the name of a middleware group, we will return the array // of middlewares that belong to the group. This allows developers to group a // set of middleware under single keys that can be conveniently referenced. if (isset($middlewareGroups[$name])) { return static::parseMiddlewareGroup($name, $map, $middlewareGroups); } // Finally, when the middleware is simply a string mapped to a class name the // middleware name will get parsed into the full class name and parameters // which may be run using the Pipeline which accepts this string format. [$name, $parameters] = array_pad(explode(':', $name, 2), 2, null); return ($map[$name] ?? $name).(! is_null($parameters) ? ':'.$parameters : ''); }
php
public static function resolve($name, $map, $middlewareGroups) { // When the middleware is simply a Closure, we will return this Closure instance // directly so that Closures can be registered as middleware inline, which is // convenient on occasions when the developers are experimenting with them. if ($name instanceof Closure) { return $name; } if (isset($map[$name]) && $map[$name] instanceof Closure) { return $map[$name]; } // If the middleware is the name of a middleware group, we will return the array // of middlewares that belong to the group. This allows developers to group a // set of middleware under single keys that can be conveniently referenced. if (isset($middlewareGroups[$name])) { return static::parseMiddlewareGroup($name, $map, $middlewareGroups); } // Finally, when the middleware is simply a string mapped to a class name the // middleware name will get parsed into the full class name and parameters // which may be run using the Pipeline which accepts this string format. [$name, $parameters] = array_pad(explode(':', $name, 2), 2, null); return ($map[$name] ?? $name).(! is_null($parameters) ? ':'.$parameters : ''); }
[ "public", "static", "function", "resolve", "(", "$", "name", ",", "$", "map", ",", "$", "middlewareGroups", ")", "{", "// When the middleware is simply a Closure, we will return this Closure instance", "// directly so that Closures can be registered as middleware inline, which is", ...
Resolve the middleware name to a class name(s) preserving passed parameters. @param string $name @param array $map @param array $middlewareGroups @return \Closure|string|array
[ "Resolve", "the", "middleware", "name", "to", "a", "class", "name", "(", "s", ")", "preserving", "passed", "parameters", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/MiddlewareNameResolver.php#L17-L43
train
Resolves the middleware name and returns the corresponding Closure instance.
[ 30522, 2270, 10763, 3853, 10663, 1006, 1002, 2171, 1010, 1002, 4949, 1010, 1002, 2690, 8059, 17058, 2015, 1007, 1063, 1013, 1013, 2043, 1996, 2690, 8059, 2003, 3432, 1037, 8503, 1010, 2057, 2097, 2709, 2023, 8503, 6013, 1013, 1013, 3495, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/formwidgets/TagList.php
TagList.getFieldOptions
public function getFieldOptions() { $options = $this->formField->options(); if (!$options && $this->mode === static::MODE_RELATION) { $options = $this->getRelationModel()->lists($this->nameFrom); } return $options; }
php
public function getFieldOptions() { $options = $this->formField->options(); if (!$options && $this->mode === static::MODE_RELATION) { $options = $this->getRelationModel()->lists($this->nameFrom); } return $options; }
[ "public", "function", "getFieldOptions", "(", ")", "{", "$", "options", "=", "$", "this", "->", "formField", "->", "options", "(", ")", ";", "if", "(", "!", "$", "options", "&&", "$", "this", "->", "mode", "===", "static", "::", "MODE_RELATION", ")", ...
Returns defined field options, or from the relation if available. @return array
[ "Returns", "defined", "field", "options", "or", "from", "the", "relation", "if", "available", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/TagList.php#L166-L175
train
Get Field Options
[ 30522, 2270, 3853, 2131, 3790, 7361, 9285, 1006, 1007, 1063, 1002, 7047, 1027, 1002, 2023, 1011, 1028, 2433, 3790, 1011, 1028, 7047, 1006, 1007, 1025, 2065, 1006, 999, 1002, 7047, 1004, 1004, 1002, 2023, 1011, 1028, 5549, 1027, 1027, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/thrift
lib/php/lib/Transport/TSocket.php
TSocket.setSendTimeout
public function setSendTimeout($timeout) { $this->sendTimeoutSec_ = floor($timeout / 1000); $this->sendTimeoutUsec_ = ($timeout - ($this->sendTimeoutSec_ * 1000)) * 1000; }
php
public function setSendTimeout($timeout) { $this->sendTimeoutSec_ = floor($timeout / 1000); $this->sendTimeoutUsec_ = ($timeout - ($this->sendTimeoutSec_ * 1000)) * 1000; }
[ "public", "function", "setSendTimeout", "(", "$", "timeout", ")", "{", "$", "this", "->", "sendTimeoutSec_", "=", "floor", "(", "$", "timeout", "/", "1000", ")", ";", "$", "this", "->", "sendTimeoutUsec_", "=", "(", "$", "timeout", "-", "(", "$", "this...
Sets the send timeout. @param int $timeout Timeout in milliseconds.
[ "Sets", "the", "send", "timeout", "." ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TSocket.php#L149-L154
train
Set the send timeout in seconds
[ 30522, 2270, 3853, 4520, 10497, 7292, 5833, 1006, 1002, 2051, 5833, 1007, 1063, 1002, 2023, 1011, 1028, 4604, 7292, 12166, 8586, 1035, 1027, 2723, 1006, 1002, 2051, 5833, 1013, 6694, 1007, 1025, 1002, 2023, 1011, 1028, 4604, 7292, 5833, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Profiler.php
Profiler.displayDbTrackerProfile
public static function displayDbTrackerProfile($db = null) { if (is_null($db)) { $db = Tracker::getDatabase(); } $tableName = Common::prefixTable('log_profiling'); $all = $db->fetchAll('SELECT * FROM ' . $tableName); if ($all === false) { return; } uasort($all, 'self::maxSumMsFirst'); $infoIndexedByQuery = array(); foreach ($all as $infoQuery) { $query = $infoQuery['query']; $count = $infoQuery['count']; $sum_time_ms = $infoQuery['sum_time_ms']; $infoIndexedByQuery[$query] = array('count' => $count, 'sumTimeMs' => $sum_time_ms); } self::getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery); }
php
public static function displayDbTrackerProfile($db = null) { if (is_null($db)) { $db = Tracker::getDatabase(); } $tableName = Common::prefixTable('log_profiling'); $all = $db->fetchAll('SELECT * FROM ' . $tableName); if ($all === false) { return; } uasort($all, 'self::maxSumMsFirst'); $infoIndexedByQuery = array(); foreach ($all as $infoQuery) { $query = $infoQuery['query']; $count = $infoQuery['count']; $sum_time_ms = $infoQuery['sum_time_ms']; $infoIndexedByQuery[$query] = array('count' => $count, 'sumTimeMs' => $sum_time_ms); } self::getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery); }
[ "public", "static", "function", "displayDbTrackerProfile", "(", "$", "db", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "db", ")", ")", "{", "$", "db", "=", "Tracker", "::", "getDatabase", "(", ")", ";", "}", "$", "tableName", "=", "Common"...
Print profiling report for the tracker @param \Piwik\Db $db Tracker database object (or null)
[ "Print", "profiling", "report", "for", "the", "tracker" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Profiler.php#L116-L137
train
Display the DB tracker profile
[ 30522, 2270, 10763, 3853, 4653, 18939, 6494, 9102, 21572, 8873, 2571, 1006, 1002, 16962, 1027, 19701, 1007, 1063, 2065, 30524, 1027, 2691, 1024, 1024, 17576, 10880, 1006, 1005, 8833, 1035, 11268, 16281, 1005, 1007, 1025, 1002, 2035, 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/Menu/MenuAbstract.php
MenuAbstract.addItem
public function addItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false, $icon = false, $onclick = false) { // make sure the idSite value used is numeric (hack-y fix for #3426) if (isset($url['idSite']) && !is_numeric($url['idSite'])) { $idSites = API::getInstance()->getSitesIdWithAtLeastViewAccess(); $url['idSite'] = reset($idSites); } $this->menuEntries[] = array( $menuName, $subMenuName, $url, $order, $tooltip, $icon, $onclick ); }
php
public function addItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false, $icon = false, $onclick = false) { // make sure the idSite value used is numeric (hack-y fix for #3426) if (isset($url['idSite']) && !is_numeric($url['idSite'])) { $idSites = API::getInstance()->getSitesIdWithAtLeastViewAccess(); $url['idSite'] = reset($idSites); } $this->menuEntries[] = array( $menuName, $subMenuName, $url, $order, $tooltip, $icon, $onclick ); }
[ "public", "function", "addItem", "(", "$", "menuName", ",", "$", "subMenuName", ",", "$", "url", ",", "$", "order", "=", "50", ",", "$", "tooltip", "=", "false", ",", "$", "icon", "=", "false", ",", "$", "onclick", "=", "false", ")", "{", "// make ...
Adds a new entry to the menu. @param string $menuName The menu's category name. Can be a translation token. @param string $subMenuName The menu item's name. Can be a translation token. @param string|array $url The URL the admin menu entry should link to, or an array of query parameters that can be used to build the URL. @param int $order The order hint. @param bool|string $tooltip An optional tooltip to display or false to display the tooltip. @param bool|string $icon An icon classname, such as "icon-add". Only supported by admin menu @param bool|string $onclick Will execute the on click handler instead of executing the link. Only supported by admin menu. @since 2.7.0 @api
[ "Adds", "a", "new", "entry", "to", "the", "menu", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAbstract.php#L109-L126
train
Add an entry to the menu
[ 30522, 2270, 3853, 5587, 4221, 2213, 1006, 1002, 12183, 18442, 1010, 1002, 4942, 3549, 9521, 4168, 1010, 1002, 24471, 2140, 1010, 1002, 2344, 1027, 2753, 1010, 1002, 6994, 25101, 1027, 6270, 1010, 1002, 12696, 1027, 6270, 1010, 1002, 2006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
domnikl/DesignPatternsPHP
More/ServiceLocator/ServiceLocator.php
ServiceLocator.get
public function get(string $class) { if (isset($this->instantiated[$class]) && $this->shared[$class]) { return $this->instantiated[$class]; } $args = $this->services[$class]; switch (count($args)) { case 0: $object = new $class(); break; case 1: $object = new $class($args[0]); break; case 2: $object = new $class($args[0], $args[1]); break; case 3: $object = new $class($args[0], $args[1], $args[2]); break; default: throw new \OutOfRangeException('Too many arguments given'); } if ($this->shared[$class]) { $this->instantiated[$class] = $object; } return $object; }
php
public function get(string $class) { if (isset($this->instantiated[$class]) && $this->shared[$class]) { return $this->instantiated[$class]; } $args = $this->services[$class]; switch (count($args)) { case 0: $object = new $class(); break; case 1: $object = new $class($args[0]); break; case 2: $object = new $class($args[0], $args[1]); break; case 3: $object = new $class($args[0], $args[1], $args[2]); break; default: throw new \OutOfRangeException('Too many arguments given'); } if ($this->shared[$class]) { $this->instantiated[$class] = $object; } return $object; }
[ "public", "function", "get", "(", "string", "$", "class", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "instantiated", "[", "$", "class", "]", ")", "&&", "$", "this", "->", "shared", "[", "$", "class", "]", ")", "{", "return", "$", "this...
@param string $class @return object
[ "@param", "string", "$class" ]
5f5649b57ea94471e20b54eb439c6368dea07886
https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/More/ServiceLocator/ServiceLocator.php#L59-L89
train
Get an instance of the given class
[ 30522, 2270, 3853, 2131, 1006, 5164, 1002, 2465, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 7107, 15070, 1031, 1002, 2465, 1033, 1007, 1004, 1004, 1002, 2023, 1011, 1028, 4207, 1031, 1002, 2465, 1033, 1007, 1063, 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...
z-song/laravel-admin
src/Grid.php
Grid.actions
public function actions($actions) { if ($actions instanceof Closure) { $this->actionsCallback = $actions; } if (is_string($actions) && is_subclass_of($actions, Displayers\Actions::class)) { $this->actionsClass = $actions; } return $this; }
php
public function actions($actions) { if ($actions instanceof Closure) { $this->actionsCallback = $actions; } if (is_string($actions) && is_subclass_of($actions, Displayers\Actions::class)) { $this->actionsClass = $actions; } return $this; }
[ "public", "function", "actions", "(", "$", "actions", ")", "{", "if", "(", "$", "actions", "instanceof", "Closure", ")", "{", "$", "this", "->", "actionsCallback", "=", "$", "actions", ";", "}", "if", "(", "is_string", "(", "$", "actions", ")", "&&", ...
Set grid action callback. @param Closure|string $actions @return $this
[ "Set", "grid", "action", "callback", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L509-L520
train
Set the actions callback
[ 30522, 2270, 3853, 4506, 1006, 1002, 4506, 1007, 1063, 2065, 1006, 1002, 4506, 6013, 11253, 8503, 1007, 1063, 1002, 2023, 1011, 1028, 4506, 9289, 20850, 8684, 1027, 1002, 4506, 1025, 1065, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 4506, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php
InteractsWithPivotTable.addTimestampsToAttachment
protected function addTimestampsToAttachment(array $record, $exists = false) { $fresh = $this->parent->freshTimestamp(); if ($this->using) { $pivotModel = new $this->using; $fresh = $fresh->format($pivotModel->getDateFormat()); } if (! $exists && $this->hasPivotColumn($this->createdAt())) { $record[$this->createdAt()] = $fresh; } if ($this->hasPivotColumn($this->updatedAt())) { $record[$this->updatedAt()] = $fresh; } return $record; }
php
protected function addTimestampsToAttachment(array $record, $exists = false) { $fresh = $this->parent->freshTimestamp(); if ($this->using) { $pivotModel = new $this->using; $fresh = $fresh->format($pivotModel->getDateFormat()); } if (! $exists && $this->hasPivotColumn($this->createdAt())) { $record[$this->createdAt()] = $fresh; } if ($this->hasPivotColumn($this->updatedAt())) { $record[$this->updatedAt()] = $fresh; } return $record; }
[ "protected", "function", "addTimestampsToAttachment", "(", "array", "$", "record", ",", "$", "exists", "=", "false", ")", "{", "$", "fresh", "=", "$", "this", "->", "parent", "->", "freshTimestamp", "(", ")", ";", "if", "(", "$", "this", "->", "using", ...
Set the creation and update timestamps on an attach record. @param array $record @param bool $exists @return array
[ "Set", "the", "creation", "and", "update", "timestamps", "on", "an", "attach", "record", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php#L365-L384
train
Add timestamps to attachment array
[ 30522, 5123, 3853, 5587, 7292, 9153, 25370, 3406, 19321, 6776, 3672, 1006, 9140, 1002, 2501, 1010, 1002, 6526, 1027, 6270, 1007, 1063, 1002, 4840, 1027, 1002, 2023, 1011, 1028, 6687, 1011, 1028, 4840, 7292, 9153, 8737, 1006, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
TraceableEventDispatcher.afterDispatch
protected function afterDispatch(string $eventName, $event) { switch ($eventName) { case KernelEvents::CONTROLLER_ARGUMENTS: $this->stopwatch->start('controller', 'section'); break; case KernelEvents::RESPONSE: $token = $event->getResponse()->headers->get('X-Debug-Token'); $this->stopwatch->stopSection($token); break; case KernelEvents::TERMINATE: // In the special case described in the `preDispatch` method above, the `$token` section // does not exist, then closing it throws an exception which must be caught. $token = $event->getResponse()->headers->get('X-Debug-Token'); try { $this->stopwatch->stopSection($token); } catch (\LogicException $e) { } break; } }
php
protected function afterDispatch(string $eventName, $event) { switch ($eventName) { case KernelEvents::CONTROLLER_ARGUMENTS: $this->stopwatch->start('controller', 'section'); break; case KernelEvents::RESPONSE: $token = $event->getResponse()->headers->get('X-Debug-Token'); $this->stopwatch->stopSection($token); break; case KernelEvents::TERMINATE: // In the special case described in the `preDispatch` method above, the `$token` section // does not exist, then closing it throws an exception which must be caught. $token = $event->getResponse()->headers->get('X-Debug-Token'); try { $this->stopwatch->stopSection($token); } catch (\LogicException $e) { } break; } }
[ "protected", "function", "afterDispatch", "(", "string", "$", "eventName", ",", "$", "event", ")", "{", "switch", "(", "$", "eventName", ")", "{", "case", "KernelEvents", "::", "CONTROLLER_ARGUMENTS", ":", "$", "this", "->", "stopwatch", "->", "start", "(", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php#L60-L80
train
After dispatch event
[ 30522, 5123, 3853, 2044, 10521, 4502, 10649, 1006, 5164, 1002, 2724, 18442, 1010, 1002, 2724, 1007, 1063, 6942, 1006, 1002, 2724, 18442, 1007, 1063, 2553, 16293, 18697, 7666, 1024, 1024, 11486, 1035, 9918, 1024, 1002, 2023, 1011, 1028, 2644...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/EmbeddedForm.php
EmbeddedForm.pushField
public function pushField(Field $field) { $field = $this->formatField($field); $this->fields->push($field); return $this; }
php
public function pushField(Field $field) { $field = $this->formatField($field); $this->fields->push($field); return $this; }
[ "public", "function", "pushField", "(", "Field", "$", "field", ")", "{", "$", "field", "=", "$", "this", "->", "formatField", "(", "$", "field", ")", ";", "$", "this", "->", "fields", "->", "push", "(", "$", "field", ")", ";", "return", "$", "this"...
Add a field to form. @param Field $field @return $this
[ "Add", "a", "field", "to", "form", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/EmbeddedForm.php#L249-L256
train
Pushes a new field to the end of the fields stack
[ 30522, 2270, 3853, 5245, 3790, 1006, 2492, 1002, 2492, 1007, 1063, 1002, 2492, 1027, 1002, 2023, 1011, 1028, 4289, 3790, 1006, 1002, 2492, 1007, 1025, 1002, 2023, 1011, 1028, 4249, 1011, 1028, 5245, 1006, 1002, 2492, 1007, 1025, 2709, 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...
z-song/laravel-admin
src/Form/Builder.php
Builder.open
public function open($options = []) { $attributes = []; if ($this->isMode(self::MODE_EDIT)) { $this->addHiddenField((new Hidden('_method'))->value('PUT')); } $this->addRedirectUrlField(); $attributes['action'] = $this->getAction(); $attributes['method'] = Arr::get($options, 'method', 'post'); $attributes['accept-charset'] = 'UTF-8'; $attributes['class'] = Arr::get($options, 'class'); if ($this->hasFile()) { $attributes['enctype'] = 'multipart/form-data'; } $html = []; foreach ($attributes as $name => $value) { $html[] = "$name=\"$value\""; } return '<form '.implode(' ', $html).' pjax-container>'; }
php
public function open($options = []) { $attributes = []; if ($this->isMode(self::MODE_EDIT)) { $this->addHiddenField((new Hidden('_method'))->value('PUT')); } $this->addRedirectUrlField(); $attributes['action'] = $this->getAction(); $attributes['method'] = Arr::get($options, 'method', 'post'); $attributes['accept-charset'] = 'UTF-8'; $attributes['class'] = Arr::get($options, 'class'); if ($this->hasFile()) { $attributes['enctype'] = 'multipart/form-data'; } $html = []; foreach ($attributes as $name => $value) { $html[] = "$name=\"$value\""; } return '<form '.implode(' ', $html).' pjax-container>'; }
[ "public", "function", "open", "(", "$", "options", "=", "[", "]", ")", "{", "$", "attributes", "=", "[", "]", ";", "if", "(", "$", "this", "->", "isMode", "(", "self", "::", "MODE_EDIT", ")", ")", "{", "$", "this", "->", "addHiddenField", "(", "(...
Open up a new HTML form. @param array $options @return string
[ "Open", "up", "a", "new", "HTML", "form", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L476-L502
train
Open the form
[ 30522, 2270, 3853, 2330, 1006, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 12332, 1027, 1031, 1033, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 5302, 3207, 1006, 2969, 1024, 1024, 5549, 1035, 10086, 1007, 1007, 1063, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/GenericMetadata.php
GenericMetadata.addConstraint
public function addConstraint(Constraint $constraint) { if ($constraint instanceof Traverse) { throw new ConstraintDefinitionException(sprintf('The constraint "%s" can only be put on classes. Please use "Symfony\Component\Validator\Constraints\Valid" instead.', \get_class($constraint))); } if ($constraint instanceof Valid && null === $constraint->groups) { $this->cascadingStrategy = CascadingStrategy::CASCADE; if ($constraint->traverse) { $this->traversalStrategy = TraversalStrategy::IMPLICIT; } else { $this->traversalStrategy = TraversalStrategy::NONE; } return $this; } $this->constraints[] = $constraint; foreach ($constraint->groups as $group) { $this->constraintsByGroup[$group][] = $constraint; } return $this; }
php
public function addConstraint(Constraint $constraint) { if ($constraint instanceof Traverse) { throw new ConstraintDefinitionException(sprintf('The constraint "%s" can only be put on classes. Please use "Symfony\Component\Validator\Constraints\Valid" instead.', \get_class($constraint))); } if ($constraint instanceof Valid && null === $constraint->groups) { $this->cascadingStrategy = CascadingStrategy::CASCADE; if ($constraint->traverse) { $this->traversalStrategy = TraversalStrategy::IMPLICIT; } else { $this->traversalStrategy = TraversalStrategy::NONE; } return $this; } $this->constraints[] = $constraint; foreach ($constraint->groups as $group) { $this->constraintsByGroup[$group][] = $constraint; } return $this; }
[ "public", "function", "addConstraint", "(", "Constraint", "$", "constraint", ")", "{", "if", "(", "$", "constraint", "instanceof", "Traverse", ")", "{", "throw", "new", "ConstraintDefinitionException", "(", "sprintf", "(", "'The constraint \"%s\" can only be put on clas...
Adds a constraint. If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following: - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled - {@link TraversalStrategy::NONE} if $traverse is disabled @return $this @throws ConstraintDefinitionException When trying to add the {@link Traverse} constraint
[ "Adds", "a", "constraint", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/GenericMetadata.php#L122-L147
train
Adds a constraint to the list of constraints
[ 30522, 2270, 3853, 5587, 8663, 20528, 18447, 1006, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 1002, 27142, 6013, 11253, 20811, 1007, 1063, 5466, 2047, 27142, 3207, 16294, 22753, 10288, 24422, 1006, 9043, 2546, 1006, 1005, 1996, 27142, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php
HttpCache.forward
protected function forward(Request $request, $raw = false, Response $entry = null) { $this->getKernel()->boot(); $this->getKernel()->getContainer()->set('cache', $this); return parent::forward($request, $raw, $entry); }
php
protected function forward(Request $request, $raw = false, Response $entry = null) { $this->getKernel()->boot(); $this->getKernel()->getContainer()->set('cache', $this); return parent::forward($request, $raw, $entry); }
[ "protected", "function", "forward", "(", "Request", "$", "request", ",", "$", "raw", "=", "false", ",", "Response", "$", "entry", "=", "null", ")", "{", "$", "this", "->", "getKernel", "(", ")", "->", "boot", "(", ")", ";", "$", "this", "->", "getK...
Forwards the Request to the backend and returns the Response. @param Request $request A Request instance @param bool $raw Whether to catch exceptions or not @param Response $entry A Response instance (the stale entry if present, null otherwise) @return Response A Response instance
[ "Forwards", "the", "Request", "to", "the", "backend", "and", "returns", "the", "Response", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php#L52-L58
train
Forward to the cache
[ 30522, 5123, 3853, 2830, 1006, 5227, 1002, 5227, 1010, 1002, 6315, 1027, 6270, 1010, 3433, 1002, 4443, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2131, 5484, 11877, 1006, 1007, 1011, 1028, 9573, 1006, 1007, 1025, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Updater.php
Updater.getComponentsWithUpdateFile
public function getComponentsWithUpdateFile($componentsToCheck) { $this->componentsWithNewVersion = $this->getComponentsWithNewVersion($componentsToCheck); $this->componentsWithUpdateFile = $this->loadComponentsWithUpdateFile(); return $this->componentsWithUpdateFile; }
php
public function getComponentsWithUpdateFile($componentsToCheck) { $this->componentsWithNewVersion = $this->getComponentsWithNewVersion($componentsToCheck); $this->componentsWithUpdateFile = $this->loadComponentsWithUpdateFile(); return $this->componentsWithUpdateFile; }
[ "public", "function", "getComponentsWithUpdateFile", "(", "$", "componentsToCheck", ")", "{", "$", "this", "->", "componentsWithNewVersion", "=", "$", "this", "->", "getComponentsWithNewVersion", "(", "$", "componentsToCheck", ")", ";", "$", "this", "->", "component...
Returns a list of components (core | plugin) that need to run through the upgrade process. @param string[] $componentsToCheck An array mapping component names to the latest locally available version. If the version is later than the currently installed version, the component must be upgraded. Example: `array('core' => '2.11.0')` @return array( componentName => array( file1 => version1, [...]), [...])
[ "Returns", "a", "list", "of", "components", "(", "core", "|", "plugin", ")", "that", "need", "to", "run", "through", "the", "upgrade", "process", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater.php#L199-L204
train
Get Component With Update File
[ 30522, 2270, 3853, 2131, 9006, 29513, 7666, 24415, 6279, 13701, 8873, 2571, 1006, 1002, 6177, 3406, 5403, 3600, 1007, 1063, 1002, 2023, 1011, 1028, 6177, 24415, 2638, 2860, 27774, 1027, 1002, 2023, 1011, 1028, 2131, 9006, 29513, 7666, 24415...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Data/Blueprint.php
Blueprint.filter
public function filter(array $data, bool $missingValuesAsNull = false, bool $keepEmptyValues = false) { $this->initInternals(); return $this->blueprintSchema->filter($data, $missingValuesAsNull, $keepEmptyValues); }
php
public function filter(array $data, bool $missingValuesAsNull = false, bool $keepEmptyValues = false) { $this->initInternals(); return $this->blueprintSchema->filter($data, $missingValuesAsNull, $keepEmptyValues); }
[ "public", "function", "filter", "(", "array", "$", "data", ",", "bool", "$", "missingValuesAsNull", "=", "false", ",", "bool", "$", "keepEmptyValues", "=", "false", ")", "{", "$", "this", "->", "initInternals", "(", ")", ";", "return", "$", "this", "->",...
Filter data by using blueprints. @param array $data @param bool $missingValuesAsNull @param bool $keepEmptyValues @return array
[ "Filter", "data", "by", "using", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprint.php#L192-L197
train
Filter the data from the blueprints
[ 30522, 2270, 3853, 11307, 1006, 9140, 1002, 2951, 1010, 22017, 2140, 1002, 4394, 10175, 15808, 3022, 11231, 3363, 1027, 6270, 1010, 22017, 2140, 1002, 2562, 6633, 13876, 2100, 10175, 15808, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataArray.php
DataArray.isRowActions
public static function isRowActions($row) { return (count($row) == count(static::makeEmptyActionRow())) && isset($row[Metrics::INDEX_NB_ACTIONS]); }
php
public static function isRowActions($row) { return (count($row) == count(static::makeEmptyActionRow())) && isset($row[Metrics::INDEX_NB_ACTIONS]); }
[ "public", "static", "function", "isRowActions", "(", "$", "row", ")", "{", "return", "(", "count", "(", "$", "row", ")", "==", "count", "(", "static", "::", "makeEmptyActionRow", "(", ")", ")", ")", "&&", "isset", "(", "$", "row", "[", "Metrics", "::...
Returns true if the row looks like an Action metrics row @param $row @return bool
[ "Returns", "true", "if", "the", "row", "looks", "like", "an", "Action", "metrics", "row" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataArray.php#L417-L420
train
Is row actions?
[ 30522, 2270, 10763, 3853, 2003, 10524, 18908, 8496, 1006, 1002, 5216, 1007, 1063, 2709, 1006, 4175, 1006, 1002, 5216, 1007, 1027, 1027, 4175, 1006, 10763, 1024, 1024, 2191, 6633, 13876, 3148, 7542, 10524, 1006, 1007, 1007, 1007, 1004, 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...
laravel/framework
src/Illuminate/Validation/Concerns/FormatsMessages.php
FormatsMessages.getAttributeType
protected function getAttributeType($attribute) { // We assume that the attributes present in the file array are files so that // means that if the attribute does not have a numeric rule and the files // list doesn't have it we'll just consider it a string by elimination. if ($this->hasRule($attribute, $this->numericRules)) { return 'numeric'; } elseif ($this->hasRule($attribute, ['Array'])) { return 'array'; } elseif ($this->getValue($attribute) instanceof UploadedFile) { return 'file'; } return 'string'; }
php
protected function getAttributeType($attribute) { // We assume that the attributes present in the file array are files so that // means that if the attribute does not have a numeric rule and the files // list doesn't have it we'll just consider it a string by elimination. if ($this->hasRule($attribute, $this->numericRules)) { return 'numeric'; } elseif ($this->hasRule($attribute, ['Array'])) { return 'array'; } elseif ($this->getValue($attribute) instanceof UploadedFile) { return 'file'; } return 'string'; }
[ "protected", "function", "getAttributeType", "(", "$", "attribute", ")", "{", "// We assume that the attributes present in the file array are files so that", "// means that if the attribute does not have a numeric rule and the files", "// list doesn't have it we'll just consider it a string by e...
Get the data type of the given attribute. @param string $attribute @return string
[ "Get", "the", "data", "type", "of", "the", "given", "attribute", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/FormatsMessages.php#L178-L192
train
Returns the type of an attribute
[ 30522, 5123, 3853, 2131, 19321, 3089, 8569, 22513, 18863, 1006, 1002, 17961, 1007, 1063, 1013, 1013, 2057, 7868, 2008, 1996, 12332, 2556, 1999, 1996, 5371, 9140, 2024, 6764, 2061, 2008, 1013, 1013, 2965, 2008, 2065, 1996, 17961, 2515, 2025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.evaluateTwigFunc
public function evaluateTwigFunc($context, $twig ) { $loader = new \Twig_Loader_Filesystem('.'); $env = new \Twig_Environment($loader); $template = $env->createTemplate($twig); return $template->render($context); }
php
public function evaluateTwigFunc($context, $twig ) { $loader = new \Twig_Loader_Filesystem('.'); $env = new \Twig_Environment($loader); $template = $env->createTemplate($twig); return $template->render($context); }
[ "public", "function", "evaluateTwigFunc", "(", "$", "context", ",", "$", "twig", ")", "{", "$", "loader", "=", "new", "\\", "Twig_Loader_Filesystem", "(", "'.'", ")", ";", "$", "env", "=", "new", "\\", "Twig_Environment", "(", "$", "loader", ")", ";", ...
This function will evaluate Twig $twig through the $environment, and return its results. @param array $context @param string $twig @return mixed
[ "This", "function", "will", "evaluate", "Twig", "$twig", "through", "the", "$environment", "and", "return", "its", "results", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L829-L837
train
Evaluate Twig Func
[ 30522, 2270, 3853, 16157, 2102, 16279, 11263, 12273, 1006, 1002, 6123, 1010, 1002, 1056, 16279, 1007, 1063, 1002, 7170, 2121, 1027, 2047, 1032, 1056, 16279, 1035, 7170, 2121, 1035, 6764, 27268, 6633, 1006, 1005, 1012, 1005, 1007, 1025, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Period/Range.php
Range.getPrettyString
public function getPrettyString() { $out = $this->translator->translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString())); return $out; }
php
public function getPrettyString() { $out = $this->translator->translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString())); return $out; }
[ "public", "function", "getPrettyString", "(", ")", "{", "$", "out", "=", "$", "this", "->", "translator", "->", "translate", "(", "'General_DateRangeFromTo'", ",", "array", "(", "$", "this", "->", "getDateStart", "(", ")", "->", "toString", "(", ")", ",", ...
Returns the current period as a string. @return string
[ "Returns", "the", "current", "period", "as", "a", "string", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L166-L170
train
Get the translated date range from to or from the current date range
[ 30522, 2270, 3853, 2131, 28139, 15353, 3367, 4892, 1006, 1007, 1063, 1002, 2041, 1027, 1002, 2023, 1011, 1028, 11403, 1011, 1028, 17637, 1006, 1005, 2236, 1035, 3058, 24388, 12879, 21716, 3406, 1005, 1010, 9140, 1006, 1002, 2023, 1011, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DomCrawler/AbstractUriElement.php
AbstractUriElement.canonicalizePath
protected function canonicalizePath($path) { if ('' === $path || '/' === $path) { return $path; } if ('.' === substr($path, -1)) { $path .= '/'; } $output = []; foreach (explode('/', $path) as $segment) { if ('..' === $segment) { array_pop($output); } elseif ('.' !== $segment) { $output[] = $segment; } } return implode('/', $output); }
php
protected function canonicalizePath($path) { if ('' === $path || '/' === $path) { return $path; } if ('.' === substr($path, -1)) { $path .= '/'; } $output = []; foreach (explode('/', $path) as $segment) { if ('..' === $segment) { array_pop($output); } elseif ('.' !== $segment) { $output[] = $segment; } } return implode('/', $output); }
[ "protected", "function", "canonicalizePath", "(", "$", "path", ")", "{", "if", "(", "''", "===", "$", "path", "||", "'/'", "===", "$", "path", ")", "{", "return", "$", "path", ";", "}", "if", "(", "'.'", "===", "substr", "(", "$", "path", ",", "-...
Returns the canonicalized URI path (see RFC 3986, section 5.2.4). @param string $path URI path @return string
[ "Returns", "the", "canonicalized", "URI", "path", "(", "see", "RFC", "3986", "section", "5", ".", "2", ".", "4", ")", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/AbstractUriElement.php#L139-L160
train
Canonicalizes path.
[ 30522, 5123, 3853, 18562, 4697, 15069, 1006, 1002, 4130, 1007, 1063, 2065, 1006, 1005, 1005, 1027, 1027, 1027, 1002, 4130, 1064, 1064, 1005, 1013, 1005, 1027, 1027, 1027, 1002, 4130, 1007, 1063, 2709, 1002, 4130, 1025, 1065, 2065, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Router.php
Router.emailVerification
public function emailVerification() { $this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice'); $this->get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify'); $this->get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); }
php
public function emailVerification() { $this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice'); $this->get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify'); $this->get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); }
[ "public", "function", "emailVerification", "(", ")", "{", "$", "this", "->", "get", "(", "'email/verify'", ",", "'Auth\\VerificationController@show'", ")", "->", "name", "(", "'verification.notice'", ")", ";", "$", "this", "->", "get", "(", "'email/verify/{id}'", ...
Register the typical email verification routes for an application. @return void
[ "Register", "the", "typical", "email", "verification", "routes", "for", "an", "application", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L1191-L1196
train
Email Verification - related stuff
[ 30522, 2270, 3853, 10373, 6299, 9031, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 2131, 1006, 1005, 10373, 1013, 20410, 1005, 1010, 1005, 8740, 2705, 1032, 22616, 8663, 13181, 10820, 1030, 2265, 1005, 1007, 1011, 1028, 2171, 1006, 1005, 22616...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Command/LockableTrait.php
LockableTrait.lock
private function lock($name = null, $blocking = false) { if (!class_exists(SemaphoreStore::class)) { throw new LogicException('To enable the locking feature you must install the symfony/lock component.'); } if (null !== $this->lock) { throw new LogicException('A lock is already in place.'); } if (SemaphoreStore::isSupported()) { $store = new SemaphoreStore(); } else { $store = new FlockStore(); } $this->lock = (new Factory($store))->createLock($name ?: $this->getName()); if (!$this->lock->acquire($blocking)) { $this->lock = null; return false; } return true; }
php
private function lock($name = null, $blocking = false) { if (!class_exists(SemaphoreStore::class)) { throw new LogicException('To enable the locking feature you must install the symfony/lock component.'); } if (null !== $this->lock) { throw new LogicException('A lock is already in place.'); } if (SemaphoreStore::isSupported()) { $store = new SemaphoreStore(); } else { $store = new FlockStore(); } $this->lock = (new Factory($store))->createLock($name ?: $this->getName()); if (!$this->lock->acquire($blocking)) { $this->lock = null; return false; } return true; }
[ "private", "function", "lock", "(", "$", "name", "=", "null", ",", "$", "blocking", "=", "false", ")", "{", "if", "(", "!", "class_exists", "(", "SemaphoreStore", "::", "class", ")", ")", "{", "throw", "new", "LogicException", "(", "'To enable the locking ...
Locks a command. @return bool
[ "Locks", "a", "command", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Command/LockableTrait.php#L35-L59
train
Lock the current language
[ 30522, 2797, 3853, 5843, 1006, 1002, 2171, 1027, 19701, 1010, 1002, 10851, 1027, 6270, 1007, 1063, 2065, 1006, 999, 2465, 1035, 6526, 1006, 7367, 2863, 8458, 16610, 19277, 1024, 1024, 2465, 1007, 1007, 1063, 5466, 2047, 7961, 10288, 24422, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Mailer.php
Mailer.later
public function later($delay, $view, $queue = null) { if (! $view instanceof MailableContract) { throw new InvalidArgumentException('Only mailables may be queued.'); } return $view->later($delay, is_null($queue) ? $this->queue : $queue); }
php
public function later($delay, $view, $queue = null) { if (! $view instanceof MailableContract) { throw new InvalidArgumentException('Only mailables may be queued.'); } return $view->later($delay, is_null($queue) ? $this->queue : $queue); }
[ "public", "function", "later", "(", "$", "delay", ",", "$", "view", ",", "$", "queue", "=", "null", ")", "{", "if", "(", "!", "$", "view", "instanceof", "MailableContract", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Only mailables may be qu...
Queue a new e-mail message for sending after (n) seconds. @param \DateTimeInterface|\DateInterval|int $delay @param \Illuminate\Contracts\Mail\Mailable $view @param string|null $queue @return mixed @throws \InvalidArgumentException
[ "Queue", "a", "new", "e", "-", "mail", "message", "for", "sending", "after", "(", "n", ")", "seconds", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailer.php#L427-L434
train
This method will be called to schedule the next request.
[ 30522, 2270, 3853, 2101, 1006, 1002, 8536, 1010, 1002, 3193, 1010, 1002, 24240, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 3193, 6013, 11253, 5653, 3085, 8663, 6494, 6593, 1007, 1063, 5466, 2047, 19528, 2906, 22850, 15781, 2595, 24422,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/formwidgets/Repeater.php
Repeater.prepareVars
public function prepareVars() { // Refresh the loaded data to support being modified by filterFields // @see https://github.com/octobercms/october/issues/2613 if (!self::$onAddItemCalled) { $this->processExistingItems(); } if ($this->previewMode) { foreach ($this->formWidgets as $widget) { $widget->previewMode = true; } } $this->vars['indexInputName'] = $this->indexInputName; $this->vars['groupInputName'] = $this->groupInputName; $this->vars['prompt'] = $this->prompt; $this->vars['formWidgets'] = $this->formWidgets; $this->vars['titleFrom'] = $this->titleFrom; $this->vars['minItems'] = $this->minItems; $this->vars['maxItems'] = $this->maxItems; $this->vars['useGroups'] = $this->useGroups; $this->vars['groupDefinitions'] = $this->groupDefinitions; }
php
public function prepareVars() { // Refresh the loaded data to support being modified by filterFields // @see https://github.com/octobercms/october/issues/2613 if (!self::$onAddItemCalled) { $this->processExistingItems(); } if ($this->previewMode) { foreach ($this->formWidgets as $widget) { $widget->previewMode = true; } } $this->vars['indexInputName'] = $this->indexInputName; $this->vars['groupInputName'] = $this->groupInputName; $this->vars['prompt'] = $this->prompt; $this->vars['formWidgets'] = $this->formWidgets; $this->vars['titleFrom'] = $this->titleFrom; $this->vars['minItems'] = $this->minItems; $this->vars['maxItems'] = $this->maxItems; $this->vars['useGroups'] = $this->useGroups; $this->vars['groupDefinitions'] = $this->groupDefinitions; }
[ "public", "function", "prepareVars", "(", ")", "{", "// Refresh the loaded data to support being modified by filterFields", "// @see https://github.com/octobercms/october/issues/2613", "if", "(", "!", "self", "::", "$", "onAddItemCalled", ")", "{", "$", "this", "->", "process...
Prepares the form widget view data
[ "Prepares", "the", "form", "widget", "view", "data" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/Repeater.php#L133-L158
train
Prepare the variables that will be used by the filterFields
[ 30522, 2270, 3853, 7374, 10755, 2015, 1006, 1007, 1063, 1013, 1013, 25416, 21898, 1996, 8209, 2951, 2000, 2490, 2108, 6310, 2011, 11307, 15155, 1013, 1013, 1030, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2255, 274...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Workflow/Workflow.php
Workflow.buildTransitionBlockerList
public function buildTransitionBlockerList($subject, string $transitionName): TransitionBlockerList { $transitions = $this->definition->getTransitions(); $marking = $this->getMarking($subject); $transitionBlockerList = null; foreach ($transitions as $transition) { if ($transition->getName() !== $transitionName) { continue; } $transitionBlockerList = $this->buildTransitionBlockerListForTransition($subject, $marking, $transition); if ($transitionBlockerList->isEmpty()) { return $transitionBlockerList; } // We prefer to return transitions blocker by something else than // marking. Because it means the marking was OK. Transitions are // deterministic: it's not possible to have many transitions enabled // at the same time that match the same marking with the same name if (!$transitionBlockerList->has(TransitionBlocker::BLOCKED_BY_MARKING)) { return $transitionBlockerList; } } if (!$transitionBlockerList) { throw new UndefinedTransitionException($subject, $transitionName, $this); } return $transitionBlockerList; }
php
public function buildTransitionBlockerList($subject, string $transitionName): TransitionBlockerList { $transitions = $this->definition->getTransitions(); $marking = $this->getMarking($subject); $transitionBlockerList = null; foreach ($transitions as $transition) { if ($transition->getName() !== $transitionName) { continue; } $transitionBlockerList = $this->buildTransitionBlockerListForTransition($subject, $marking, $transition); if ($transitionBlockerList->isEmpty()) { return $transitionBlockerList; } // We prefer to return transitions blocker by something else than // marking. Because it means the marking was OK. Transitions are // deterministic: it's not possible to have many transitions enabled // at the same time that match the same marking with the same name if (!$transitionBlockerList->has(TransitionBlocker::BLOCKED_BY_MARKING)) { return $transitionBlockerList; } } if (!$transitionBlockerList) { throw new UndefinedTransitionException($subject, $transitionName, $this); } return $transitionBlockerList; }
[ "public", "function", "buildTransitionBlockerList", "(", "$", "subject", ",", "string", "$", "transitionName", ")", ":", "TransitionBlockerList", "{", "$", "transitions", "=", "$", "this", "->", "definition", "->", "getTransitions", "(", ")", ";", "$", "marking"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/Workflow.php#L118-L149
train
Build TransitionBlockerList for given subject and transition name
[ 30522, 2270, 3853, 3857, 6494, 3619, 22753, 23467, 2121, 9863, 1006, 1002, 3395, 1010, 5164, 1002, 6653, 18442, 1007, 1024, 6653, 23467, 2121, 9863, 1063, 1002, 22166, 1027, 1002, 2023, 1011, 1028, 6210, 1011, 1028, 2131, 6494, 3619, 22753,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Rules/DatabaseRule.php
DatabaseRule.whereIn
public function whereIn($column, array $values) { return $this->where(function ($query) use ($column, $values) { $query->whereIn($column, $values); }); }
php
public function whereIn($column, array $values) { return $this->where(function ($query) use ($column, $values) { $query->whereIn($column, $values); }); }
[ "public", "function", "whereIn", "(", "$", "column", ",", "array", "$", "values", ")", "{", "return", "$", "this", "->", "where", "(", "function", "(", "$", "query", ")", "use", "(", "$", "column", ",", "$", "values", ")", "{", "$", "query", "->", ...
Set a "where in" constraint on the query. @param string $column @param array $values @return $this
[ "Set", "a", "where", "in", "constraint", "on", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Rules/DatabaseRule.php#L117-L122
train
Add a where in clause to the query.
[ 30522, 2270, 3853, 16726, 1006, 1002, 5930, 1010, 9140, 1002, 5300, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2073, 1006, 3853, 1006, 1002, 23032, 1007, 2224, 1006, 1002, 5930, 1010, 1002, 5300, 1007, 1063, 1002, 23032, 1011, 1028, 16726, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/MultiSites/API.php
API.getOne
public function getOne($idSite, $period, $date, $segment = false, $_restrictSitesToLogin = false, $enhanced = false) { Piwik::checkUserHasViewAccess($idSite); $sites = $this->getSiteFromId($idSite); return $this->buildDataTable( $sites, $period, $date, $segment, $_restrictSitesToLogin, $enhanced, $multipleWebsitesRequested = false, $showColumns = array() ); }
php
public function getOne($idSite, $period, $date, $segment = false, $_restrictSitesToLogin = false, $enhanced = false) { Piwik::checkUserHasViewAccess($idSite); $sites = $this->getSiteFromId($idSite); return $this->buildDataTable( $sites, $period, $date, $segment, $_restrictSitesToLogin, $enhanced, $multipleWebsitesRequested = false, $showColumns = array() ); }
[ "public", "function", "getOne", "(", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "segment", "=", "false", ",", "$", "_restrictSitesToLogin", "=", "false", ",", "$", "enhanced", "=", "false", ")", "{", "Piwik", "::", "checkUserHasViewAc...
Same as getAll but for a unique Matomo site @see Piwik\Plugins\MultiSites\API::getAll() @param int $idSite Id of the Matomo site @param string $period The period type to get data for. @param string $date The date(s) to get data for. @param bool|string $segment The segments to get data for. @param bool|string $_restrictSitesToLogin Hack used to enforce we restrict the returned data to the specified username Only used when a scheduled task is running @param bool|string $enhanced When true, return additional goal & ecommerce metrics @return DataTable
[ "Same", "as", "getAll", "but", "for", "a", "unique", "Matomo", "site", "@see", "Piwik", "\\", "Plugins", "\\", "MultiSites", "\\", "API", "::", "getAll", "()" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MultiSites/API.php#L175-L191
train
Get a datatable for a specific site
[ 30522, 2270, 3853, 2131, 5643, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 6903, 1027, 6270, 1010, 1002, 1035, 21573, 28032, 4355, 12898, 11528, 1027, 6270, 1010, 1002, 9412, 1027, 6270, 1007, 1063, 14255,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Encryption/Encrypter.php
Encrypter.validMac
protected function validMac(array $payload) { $calculated = $this->calculateMac($payload, $bytes = random_bytes(16)); return hash_equals( hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated ); }
php
protected function validMac(array $payload) { $calculated = $this->calculateMac($payload, $bytes = random_bytes(16)); return hash_equals( hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated ); }
[ "protected", "function", "validMac", "(", "array", "$", "payload", ")", "{", "$", "calculated", "=", "$", "this", "->", "calculateMac", "(", "$", "payload", ",", "$", "bytes", "=", "random_bytes", "(", "16", ")", ")", ";", "return", "hash_equals", "(", ...
Determine if the MAC for the given payload is valid. @param array $payload @return bool
[ "Determine", "if", "the", "MAC", "for", "the", "given", "payload", "is", "valid", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Encryption/Encrypter.php#L223-L230
train
Check if the MAC is valid
[ 30522, 5123, 3853, 9398, 22911, 1006, 9140, 1002, 18093, 1007, 1063, 1002, 10174, 1027, 1002, 2023, 1011, 1028, 18422, 22911, 1006, 1002, 18093, 1010, 1002, 27507, 1027, 6721, 1035, 27507, 1006, 2385, 1007, 1007, 1025, 2709, 23325, 1035, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpCache/Store.php
Store.save
private function save($key, $data) { $path = $this->getPath($key); if (isset($this->locks[$key])) { $fp = $this->locks[$key]; @ftruncate($fp, 0); @fseek($fp, 0); $len = @fwrite($fp, $data); if (\strlen($data) !== $len) { @ftruncate($fp, 0); return false; } } else { if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) { return false; } $tmpFile = tempnam(\dirname($path), basename($path)); if (false === $fp = @fopen($tmpFile, 'wb')) { @unlink($tmpFile); return false; } @fwrite($fp, $data); @fclose($fp); if ($data != file_get_contents($tmpFile)) { @unlink($tmpFile); return false; } if (false === @rename($tmpFile, $path)) { @unlink($tmpFile); return false; } } @chmod($path, 0666 & ~umask()); }
php
private function save($key, $data) { $path = $this->getPath($key); if (isset($this->locks[$key])) { $fp = $this->locks[$key]; @ftruncate($fp, 0); @fseek($fp, 0); $len = @fwrite($fp, $data); if (\strlen($data) !== $len) { @ftruncate($fp, 0); return false; } } else { if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) { return false; } $tmpFile = tempnam(\dirname($path), basename($path)); if (false === $fp = @fopen($tmpFile, 'wb')) { @unlink($tmpFile); return false; } @fwrite($fp, $data); @fclose($fp); if ($data != file_get_contents($tmpFile)) { @unlink($tmpFile); return false; } if (false === @rename($tmpFile, $path)) { @unlink($tmpFile); return false; } } @chmod($path, 0666 & ~umask()); }
[ "private", "function", "save", "(", "$", "key", ",", "$", "data", ")", "{", "$", "path", "=", "$", "this", "->", "getPath", "(", "$", "key", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "locks", "[", "$", "key", "]", ")", ")", "{", ...
Save data for the given key. @param string $key The store key @param string $data The data to store @return bool
[ "Save", "data", "for", "the", "given", "key", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L367-L409
train
Save the data to the file
[ 30522, 2797, 3853, 3828, 1006, 1002, 3145, 1010, 1002, 2951, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 2131, 15069, 1006, 1002, 3145, 1007, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 11223, 1031, 1002, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/ZendServer/Disk.php
Zend_Cache_Backend_ZendServer_Disk._store
protected function _store($data, $id, $timeToLive) { if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id, $data, $timeToLive) === false) { $this->_log('Store operation failed.'); return false; } return true; }
php
protected function _store($data, $id, $timeToLive) { if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id, $data, $timeToLive) === false) { $this->_log('Store operation failed.'); return false; } return true; }
[ "protected", "function", "_store", "(", "$", "data", ",", "$", "id", ",", "$", "timeToLive", ")", "{", "if", "(", "zend_disk_cache_store", "(", "$", "this", "->", "_options", "[", "'namespace'", "]", ".", "'::'", ".", "$", "id", ",", "$", "data", ","...
Store data @param mixed $data Object to store @param string $id Cache id @param int $timeToLive Time to live in seconds @return boolean true if no problem
[ "Store", "data" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/ZendServer/Disk.php#L61-L70
train
Store data in the cache
[ 30522, 5123, 3853, 1035, 3573, 1006, 1002, 2951, 1010, 1002, 8909, 1010, 1002, 2051, 3406, 3669, 3726, 1007, 1063, 2065, 1006, 16729, 2094, 1035, 9785, 1035, 17053, 1035, 3573, 1006, 1002, 2023, 1011, 1028, 1035, 7047, 1031, 1005, 3415, 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/Medium.php
Medium.link
public function link($reset = true, array $attributes = []) { if ($this->mode !== 'source') { $this->display('source'); } foreach ($this->attributes as $key => $value) { empty($attributes['data-' . $key]) && $attributes['data-' . $key] = $value; } empty($attributes['href']) && $attributes['href'] = $this->url(); return new Link($attributes, $this); }
php
public function link($reset = true, array $attributes = []) { if ($this->mode !== 'source') { $this->display('source'); } foreach ($this->attributes as $key => $value) { empty($attributes['data-' . $key]) && $attributes['data-' . $key] = $value; } empty($attributes['href']) && $attributes['href'] = $this->url(); return new Link($attributes, $this); }
[ "public", "function", "link", "(", "$", "reset", "=", "true", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "mode", "!==", "'source'", ")", "{", "$", "this", "->", "display", "(", "'source'", ")", ";", "}...
Turn the current Medium into a Link @param bool $reset @param array $attributes @return Link
[ "Turn", "the", "current", "Medium", "into", "a", "Link" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L541-L554
train
Create Link object
[ 30522, 2270, 3853, 4957, 1006, 1002, 25141, 1027, 2995, 1010, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5549, 999, 1027, 1027, 1005, 3120, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 4653, 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...
symfony/symfony
src/Symfony/Component/Translation/Translator.php
Translator.getConfigCacheFactory
private function getConfigCacheFactory(): ConfigCacheFactoryInterface { if (!$this->configCacheFactory) { $this->configCacheFactory = new ConfigCacheFactory($this->debug); } return $this->configCacheFactory; }
php
private function getConfigCacheFactory(): ConfigCacheFactoryInterface { if (!$this->configCacheFactory) { $this->configCacheFactory = new ConfigCacheFactory($this->debug); } return $this->configCacheFactory; }
[ "private", "function", "getConfigCacheFactory", "(", ")", ":", "ConfigCacheFactoryInterface", "{", "if", "(", "!", "$", "this", "->", "configCacheFactory", ")", "{", "$", "this", "->", "configCacheFactory", "=", "new", "ConfigCacheFactory", "(", "$", "this", "->...
Provides the ConfigCache factory implementation, falling back to a default implementation if necessary.
[ "Provides", "the", "ConfigCache", "factory", "implementation", "falling", "back", "to", "a", "default", "implementation", "if", "necessary", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Translator.php#L485-L492
train
Get ConfigCacheFactory Interface
[ 30522, 2797, 30524, 15395, 21450, 1006, 1002, 2023, 1011, 1028, 2139, 8569, 2290, 1007, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 9530, 8873, 18195, 15395, 21450, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Finder/SplFileInfo.php
SplFileInfo.getContents
public function getContents() { set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); $content = file_get_contents($this->getPathname()); restore_error_handler(); if (false === $content) { throw new \RuntimeException($error); } return $content; }
php
public function getContents() { set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); $content = file_get_contents($this->getPathname()); restore_error_handler(); if (false === $content) { throw new \RuntimeException($error); } return $content; }
[ "public", "function", "getContents", "(", ")", "{", "set_error_handler", "(", "function", "(", "$", "type", ",", "$", "msg", ")", "use", "(", "&", "$", "error", ")", "{", "$", "error", "=", "$", "msg", ";", "}", ")", ";", "$", "content", "=", "fi...
Returns the contents of the file. @return string the contents of the file @throws \RuntimeException
[ "Returns", "the", "contents", "of", "the", "file", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/SplFileInfo.php#L74-L84
train
Get the contents of the file
[ 30522, 2270, 3853, 2131, 8663, 6528, 3215, 1006, 1007, 1063, 2275, 1035, 7561, 1035, 28213, 1006, 3853, 1006, 1002, 2828, 1010, 1002, 5796, 2290, 1007, 2224, 1006, 1004, 1002, 7561, 1007, 1063, 1002, 7561, 1027, 1002, 5796, 2290, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/RequestHandler/RequestHandler.php
RequestHandler.addCallable
public function addCallable(string $name, callable $callable): self { $this->container[$name] = $callable; array_unshift($this->middleware, $name); return $this; }
php
public function addCallable(string $name, callable $callable): self { $this->container[$name] = $callable; array_unshift($this->middleware, $name); return $this; }
[ "public", "function", "addCallable", "(", "string", "$", "name", ",", "callable", "$", "callable", ")", ":", "self", "{", "$", "this", "->", "container", "[", "$", "name", "]", "=", "$", "callable", ";", "array_unshift", "(", "$", "this", "->", "middle...
Add callable initializing Middleware that will be executed as soon as possible. @param string $name @param callable $callable @return $this
[ "Add", "callable", "initializing", "Middleware", "that", "will", "be", "executed", "as", "soon", "as", "possible", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/RequestHandler/RequestHandler.php#L44-L50
train
Add a callable to the beginning of the stack
[ 30522, 2270, 3853, 5587, 9289, 20470, 2571, 1006, 5164, 1002, 2171, 1010, 2655, 3085, 1002, 2655, 3085, 1007, 1024, 2969, 1063, 1002, 2023, 1011, 1028, 11661, 1031, 1002, 2171, 1033, 1027, 1002, 2655, 3085, 30524, 1010, 1002, 2171, 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...
octobercms/october
modules/backend/widgets/ReportContainer.php
ReportContainer.defineReportWidgets
protected function defineReportWidgets() { if ($this->reportsDefined) { return; } $result = []; $widgets = $this->getWidgetsFromUserPreferences(); foreach ($widgets as $alias => $widgetInfo) { if ($widget = $this->makeReportWidget($alias, $widgetInfo)) { $result[$alias] = $widget; } } uasort($result, function ($a, $b) { return $a['sortOrder'] - $b['sortOrder']; }); $this->reportWidgets = $result; $this->reportsDefined = true; }
php
protected function defineReportWidgets() { if ($this->reportsDefined) { return; } $result = []; $widgets = $this->getWidgetsFromUserPreferences(); foreach ($widgets as $alias => $widgetInfo) { if ($widget = $this->makeReportWidget($alias, $widgetInfo)) { $result[$alias] = $widget; } } uasort($result, function ($a, $b) { return $a['sortOrder'] - $b['sortOrder']; }); $this->reportWidgets = $result; $this->reportsDefined = true; }
[ "protected", "function", "defineReportWidgets", "(", ")", "{", "if", "(", "$", "this", "->", "reportsDefined", ")", "{", "return", ";", "}", "$", "result", "=", "[", "]", ";", "$", "widgets", "=", "$", "this", "->", "getWidgetsFromUserPreferences", "(", ...
Registers the report widgets that will be included in this container. The chosen widgets are based on the user preferences.
[ "Registers", "the", "report", "widgets", "that", "will", "be", "included", "in", "this", "container", ".", "The", "chosen", "widgets", "are", "based", "on", "the", "user", "preferences", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/ReportContainer.php#L300-L322
train
Define all report widgets from user preferences
[ 30522, 5123, 3853, 9375, 2890, 6442, 9148, 28682, 1006, 1007, 1063, 2065, 1006, 30524, 2765, 1027, 1031, 1033, 1025, 1002, 15536, 28682, 1027, 1002, 2023, 1011, 1028, 2131, 9148, 28682, 19699, 5358, 20330, 28139, 25523, 2015, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.update
public function update(array $attributes = [], array $options = []) { if (! $this->exists) { return false; } return $this->fill($attributes)->save($options); }
php
public function update(array $attributes = [], array $options = []) { if (! $this->exists) { return false; } return $this->fill($attributes)->save($options); }
[ "public", "function", "update", "(", "array", "$", "attributes", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "exists", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->"...
Update the model in the database. @param array $attributes @param array $options @return bool
[ "Update", "the", "model", "in", "the", "database", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L597-L604
train
Update the record
[ 30522, 2270, 3853, 10651, 1006, 9140, 1002, 12332, 1027, 1031, 1033, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6526, 1007, 1063, 2709, 6270, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 60...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.safeEmailFilter
public function safeEmailFilter($str) { $email = ''; for ($i = 0, $len = strlen($str); $i < $len; $i++) { $j = random_int(0, 1); $email .= $j === 0 ? '&#' . ord($str[$i]) . ';' : $str[$i]; } return str_replace('@', '&#64;', $email); }
php
public function safeEmailFilter($str) { $email = ''; for ($i = 0, $len = strlen($str); $i < $len; $i++) { $j = random_int(0, 1); $email .= $j === 0 ? '&#' . ord($str[$i]) . ';' : $str[$i]; } return str_replace('@', '&#64;', $email); }
[ "public", "function", "safeEmailFilter", "(", "$", "str", ")", "{", "$", "email", "=", "''", ";", "for", "(", "$", "i", "=", "0", ",", "$", "len", "=", "strlen", "(", "$", "str", ")", ";", "$", "i", "<", "$", "len", ";", "$", "i", "++", ")"...
Protects email address. @param string $str @return string
[ "Protects", "email", "address", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L228-L238
train
This function is a wrapper for the emailFilter function to replace all characters with & and &
[ 30522, 2270, 3853, 3647, 14545, 4014, 8873, 21928, 1006, 1002, 2358, 2099, 1007, 1063, 1002, 10373, 1027, 1005, 1005, 1025, 2005, 1006, 1002, 1045, 1027, 1014, 1010, 1002, 18798, 1027, 2358, 20927, 2078, 1006, 1002, 2358, 2099, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/UsersManager.php
UsersManager.isValidPasswordString
public static function isValidPasswordString($input) { if (!SettingsPiwik::isUserCredentialsSanityCheckEnabled() && !empty($input) ) { return true; } $l = strlen($input); return $l >= self::PASSWORD_MIN_LENGTH; }
php
public static function isValidPasswordString($input) { if (!SettingsPiwik::isUserCredentialsSanityCheckEnabled() && !empty($input) ) { return true; } $l = strlen($input); return $l >= self::PASSWORD_MIN_LENGTH; }
[ "public", "static", "function", "isValidPasswordString", "(", "$", "input", ")", "{", "if", "(", "!", "SettingsPiwik", "::", "isUserCredentialsSanityCheckEnabled", "(", ")", "&&", "!", "empty", "(", "$", "input", ")", ")", "{", "return", "true", ";", "}", ...
Returns true if the password is complex enough (at least 6 characters and max 26 characters) @param $input string @return bool
[ "Returns", "true", "if", "the", "password", "is", "complex", "enough", "(", "at", "least", "6", "characters", "and", "max", "26", "characters", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/UsersManager.php#L157-L168
train
Returns true if the input string is valid for the password minimum length
[ 30522, 2270, 10763, 3853, 2003, 10175, 3593, 15194, 22104, 18886, 3070, 1006, 1002, 7953, 1007, 1063, 2065, 1006, 999, 10906, 8197, 9148, 2243, 1024, 1024, 2003, 20330, 16748, 16454, 26340, 8791, 3012, 5403, 19766, 3085, 2094, 1006, 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...
overtrue/wechat
src/OpenPlatform/Authorizer/OfficialAccount/Account/Client.php
Client.getFastRegistrationUrl
public function getFastRegistrationUrl(string $callbackUrl, bool $copyWxVerify = true): string { $queries = [ 'copy_wx_verify' => $copyWxVerify, 'component_appid' => $this->component['config']['app_id'], 'appid' => $this->app['config']['app_id'], 'redirect_uri' => $callbackUrl, ]; return 'https://mp.weixin.qq.com/cgi-bin/fastregisterauth?'.http_build_query($queries); }
php
public function getFastRegistrationUrl(string $callbackUrl, bool $copyWxVerify = true): string { $queries = [ 'copy_wx_verify' => $copyWxVerify, 'component_appid' => $this->component['config']['app_id'], 'appid' => $this->app['config']['app_id'], 'redirect_uri' => $callbackUrl, ]; return 'https://mp.weixin.qq.com/cgi-bin/fastregisterauth?'.http_build_query($queries); }
[ "public", "function", "getFastRegistrationUrl", "(", "string", "$", "callbackUrl", ",", "bool", "$", "copyWxVerify", "=", "true", ")", ":", "string", "{", "$", "queries", "=", "[", "'copy_wx_verify'", "=>", "$", "copyWxVerify", ",", "'component_appid'", "=>", ...
从第三方平台跳转至微信公众平台授权注册页面, 授权注册小程序. @param string $callbackUrl @param bool $copyWxVerify @return string
[ "从第三方平台跳转至微信公众平台授权注册页面", "授权注册小程序", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Authorizer/OfficialAccount/Account/Client.php#L51-L61
train
Get Fast Registration URL
[ 30522, 2270, 3853, 2131, 24333, 2890, 24063, 8156, 3126, 2140, 1006, 5164, 1002, 2655, 5963, 3126, 2140, 1010, 22017, 2140, 1002, 6100, 2860, 2595, 6299, 8757, 1027, 2995, 1007, 1024, 5164, 1063, 1002, 10861, 5134, 1027, 1031, 1005, 6100, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Installer.php
Installer.isValidDestination
public static function isValidDestination($destination, $exclude = []) { self::$error = 0; self::$target = $destination; if (is_link($destination)) { self::$error = self::IS_LINK; } elseif (file_exists($destination)) { self::$error = self::EXISTS; } elseif (!file_exists($destination)) { self::$error = self::NOT_FOUND; } elseif (!is_dir($destination)) { self::$error = self::NOT_DIRECTORY; } if (\count($exclude) && \in_array(self::$error, $exclude, true)) { return true; } return !self::$error; }
php
public static function isValidDestination($destination, $exclude = []) { self::$error = 0; self::$target = $destination; if (is_link($destination)) { self::$error = self::IS_LINK; } elseif (file_exists($destination)) { self::$error = self::EXISTS; } elseif (!file_exists($destination)) { self::$error = self::NOT_FOUND; } elseif (!is_dir($destination)) { self::$error = self::NOT_DIRECTORY; } if (\count($exclude) && \in_array(self::$error, $exclude, true)) { return true; } return !self::$error; }
[ "public", "static", "function", "isValidDestination", "(", "$", "destination", ",", "$", "exclude", "=", "[", "]", ")", "{", "self", "::", "$", "error", "=", "0", ";", "self", "::", "$", "target", "=", "$", "destination", ";", "if", "(", "is_link", "...
Runs a set of checks on the destination and sets the Error if any @param string $destination The directory to run validations at @param array $exclude An array of constants to exclude from the validation @return bool True if validation passed. False otherwise
[ "Runs", "a", "set", "of", "checks", "on", "the", "destination", "and", "sets", "the", "Error", "if", "any" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Installer.php#L379-L399
train
Check if the destination is valid
[ 30522, 2270, 10763, 3853, 2003, 10175, 3593, 6155, 13770, 3508, 1006, 1002, 7688, 1010, 1002, 23329, 1027, 1031, 1033, 1007, 1063, 2969, 1024, 1024, 1002, 7561, 1027, 1014, 1025, 2969, 1024, 1024, 1002, 4539, 1027, 1002, 7688, 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...
matomo-org/matomo
core/Tracker/GoalManager.php
GoalManager.updateEcommerceItems
protected function updateEcommerceItems($goal, $itemsToUpdate) { if (empty($itemsToUpdate)) { return; } Common::printDebug("Goal data used to update ecommerce items:"); Common::printDebug($goal); foreach ($itemsToUpdate as $item) { $newRow = $this->getItemRowEnriched($goal, $item); Common::printDebug($newRow); $this->getModel()->updateEcommerceItem($item['idorder_original_value'], $newRow); } }
php
protected function updateEcommerceItems($goal, $itemsToUpdate) { if (empty($itemsToUpdate)) { return; } Common::printDebug("Goal data used to update ecommerce items:"); Common::printDebug($goal); foreach ($itemsToUpdate as $item) { $newRow = $this->getItemRowEnriched($goal, $item); Common::printDebug($newRow); $this->getModel()->updateEcommerceItem($item['idorder_original_value'], $newRow); } }
[ "protected", "function", "updateEcommerceItems", "(", "$", "goal", ",", "$", "itemsToUpdate", ")", "{", "if", "(", "empty", "(", "$", "itemsToUpdate", ")", ")", "{", "return", ";", "}", "Common", "::", "printDebug", "(", "\"Goal data used to update ecommerce ite...
Updates the cart items in the DB that have been modified since the last cart update @param array $goal @param array $itemsToUpdate @return void
[ "Updates", "the", "cart", "items", "in", "the", "DB", "that", "have", "been", "modified", "since", "the", "last", "cart", "update" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/GoalManager.php#L569-L584
train
Update ecommerce items
[ 30522, 5123, 3853, 10651, 8586, 5358, 5017, 3401, 4221, 5244, 1006, 1002, 3125, 1010, 1002, 5167, 24826, 17299, 3686, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 5167, 24826, 17299, 3686, 1007, 1007, 1063, 2709, 1025, 1065, 2691, 1024, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule/Callback.php
HTML_QuickForm2_Rule_Callback.validateOwner
protected function validateOwner() { $value = $this->owner->getValue(); $config = $this->getConfig(); return (bool)call_user_func_array( $config['callback'], array_merge(array($value), $config['arguments']) ); }
php
protected function validateOwner() { $value = $this->owner->getValue(); $config = $this->getConfig(); return (bool)call_user_func_array( $config['callback'], array_merge(array($value), $config['arguments']) ); }
[ "protected", "function", "validateOwner", "(", ")", "{", "$", "value", "=", "$", "this", "->", "owner", "->", "getValue", "(", ")", ";", "$", "config", "=", "$", "this", "->", "getConfig", "(", ")", ";", "return", "(", "bool", ")", "call_user_func_arra...
Validates the owner element @return bool the value returned by a callback function
[ "Validates", "the", "owner", "element" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Callback.php#L95-L102
train
Validate Owner.
[ 30522, 5123, 3853, 9398, 3686, 12384, 2121, 1006, 1007, 1063, 1002, 3643, 1027, 1002, 2023, 1011, 1028, 3954, 1011, 1028, 2131, 10175, 5657, 1006, 1007, 1025, 1002, 9530, 8873, 2290, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 8873, 2290, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Controllers/MenuController.php
MenuController.index
public function index(Content $content) { return $content ->header(trans('admin.menu')) ->description(trans('admin.list')) ->row(function (Row $row) { $row->column(6, $this->treeView()->render()); $row->column(6, function (Column $column) { $form = new \Encore\Admin\Widgets\Form(); $form->action(admin_base_path('auth/menu')); $menuModel = config('admin.database.menu_model'); $permissionModel = config('admin.database.permissions_model'); $roleModel = config('admin.database.roles_model'); $form->select('parent_id', trans('admin.parent_id'))->options($menuModel::selectOptions()); $form->text('title', trans('admin.title'))->rules('required'); $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp()); $form->text('uri', trans('admin.uri')); $form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id')); if ((new $menuModel())->withPermission()) { $form->select('permission', trans('admin.permission'))->options($permissionModel::pluck('name', 'slug')); } $form->hidden('_token')->default(csrf_token()); $column->append((new Box(trans('admin.new'), $form))->style('success')); }); }); }
php
public function index(Content $content) { return $content ->header(trans('admin.menu')) ->description(trans('admin.list')) ->row(function (Row $row) { $row->column(6, $this->treeView()->render()); $row->column(6, function (Column $column) { $form = new \Encore\Admin\Widgets\Form(); $form->action(admin_base_path('auth/menu')); $menuModel = config('admin.database.menu_model'); $permissionModel = config('admin.database.permissions_model'); $roleModel = config('admin.database.roles_model'); $form->select('parent_id', trans('admin.parent_id'))->options($menuModel::selectOptions()); $form->text('title', trans('admin.title'))->rules('required'); $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp()); $form->text('uri', trans('admin.uri')); $form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id')); if ((new $menuModel())->withPermission()) { $form->select('permission', trans('admin.permission'))->options($permissionModel::pluck('name', 'slug')); } $form->hidden('_token')->default(csrf_token()); $column->append((new Box(trans('admin.new'), $form))->style('success')); }); }); }
[ "public", "function", "index", "(", "Content", "$", "content", ")", "{", "return", "$", "content", "->", "header", "(", "trans", "(", "'admin.menu'", ")", ")", "->", "description", "(", "trans", "(", "'admin.list'", ")", ")", "->", "row", "(", "function"...
Index interface. @param Content $content @return Content
[ "Index", "interface", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/MenuController.php#L24-L53
train
Displays menu menu
[ 30522, 2270, 3853, 5950, 1006, 4180, 1002, 4180, 1007, 1063, 2709, 1002, 4180, 1011, 1028, 20346, 1006, 9099, 1006, 1005, 4748, 10020, 1012, 12183, 1005, 1007, 1007, 1011, 1028, 6412, 1006, 9099, 1006, 1005, 4748, 10020, 1012, 2862, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
HandleExceptions.renderHttpResponse
protected function renderHttpResponse(Exception $e) { $this->getExceptionHandler()->render($this->app['request'], $e)->send(); }
php
protected function renderHttpResponse(Exception $e) { $this->getExceptionHandler()->render($this->app['request'], $e)->send(); }
[ "protected", "function", "renderHttpResponse", "(", "Exception", "$", "e", ")", "{", "$", "this", "->", "getExceptionHandler", "(", ")", "->", "render", "(", "$", "this", "->", "app", "[", "'request'", "]", ",", "$", "e", ")", "->", "send", "(", ")", ...
Render an exception as an HTTP response and send it. @param \Exception $e @return void
[ "Render", "an", "exception", "as", "an", "HTTP", "response", "and", "send", "it", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php#L110-L113
train
Render HTTP Response
[ 30522, 5123, 3853, 17552, 11039, 25856, 6072, 26029, 3366, 1006, 6453, 1002, 1041, 1007, 1063, 1002, 2023, 1011, 1028, 2131, 10288, 24422, 11774, 3917, 1006, 1007, 1011, 1028, 17552, 1006, 1002, 2023, 1011, 1028, 10439, 1031, 1005, 5227, 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...
walkor/Workerman
Worker.php
Worker.monitorWorkersForLinux
protected static function monitorWorkersForLinux() { static::$_status = static::STATUS_RUNNING; while (1) { // Calls signal handlers for pending signals. pcntl_signal_dispatch(); // Suspends execution of the current process until a child has exited, or until a signal is delivered $status = 0; $pid = pcntl_wait($status, WUNTRACED); // Calls signal handlers for pending signals again. pcntl_signal_dispatch(); // If a child has already exited. if ($pid > 0) { // Find out witch worker process exited. foreach (static::$_pidMap as $worker_id => $worker_pid_array) { if (isset($worker_pid_array[$pid])) { $worker = static::$_workers[$worker_id]; // Exit status. if ($status !== 0) { static::log("worker[" . $worker->name . ":$pid] exit with status $status"); } // For Statistics. if (!isset(static::$_globalStatistics['worker_exit_info'][$worker_id][$status])) { static::$_globalStatistics['worker_exit_info'][$worker_id][$status] = 0; } static::$_globalStatistics['worker_exit_info'][$worker_id][$status]++; // Clear process data. unset(static::$_pidMap[$worker_id][$pid]); // Mark id is available. $id = static::getId($worker_id, $pid); static::$_idMap[$worker_id][$id] = 0; break; } } // Is still running state then fork a new worker process. if (static::$_status !== static::STATUS_SHUTDOWN) { static::forkWorkers(); // If reloading continue. if (isset(static::$_pidsToRestart[$pid])) { unset(static::$_pidsToRestart[$pid]); static::reload(); } } } // If shutdown state and all child processes exited then master process exit. if (static::$_status === static::STATUS_SHUTDOWN && !static::getAllWorkerPids()) { static::exitAndClearAll(); } } }
php
protected static function monitorWorkersForLinux() { static::$_status = static::STATUS_RUNNING; while (1) { // Calls signal handlers for pending signals. pcntl_signal_dispatch(); // Suspends execution of the current process until a child has exited, or until a signal is delivered $status = 0; $pid = pcntl_wait($status, WUNTRACED); // Calls signal handlers for pending signals again. pcntl_signal_dispatch(); // If a child has already exited. if ($pid > 0) { // Find out witch worker process exited. foreach (static::$_pidMap as $worker_id => $worker_pid_array) { if (isset($worker_pid_array[$pid])) { $worker = static::$_workers[$worker_id]; // Exit status. if ($status !== 0) { static::log("worker[" . $worker->name . ":$pid] exit with status $status"); } // For Statistics. if (!isset(static::$_globalStatistics['worker_exit_info'][$worker_id][$status])) { static::$_globalStatistics['worker_exit_info'][$worker_id][$status] = 0; } static::$_globalStatistics['worker_exit_info'][$worker_id][$status]++; // Clear process data. unset(static::$_pidMap[$worker_id][$pid]); // Mark id is available. $id = static::getId($worker_id, $pid); static::$_idMap[$worker_id][$id] = 0; break; } } // Is still running state then fork a new worker process. if (static::$_status !== static::STATUS_SHUTDOWN) { static::forkWorkers(); // If reloading continue. if (isset(static::$_pidsToRestart[$pid])) { unset(static::$_pidsToRestart[$pid]); static::reload(); } } } // If shutdown state and all child processes exited then master process exit. if (static::$_status === static::STATUS_SHUTDOWN && !static::getAllWorkerPids()) { static::exitAndClearAll(); } } }
[ "protected", "static", "function", "monitorWorkersForLinux", "(", ")", "{", "static", "::", "$", "_status", "=", "static", "::", "STATUS_RUNNING", ";", "while", "(", "1", ")", "{", "// Calls signal handlers for pending signals.", "pcntl_signal_dispatch", "(", ")", "...
Monitor all child processes. @return void
[ "Monitor", "all", "child", "processes", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1582-L1636
train
Monitor workers for Linux processes
[ 30522, 5123, 10763, 3853, 8080, 6198, 2545, 29278, 4115, 5602, 1006, 1007, 1063, 10763, 1024, 1024, 1002, 1035, 3570, 1027, 10763, 1024, 1024, 3570, 1035, 2770, 1025, 2096, 1006, 1015, 1007, 1063, 1013, 1013, 4455, 4742, 28213, 2015, 2005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CodeParser.php
CodeParser.makeDirectorySafe
protected function makeDirectorySafe($dir) { $count = 0; if (is_dir($dir)) { if (!is_writable($dir)) { throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir])); } return; } while (!is_dir($dir) && !@mkdir($dir, 0777, true)) { usleep(rand(50000, 200000)); if ($count++ > 10) { throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir])); } } File::chmodRecursive($dir); }
php
protected function makeDirectorySafe($dir) { $count = 0; if (is_dir($dir)) { if (!is_writable($dir)) { throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir])); } return; } while (!is_dir($dir) && !@mkdir($dir, 0777, true)) { usleep(rand(50000, 200000)); if ($count++ > 10) { throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir])); } } File::chmodRecursive($dir); }
[ "protected", "function", "makeDirectorySafe", "(", "$", "dir", ")", "{", "$", "count", "=", "0", ";", "if", "(", "is_dir", "(", "$", "dir", ")", ")", "{", "if", "(", "!", "is_writable", "(", "$", "dir", ")", ")", "{", "throw", "new", "SystemExcepti...
Make directory with concurrency support
[ "Make", "directory", "with", "concurrency", "support" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L349-L370
train
Create a directory safe for use in the code
[ 30522, 5123, 3853, 2191, 4305, 30524, 1063, 1002, 4175, 1027, 1014, 1025, 2065, 1006, 2003, 1035, 16101, 1006, 1002, 16101, 1007, 1007, 1063, 2065, 1006, 999, 2003, 1035, 25697, 3085, 1006, 1002, 16101, 1007, 1007, 1063, 5466, 2047, 2291, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.replaceDigitsBetween
protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) { return $this->replaceBetween($message, $attribute, $rule, $parameters); }
php
protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) { return $this->replaceBetween($message, $attribute, $rule, $parameters); }
[ "protected", "function", "replaceDigitsBetween", "(", "$", "message", ",", "$", "attribute", ",", "$", "rule", ",", "$", "parameters", ")", "{", "return", "$", "this", "->", "replaceBetween", "(", "$", "message", ",", "$", "attribute", ",", "$", "rule", ...
Replace all place-holders for the digits (between) rule. @param string $message @param string $attribute @param string $rule @param array $parameters @return string
[ "Replace", "all", "place", "-", "holders", "for", "the", "digits", "(", "between", ")", "rule", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php#L74-L77
train
Protected replaceDigitsBetween method
[ 30522, 5123, 3853, 2999, 8004, 12762, 20915, 28394, 2078, 1006, 1002, 4471, 1010, 1002, 17961, 1010, 1002, 3627, 1010, 1002, 11709, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5672, 20915, 28394, 2078, 1006, 1002, 4471, 1010, 1002, 17961, 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...
symfony/symfony
src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php
CheckDefinitionValidityPass.process
public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { // synthetic service is public if ($definition->isSynthetic() && !$definition->isPublic()) { throw new RuntimeException(sprintf('A synthetic service ("%s") must be public.', $id)); } // non-synthetic, non-abstract service has class if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { if ($definition->getFactory()) { throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); } if (class_exists($id) || interface_exists($id, false)) { if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) { throw new RuntimeException(sprintf( 'The definition for "%s" has no class attribute, and appears to reference a class or interface. ' .'Please specify the class attribute explicitly or remove the leading backslash by renaming ' .'the service to "%s" to get rid of this error.', $id, substr($id, 1) )); } throw new RuntimeException(sprintf( 'The definition for "%s" has no class attribute, and appears to reference a ' .'class or interface in the global namespace. Leaving out the "class" attribute ' .'is only allowed for namespaced classes. Please specify the class attribute ' .'explicitly to get rid of this error.', $id )); } throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); } // tag attribute values must be scalars foreach ($definition->getTags() as $name => $tags) { foreach ($tags as $attributes) { foreach ($attributes as $attribute => $value) { if (!is_scalar($value) && null !== $value) { throw new RuntimeException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute)); } } } } if ($definition->isPublic() && !$definition->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); } } } foreach ($container->getAliases() as $id => $alias) { if ($alias->isPublic() && !$alias->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); } } } }
php
public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $id => $definition) { // synthetic service is public if ($definition->isSynthetic() && !$definition->isPublic()) { throw new RuntimeException(sprintf('A synthetic service ("%s") must be public.', $id)); } // non-synthetic, non-abstract service has class if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { if ($definition->getFactory()) { throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); } if (class_exists($id) || interface_exists($id, false)) { if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) { throw new RuntimeException(sprintf( 'The definition for "%s" has no class attribute, and appears to reference a class or interface. ' .'Please specify the class attribute explicitly or remove the leading backslash by renaming ' .'the service to "%s" to get rid of this error.', $id, substr($id, 1) )); } throw new RuntimeException(sprintf( 'The definition for "%s" has no class attribute, and appears to reference a ' .'class or interface in the global namespace. Leaving out the "class" attribute ' .'is only allowed for namespaced classes. Please specify the class attribute ' .'explicitly to get rid of this error.', $id )); } throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); } // tag attribute values must be scalars foreach ($definition->getTags() as $name => $tags) { foreach ($tags as $attributes) { foreach ($attributes as $attribute => $value) { if (!is_scalar($value) && null !== $value) { throw new RuntimeException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute)); } } } } if ($definition->isPublic() && !$definition->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); } } } foreach ($container->getAliases() as $id => $alias) { if ($alias->isPublic() && !$alias->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); } } } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "foreach", "(", "$", "container", "->", "getDefinitions", "(", ")", "as", "$", "id", "=>", "$", "definition", ")", "{", "// synthetic service is public", "if", "(", "$", "d...
Processes the ContainerBuilder to validate the Definition. @throws RuntimeException When the Definition is invalid
[ "Processes", "the", "ContainerBuilder", "to", "validate", "the", "Definition", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php#L37-L99
train
Process the container builder
[ 30522, 2270, 3853, 2832, 1006, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 18921, 6776, 1006, 1002, 11661, 1011, 1028, 2131, 3207, 16294, 22753, 2015, 1006, 1007, 2004, 1002, 8909, 1027, 1028, 1002, 6210, 1007, 1063, 1013, 1013, 1255...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Metrics/Sorter.php
Sorter.getPrimaryColumnToSort
public function getPrimaryColumnToSort(DataTable $table, $columnToSort) { // we fallback to nb_visits in case columnToSort does not exist $columnsToCheck = array($columnToSort, 'nb_visits'); $row = $table->getFirstRow(); foreach ($columnsToCheck as $column) { $column = Metric::getActualMetricColumn($table, $column); if ($row->hasColumn($column)) { // since getActualMetricColumn() returns a default value, we need to make sure it actually has that column return $column; } } return $columnToSort; }
php
public function getPrimaryColumnToSort(DataTable $table, $columnToSort) { // we fallback to nb_visits in case columnToSort does not exist $columnsToCheck = array($columnToSort, 'nb_visits'); $row = $table->getFirstRow(); foreach ($columnsToCheck as $column) { $column = Metric::getActualMetricColumn($table, $column); if ($row->hasColumn($column)) { // since getActualMetricColumn() returns a default value, we need to make sure it actually has that column return $column; } } return $columnToSort; }
[ "public", "function", "getPrimaryColumnToSort", "(", "DataTable", "$", "table", ",", "$", "columnToSort", ")", "{", "// we fallback to nb_visits in case columnToSort does not exist", "$", "columnsToCheck", "=", "array", "(", "$", "columnToSort", ",", "'nb_visits'", ")", ...
Detect the column to be used for sorting @param DataTable $table @param string|int $columnToSort column name or column id @return int
[ "Detect", "the", "column", "to", "be", "used", "for", "sorting" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Metrics/Sorter.php#L141-L158
train
Returns the column to sort in the table
[ 30522, 2270, 3853, 2131, 18098, 9581, 2854, 25778, 2819, 13663, 21748, 2102, 1006, 2951, 10880, 1002, 2795, 1010, 1002, 5930, 13122, 11589, 1007, 1063, 1013, 1013, 2057, 2991, 5963, 2000, 1050, 2497, 1035, 7879, 1999, 2553, 5930, 13122, 115...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.referrer
public function referrer($default = null, $attributes = null) { $referrer = $_SERVER['HTTP_REFERER'] ?? null; // Check that referrer came from our site. $root = $this->rootUrl(true); if ($referrer) { // Referrer should always have host set and it should come from the same base address. if (stripos($referrer, $root) !== 0) { $referrer = null; } } if (!$referrer) { $referrer = $default ?: $this->route(true, true); } if ($attributes) { $referrer .= $attributes; } // Return relative path. return substr($referrer, strlen($root)); }
php
public function referrer($default = null, $attributes = null) { $referrer = $_SERVER['HTTP_REFERER'] ?? null; // Check that referrer came from our site. $root = $this->rootUrl(true); if ($referrer) { // Referrer should always have host set and it should come from the same base address. if (stripos($referrer, $root) !== 0) { $referrer = null; } } if (!$referrer) { $referrer = $default ?: $this->route(true, true); } if ($attributes) { $referrer .= $attributes; } // Return relative path. return substr($referrer, strlen($root)); }
[ "public", "function", "referrer", "(", "$", "default", "=", "null", ",", "$", "attributes", "=", "null", ")", "{", "$", "referrer", "=", "$", "_SERVER", "[", "'HTTP_REFERER'", "]", "??", "null", ";", "// Check that referrer came from our site.", "$", "root", ...
Return relative path to the referrer defaulting to current or given page. @param string $default @param string $attributes @return string
[ "Return", "relative", "path", "to", "the", "referrer", "defaulting", "to", "current", "or", "given", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L555-L578
train
Return the referrer
[ 30522, 2270, 3853, 6523, 14544, 1006, 1002, 12398, 1027, 19701, 1010, 1002, 12332, 1027, 19701, 1007, 1063, 1002, 6523, 14544, 1027, 1002, 1035, 8241, 1031, 1005, 8299, 1035, 6523, 2121, 1005, 1033, 1029, 1029, 19701, 1025, 1013, 1013, 4638...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
XmlDescriptor.writeDocument
private function writeDocument(\DOMDocument $dom) { $dom->formatOutput = true; $this->write($dom->saveXML()); }
php
private function writeDocument(\DOMDocument $dom) { $dom->formatOutput = true; $this->write($dom->saveXML()); }
[ "private", "function", "writeDocument", "(", "\\", "DOMDocument", "$", "dom", ")", "{", "$", "dom", "->", "formatOutput", "=", "true", ";", "$", "this", "->", "write", "(", "$", "dom", "->", "saveXML", "(", ")", ")", ";", "}" ]
Writes DOM document. @return \DOMDocument|string
[ "Writes", "DOM", "document", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php#L185-L189
train
Write a DOMDocument to the current output stream
[ 30522, 2797, 3853, 4339, 3527, 24894, 4765, 1006, 1032, 14383, 3527, 24894, 4765, 1002, 14383, 1007, 1063, 1002, 14383, 1011, 1028, 4289, 5833, 18780, 1027, 2995, 1025, 1002, 2023, 1011, 1028, 4339, 1006, 1002, 14383, 1011, 1028, 3828, 2595...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ContainerBuilder.php
ContainerBuilder.addAliases
public function addAliases(array $aliases) { foreach ($aliases as $alias => $id) { $this->setAlias($alias, $id); } }
php
public function addAliases(array $aliases) { foreach ($aliases as $alias => $id) { $this->setAlias($alias, $id); } }
[ "public", "function", "addAliases", "(", "array", "$", "aliases", ")", "{", "foreach", "(", "$", "aliases", "as", "$", "alias", "=>", "$", "id", ")", "{", "$", "this", "->", "setAlias", "(", "$", "alias", ",", "$", "id", ")", ";", "}", "}" ]
Adds the service aliases.
[ "Adds", "the", "service", "aliases", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L806-L811
train
Adds aliases to the language
[ 30522, 2270, 3853, 5587, 22786, 8583, 1006, 9140, 1002, 14593, 2229, 1007, 1063, 18921, 6776, 1006, 1002, 14593, 2229, 2004, 1002, 14593, 1027, 1028, 1002, 8909, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Storage/Imap.php
Zend_Mail_Storage_Imap.getUniqueId
public function getUniqueId($id = null) { if ($id) { return $this->_protocol->fetch('UID', $id); } return $this->_protocol->fetch('UID', 1, INF); }
php
public function getUniqueId($id = null) { if ($id) { return $this->_protocol->fetch('UID', $id); } return $this->_protocol->fetch('UID', 1, INF); }
[ "public", "function", "getUniqueId", "(", "$", "id", "=", "null", ")", "{", "if", "(", "$", "id", ")", "{", "return", "$", "this", "->", "_protocol", "->", "fetch", "(", "'UID'", ",", "$", "id", ")", ";", "}", "return", "$", "this", "->", "_proto...
get unique id for one or all messages if storage does not support unique ids it's the same as the message number @param int|null $id message number @return array|string message number for given message or all messages as array @throws Zend_Mail_Storage_Exception
[ "get", "unique", "id", "for", "one", "or", "all", "messages" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Imap.php#L350-L357
train
Get Unique ID
[ 30522, 2270, 3853, 2131, 19496, 4226, 3593, 1006, 1002, 8909, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 8909, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 8778, 1011, 1028, 18584, 1006, 1005, 21318, 2094, 1005, 1010, 1002, 8909, 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/Console/Helper/TableStyle.php
TableStyle.setVerticalBorderChars
public function setVerticalBorderChars(string $outside, string $inside = null): self { $this->verticalOutsideBorderChar = $outside; $this->verticalInsideBorderChar = $inside ?? $outside; return $this; }
php
public function setVerticalBorderChars(string $outside, string $inside = null): self { $this->verticalOutsideBorderChar = $outside; $this->verticalInsideBorderChar = $inside ?? $outside; return $this; }
[ "public", "function", "setVerticalBorderChars", "(", "string", "$", "outside", ",", "string", "$", "inside", "=", "null", ")", ":", "self", "{", "$", "this", "->", "verticalOutsideBorderChar", "=", "$", "outside", ";", "$", "this", "->", "verticalInsideBorderC...
Sets vertical border characters. <code> ╔═══════════════╤══════════════════════════╤══════════════════╗ ║ ISBN │ Title │ Author ║ ╠═══════1═══════╪══════════════════════════╪══════════════════╣ ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║ ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║ ╟───────2───────┼──────────────────────────┼──────────────────╢ ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║ ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║ ╚═══════════════╧══════════════════════════╧══════════════════╝ </code> @param string $outside Outside border char (see #1 of example) @param string|null $inside Inside border char (see #2 of example), equals $outside if null
[ "Sets", "vertical", "border", "characters", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L152-L158
train
Set vertical border characters
[ 30522, 2270, 3853, 2275, 16874, 7476, 12821, 4063, 7507, 2869, 1006, 5164, 1002, 2648, 1010, 5164, 1002, 2503, 1027, 19701, 1007, 1024, 2969, 1063, 1002, 2023, 1011, 1028, 7471, 12166, 5178, 12821, 4063, 7507, 2099, 1027, 1002, 2648, 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...
matomo-org/matomo
libs/Zend/Mime.php
Zend_Mime.encodeQuotedPrintable
public static function encodeQuotedPrintable($str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { $out = ''; $str = self::_encodeQuotedPrintable($str); // Split encoded text into separate lines while ($str) { $ptr = strlen($str); if ($ptr > $lineLength) { $ptr = $lineLength; } // Ensure we are not splitting across an encoded character $pos = strrpos(substr($str, 0, $ptr), '='); if ($pos !== false && $pos >= $ptr - 2) { $ptr = $pos; } // Check if there is a space at the end of the line and rewind if ($ptr > 0 && $str[$ptr - 1] == ' ') { --$ptr; } // Add string and continue $out .= substr($str, 0, $ptr) . '=' . $lineEnd; $str = substr($str, $ptr); } $out = rtrim($out, $lineEnd); $out = rtrim($out, '='); return $out; }
php
public static function encodeQuotedPrintable($str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { $out = ''; $str = self::_encodeQuotedPrintable($str); // Split encoded text into separate lines while ($str) { $ptr = strlen($str); if ($ptr > $lineLength) { $ptr = $lineLength; } // Ensure we are not splitting across an encoded character $pos = strrpos(substr($str, 0, $ptr), '='); if ($pos !== false && $pos >= $ptr - 2) { $ptr = $pos; } // Check if there is a space at the end of the line and rewind if ($ptr > 0 && $str[$ptr - 1] == ' ') { --$ptr; } // Add string and continue $out .= substr($str, 0, $ptr) . '=' . $lineEnd; $str = substr($str, $ptr); } $out = rtrim($out, $lineEnd); $out = rtrim($out, '='); return $out; }
[ "public", "static", "function", "encodeQuotedPrintable", "(", "$", "str", ",", "$", "lineLength", "=", "self", "::", "LINELENGTH", ",", "$", "lineEnd", "=", "self", "::", "LINEEND", ")", "{", "$", "out", "=", "''", ";", "$", "str", "=", "self", "::", ...
Encode a given string with the QUOTED_PRINTABLE mechanism and wrap the lines. @param string $str @param int $lineLength Defaults to {@link LINELENGTH} @param int $lineEnd Defaults to {@link LINEEND} @return string
[ "Encode", "a", "given", "string", "with", "the", "QUOTED_PRINTABLE", "mechanism", "and", "wrap", "the", "lines", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime.php#L125-L158
train
Encode a quoted - printable string
[ 30522, 2270, 10763, 3853, 4372, 16044, 28940, 27428, 16550, 3085, 1006, 1002, 2358, 2099, 1010, 1002, 2240, 7770, 13512, 2232, 1027, 2969, 1024, 1024, 2240, 7770, 13512, 2232, 1010, 1002, 2240, 10497, 1027, 2969, 1024, 1024, 2240, 10497, 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/Process/Process.php
Process.clearErrorOutput
public function clearErrorOutput() { ftruncate($this->stderr, 0); fseek($this->stderr, 0); $this->incrementalErrorOutputOffset = 0; return $this; }
php
public function clearErrorOutput() { ftruncate($this->stderr, 0); fseek($this->stderr, 0); $this->incrementalErrorOutputOffset = 0; return $this; }
[ "public", "function", "clearErrorOutput", "(", ")", "{", "ftruncate", "(", "$", "this", "->", "stderr", ",", "0", ")", ";", "fseek", "(", "$", "this", "->", "stderr", ",", "0", ")", ";", "$", "this", "->", "incrementalErrorOutputOffset", "=", "0", ";",...
Clears the process output. @return $this
[ "Clears", "the", "process", "output", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L720-L727
train
Clear error output
[ 30522, 2270, 3853, 24509, 29165, 5833, 18780, 1006, 1007, 1063, 3027, 15532, 16280, 1006, 1002, 2023, 1011, 1028, 2358, 4063, 2099, 1010, 1014, 1007, 1025, 1042, 19763, 2243, 1006, 1002, 2023, 1011, 1028, 2358, 4063, 2099, 1010, 1014, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/Php.php
Php.getGeoIpInstance
private function getGeoIpInstance($key) { if (empty($this->geoIpCache[$key])) { // make sure region names are loaded & saved first parent::getRegionNames(); require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipcity.inc'; $pathToDb = self::getPathToGeoIpDatabase($this->customDbNames[$key]); if ($pathToDb !== false) { $this->geoIpCache[$key] = geoip_open($pathToDb, GEOIP_STANDARD); // TODO support shared memory } } return empty($this->geoIpCache[$key]) ? false : $this->geoIpCache[$key]; }
php
private function getGeoIpInstance($key) { if (empty($this->geoIpCache[$key])) { // make sure region names are loaded & saved first parent::getRegionNames(); require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipcity.inc'; $pathToDb = self::getPathToGeoIpDatabase($this->customDbNames[$key]); if ($pathToDb !== false) { $this->geoIpCache[$key] = geoip_open($pathToDb, GEOIP_STANDARD); // TODO support shared memory } } return empty($this->geoIpCache[$key]) ? false : $this->geoIpCache[$key]; }
[ "private", "function", "getGeoIpInstance", "(", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "geoIpCache", "[", "$", "key", "]", ")", ")", "{", "// make sure region names are loaded & saved first", "parent", "::", "getRegionNames", "(", ")...
Returns a GeoIP instance. Creates it if necessary. @param string $key 'loc', 'isp' or 'org'. Determines the type of GeoIP database to load. @return object|false
[ "Returns", "a", "GeoIP", "instance", ".", "Creates", "it", "if", "necessary", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/Php.php#L372-L386
train
Get the GeoIP instance
[ 30522, 2797, 3853, 2131, 3351, 10448, 27915, 26897, 1006, 1002, 3145, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 20248, 11514, 3540, 5403, 1031, 1002, 3145, 1033, 1007, 1007, 1063, 1013, 1013, 2191, 2469, 2555, 3415, 2024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.setModel
public function setModel(Model $model) { $this->model = $model; $this->query->from($model->getTable()); return $this; }
php
public function setModel(Model $model) { $this->model = $model; $this->query->from($model->getTable()); return $this; }
[ "public", "function", "setModel", "(", "Model", "$", "model", ")", "{", "$", "this", "->", "model", "=", "$", "model", ";", "$", "this", "->", "query", "->", "from", "(", "$", "model", "->", "getTable", "(", ")", ")", ";", "return", "$", "this", ...
Set a model instance for the model being queried. @param \Illuminate\Database\Eloquent\Model $model @return $this
[ "Set", "a", "model", "instance", "for", "the", "model", "being", "queried", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L1265-L1272
train
Set the model to use for the query
[ 30522, 2270, 3853, 2275, 5302, 9247, 1006, 2944, 1002, 2944, 1007, 1063, 1002, 2023, 1011, 1028, 2944, 1027, 1002, 2944, 1025, 1002, 2023, 1011, 1028, 23032, 1011, 1028, 2013, 1006, 1002, 2944, 1011, 1028, 2131, 10880, 1006, 1007, 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...
symfony/symfony
src/Symfony/Component/HttpKernel/Kernel.php
Kernel.locateResource
public function locateResource($name, $dir = null, $first = true) { if ('@' !== $name[0]) { throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); } if (false !== strpos($name, '..')) { throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); } $bundleName = substr($name, 1); $path = ''; if (false !== strpos($bundleName, '/')) { list($bundleName, $path) = explode('/', $bundleName, 2); } $isResource = 0 === strpos($path, 'Resources') && null !== $dir; $overridePath = substr($path, 9); $bundle = $this->getBundle($bundleName); $files = []; if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { $files[] = $file; } if (file_exists($file = $bundle->getPath().'/'.$path)) { if ($first && !$isResource) { return $file; } $files[] = $file; } if (\count($files) > 0) { return $first && $isResource ? $files[0] : $files; } throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); }
php
public function locateResource($name, $dir = null, $first = true) { if ('@' !== $name[0]) { throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); } if (false !== strpos($name, '..')) { throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); } $bundleName = substr($name, 1); $path = ''; if (false !== strpos($bundleName, '/')) { list($bundleName, $path) = explode('/', $bundleName, 2); } $isResource = 0 === strpos($path, 'Resources') && null !== $dir; $overridePath = substr($path, 9); $bundle = $this->getBundle($bundleName); $files = []; if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { $files[] = $file; } if (file_exists($file = $bundle->getPath().'/'.$path)) { if ($first && !$isResource) { return $file; } $files[] = $file; } if (\count($files) > 0) { return $first && $isResource ? $files[0] : $files; } throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); }
[ "public", "function", "locateResource", "(", "$", "name", ",", "$", "dir", "=", "null", ",", "$", "first", "=", "true", ")", "{", "if", "(", "'@'", "!==", "$", "name", "[", "0", "]", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", ...
{@inheritdoc} @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L242-L279
train
Locates a resource file
[ 30522, 2270, 3853, 12453, 6072, 8162, 3401, 1006, 1002, 2171, 1010, 1002, 16101, 1027, 19701, 1010, 1002, 2034, 1027, 2995, 1007, 1063, 2065, 1006, 1005, 1030, 1005, 999, 1027, 1027, 1002, 2171, 1031, 1014, 1033, 1007, 1063, 5466, 2047, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/models/File.php
File.copyLocalToStorage
protected function copyLocalToStorage($localPath, $storagePath) { $disk = Storage::disk(Config::get('cms.storage.uploads.disk')); return $disk->put($storagePath, FileHelper::get($localPath), $this->isPublic() ? 'public' : null); }
php
protected function copyLocalToStorage($localPath, $storagePath) { $disk = Storage::disk(Config::get('cms.storage.uploads.disk')); return $disk->put($storagePath, FileHelper::get($localPath), $this->isPublic() ? 'public' : null); }
[ "protected", "function", "copyLocalToStorage", "(", "$", "localPath", ",", "$", "storagePath", ")", "{", "$", "disk", "=", "Storage", "::", "disk", "(", "Config", "::", "get", "(", "'cms.storage.uploads.disk'", ")", ")", ";", "return", "$", "disk", "->", "...
Copy the local file to Storage @return bool True on success, false on failure.
[ "Copy", "the", "local", "file", "to", "Storage" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/File.php#L109-L113
train
Copy local file to storage
[ 30522, 5123, 3853, 6100, 4135, 9289, 13122, 4263, 4270, 1006, 1002, 2334, 15069, 1010, 1002, 5527, 15069, 1007, 1063, 1002, 9785, 1027, 5527, 1024, 1024, 9785, 1006, 9530, 8873, 2290, 1024, 1024, 2131, 1006, 1005, 4642, 2015, 1012, 5527, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Worker.php
Worker.forkOneWorkerForLinux
protected static function forkOneWorkerForLinux($worker) { // Get available worker id. $id = static::getId($worker->workerId, 0); if ($id === false) { return; } $pid = pcntl_fork(); // For master process. if ($pid > 0) { static::$_pidMap[$worker->workerId][$pid] = $pid; static::$_idMap[$worker->workerId][$id] = $pid; } // For child processes. elseif (0 === $pid) { srand(); mt_srand(); if ($worker->reusePort) { $worker->listen(); } if (static::$_status === static::STATUS_STARTING) { static::resetStd(); } static::$_pidMap = array(); // Remove other listener. foreach(static::$_workers as $key => $one_worker) { if ($one_worker->workerId !== $worker->workerId) { $one_worker->unlisten(); unset(static::$_workers[$key]); } } Timer::delAll(); static::setProcessTitle('WorkerMan: worker process ' . $worker->name . ' ' . $worker->getSocketName()); $worker->setUserAndGroup(); $worker->id = $id; $worker->run(); $err = new Exception('event-loop exited'); static::log($err); exit(250); } else { throw new Exception("forkOneWorker fail"); } }
php
protected static function forkOneWorkerForLinux($worker) { // Get available worker id. $id = static::getId($worker->workerId, 0); if ($id === false) { return; } $pid = pcntl_fork(); // For master process. if ($pid > 0) { static::$_pidMap[$worker->workerId][$pid] = $pid; static::$_idMap[$worker->workerId][$id] = $pid; } // For child processes. elseif (0 === $pid) { srand(); mt_srand(); if ($worker->reusePort) { $worker->listen(); } if (static::$_status === static::STATUS_STARTING) { static::resetStd(); } static::$_pidMap = array(); // Remove other listener. foreach(static::$_workers as $key => $one_worker) { if ($one_worker->workerId !== $worker->workerId) { $one_worker->unlisten(); unset(static::$_workers[$key]); } } Timer::delAll(); static::setProcessTitle('WorkerMan: worker process ' . $worker->name . ' ' . $worker->getSocketName()); $worker->setUserAndGroup(); $worker->id = $id; $worker->run(); $err = new Exception('event-loop exited'); static::log($err); exit(250); } else { throw new Exception("forkOneWorker fail"); } }
[ "protected", "static", "function", "forkOneWorkerForLinux", "(", "$", "worker", ")", "{", "// Get available worker id.", "$", "id", "=", "static", "::", "getId", "(", "$", "worker", "->", "workerId", ",", "0", ")", ";", "if", "(", "$", "id", "===", "false"...
Fork one worker process. @param \Workerman\Worker $worker @throws Exception
[ "Fork", "one", "worker", "process", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1454-L1495
train
Fork one worker for linux
[ 30522, 5123, 10763, 3853, 9292, 5643, 6198, 2121, 29278, 4115, 5602, 1006, 1002, 7309, 1007, 1063, 1013, 1013, 2131, 2800, 7309, 8909, 1012, 1002, 8909, 1027, 10763, 1024, 1024, 2131, 3593, 1006, 1002, 7309, 1011, 1028, 7309, 3593, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Descriptor/TextDescriptor.php
TextDescriptor.describeInputArgument
protected function describeInputArgument(InputArgument $argument, array $options = []) { if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault())); } else { $default = ''; } $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName()); $spacingWidth = $totalWidth - \strlen($argument->getName()); $this->writeText(sprintf(' <info>%s</info> %s%s%s', $argument->getName(), str_repeat(' ', $spacingWidth), // + 4 = 2 spaces before <info>, 2 spaces after </info> preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()), $default ), $options); }
php
protected function describeInputArgument(InputArgument $argument, array $options = []) { if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault())); } else { $default = ''; } $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName()); $spacingWidth = $totalWidth - \strlen($argument->getName()); $this->writeText(sprintf(' <info>%s</info> %s%s%s', $argument->getName(), str_repeat(' ', $spacingWidth), // + 4 = 2 spaces before <info>, 2 spaces after </info> preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()), $default ), $options); }
[ "protected", "function", "describeInputArgument", "(", "InputArgument", "$", "argument", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "null", "!==", "$", "argument", "->", "getDefault", "(", ")", "&&", "(", "!", "\\", "is_array", "("...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Descriptor/TextDescriptor.php#L34-L52
train
Describes an InputArgument
[ 30522, 5123, 3853, 6235, 2378, 18780, 2906, 22850, 4765, 1006, 7953, 2906, 22850, 4765, 1002, 6685, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 6685, 1011, 1028, 2131, 3207, 7011, 11314, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/ServiceProvider.php
ServiceProvider.registerAssetBundles
protected function registerAssetBundles() { CombineAssets::registerCallback(function ($combiner) { $combiner->registerBundle('~/modules/backend/assets/less/october.less'); $combiner->registerBundle('~/modules/backend/assets/js/october.js'); $combiner->registerBundle('~/modules/backend/widgets/table/assets/js/build.js'); $combiner->registerBundle('~/modules/backend/widgets/mediamanager/assets/js/mediamanager-browser.js'); $combiner->registerBundle('~/modules/backend/widgets/mediamanager/assets/less/mediamanager.less'); $combiner->registerBundle('~/modules/backend/formwidgets/codeeditor/assets/less/codeeditor.less'); $combiner->registerBundle('~/modules/backend/formwidgets/repeater/assets/less/repeater.less'); $combiner->registerBundle('~/modules/backend/formwidgets/codeeditor/assets/js/build.js'); $combiner->registerBundle('~/modules/backend/formwidgets/fileupload/assets/less/fileupload.less'); $combiner->registerBundle('~/modules/backend/formwidgets/nestedform/assets/less/nestedform.less'); /* * Rich Editor is protected by DRM */ if (file_exists(base_path('modules/backend/formwidgets/richeditor/assets/vendor/froala_drm'))) { $combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/less/richeditor.less'); $combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/js/build.js'); } }); }
php
protected function registerAssetBundles() { CombineAssets::registerCallback(function ($combiner) { $combiner->registerBundle('~/modules/backend/assets/less/october.less'); $combiner->registerBundle('~/modules/backend/assets/js/october.js'); $combiner->registerBundle('~/modules/backend/widgets/table/assets/js/build.js'); $combiner->registerBundle('~/modules/backend/widgets/mediamanager/assets/js/mediamanager-browser.js'); $combiner->registerBundle('~/modules/backend/widgets/mediamanager/assets/less/mediamanager.less'); $combiner->registerBundle('~/modules/backend/formwidgets/codeeditor/assets/less/codeeditor.less'); $combiner->registerBundle('~/modules/backend/formwidgets/repeater/assets/less/repeater.less'); $combiner->registerBundle('~/modules/backend/formwidgets/codeeditor/assets/js/build.js'); $combiner->registerBundle('~/modules/backend/formwidgets/fileupload/assets/less/fileupload.less'); $combiner->registerBundle('~/modules/backend/formwidgets/nestedform/assets/less/nestedform.less'); /* * Rich Editor is protected by DRM */ if (file_exists(base_path('modules/backend/formwidgets/richeditor/assets/vendor/froala_drm'))) { $combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/less/richeditor.less'); $combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/js/build.js'); } }); }
[ "protected", "function", "registerAssetBundles", "(", ")", "{", "CombineAssets", "::", "registerCallback", "(", "function", "(", "$", "combiner", ")", "{", "$", "combiner", "->", "registerBundle", "(", "'~/modules/backend/assets/less/october.less'", ")", ";", "$", "...
Register asset bundles
[ "Register", "asset", "bundles" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/ServiceProvider.php#L65-L87
train
Registers all asset bundles
[ 30522, 5123, 3853, 4236, 27241, 2102, 27265, 4244, 1006, 1007, 1063, 11506, 27241, 3215, 1024, 1024, 4236, 9289, 20850, 8684, 1006, 3853, 1006, 1002, 11506, 2099, 1007, 1063, 1002, 11506, 2099, 1011, 1028, 4236, 27265, 2571, 1006, 1005, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/LanguagesManager/TranslationWriter/Writer.php
Writer.isValid
public function isValid() { $this->applyFilters(); $this->validationMessage = null; foreach ($this->validators as $validator) { if (!$validator->isValid($this->translations)) { $this->validationMessage = $validator->getMessage(); return false; } } return true; }
php
public function isValid() { $this->applyFilters(); $this->validationMessage = null; foreach ($this->validators as $validator) { if (!$validator->isValid($this->translations)) { $this->validationMessage = $validator->getMessage(); return false; } } return true; }
[ "public", "function", "isValid", "(", ")", "{", "$", "this", "->", "applyFilters", "(", ")", ";", "$", "this", "->", "validationMessage", "=", "null", ";", "foreach", "(", "$", "this", "->", "validators", "as", "$", "validator", ")", "{", "if", "(", ...
Returns if translations are valid to save or not @return bool
[ "Returns", "if", "translations", "are", "valid", "to", "save", "or", "not" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/TranslationWriter/Writer.php#L294-L308
train
Returns true if all the rules pass validation
[ 30522, 2270, 3853, 2003, 10175, 3593, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 6611, 8873, 21928, 2015, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 27354, 7834, 3736, 3351, 1027, 19701, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 9398, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Helpers/Base32.php
Base32.encode
public static function encode($bytes) { $i = 0; $index = 0; $base32 = ''; $bytesLen = \strlen($bytes); while ($i < $bytesLen) { $currByte = \ord($bytes[$i]); /* Is the current digit going to span a byte boundary? */ if ($index > 3) { if (($i + 1) < $bytesLen) { $nextByte = \ord($bytes[$i+1]); } else { $nextByte = 0; } $digit = $currByte & (0xFF >> $index); $index = ($index + 5) % 8; $digit <<= $index; $digit |= $nextByte >> (8 - $index); $i++; } else { $digit = ($currByte >> (8 - ($index + 5))) & 0x1F; $index = ($index + 5) % 8; if ($index === 0) { $i++; } } $base32 .= self::$base32Chars[$digit]; } return $base32; }
php
public static function encode($bytes) { $i = 0; $index = 0; $base32 = ''; $bytesLen = \strlen($bytes); while ($i < $bytesLen) { $currByte = \ord($bytes[$i]); /* Is the current digit going to span a byte boundary? */ if ($index > 3) { if (($i + 1) < $bytesLen) { $nextByte = \ord($bytes[$i+1]); } else { $nextByte = 0; } $digit = $currByte & (0xFF >> $index); $index = ($index + 5) % 8; $digit <<= $index; $digit |= $nextByte >> (8 - $index); $i++; } else { $digit = ($currByte >> (8 - ($index + 5))) & 0x1F; $index = ($index + 5) % 8; if ($index === 0) { $i++; } } $base32 .= self::$base32Chars[$digit]; } return $base32; }
[ "public", "static", "function", "encode", "(", "$", "bytes", ")", "{", "$", "i", "=", "0", ";", "$", "index", "=", "0", ";", "$", "base32", "=", "''", ";", "$", "bytesLen", "=", "\\", "strlen", "(", "$", "bytes", ")", ";", "while", "(", "$", ...
Encode in Base32 @param string $bytes @return string
[ "Encode", "in", "Base32" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Base32.php#L34-L67
train
Encode the bytes into a base32 string
[ 30522, 2270, 10763, 3853, 4372, 16044, 1006, 1002, 27507, 1007, 1063, 1002, 1045, 1027, 1014, 1025, 1002, 5950, 1027, 1014, 1025, 1002, 2918, 16703, 1027, 1005, 1005, 1025, 1002, 27507, 7770, 1027, 1032, 2358, 20927, 2078, 1006, 1002, 27507...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/ViewDataTable/Manager.php
Manager.getNonCoreViewDataTables
public static function getNonCoreViewDataTables() { $result = array(); foreach (static::getAvailableViewDataTables() as $vizId => $vizClass) { if (false === strpos($vizClass, 'Piwik\\Plugins\\CoreVisualizations') && false === strpos($vizClass, 'Piwik\\Plugins\\Goals\\Visualizations\\Goals')) { $result[$vizId] = $vizClass; } } return $result; }
php
public static function getNonCoreViewDataTables() { $result = array(); foreach (static::getAvailableViewDataTables() as $vizId => $vizClass) { if (false === strpos($vizClass, 'Piwik\\Plugins\\CoreVisualizations') && false === strpos($vizClass, 'Piwik\\Plugins\\Goals\\Visualizations\\Goals')) { $result[$vizId] = $vizClass; } } return $result; }
[ "public", "static", "function", "getNonCoreViewDataTables", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "static", "::", "getAvailableViewDataTables", "(", ")", "as", "$", "vizId", "=>", "$", "vizClass", ")", "{", "if", "(", ...
Returns all available visualizations that are not part of the CoreVisualizations plugin. @return array Array mapping visualization IDs with their associated visualization classes.
[ "Returns", "all", "available", "visualizations", "that", "are", "not", "part", "of", "the", "CoreVisualizations", "plugin", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Manager.php#L129-L141
train
Returns an array of all available view types that don t belong to the core visualizations
[ 30522, 2270, 10763, 3853, 2131, 8540, 17345, 8584, 2850, 29336, 3085, 2015, 1006, 1007, 1063, 1002, 2765, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 10763, 1024, 1024, 2131, 12462, 11733, 3468, 8584, 2850, 29336, 3085, 2015, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Helper/Optimizer/ConjugateGradient.php
ConjugateGradient.getAlpha
protected function getAlpha(array $d): float { $small = MP::muls($d, 0.0001); $large = MP::muls($d, 0.01); // Obtain θ + α.d for two initial values, x0 and x1 $x0 = MP::add($this->theta, $small); $x1 = MP::add($this->theta, $large); $epsilon = 0.0001; $iteration = 0; do { $fx1 = $this->cost($x1); $fx0 = $this->cost($x0); // If the difference between two values is small enough // then break the loop if (abs($fx1 - $fx0) <= $epsilon) { break; } if ($fx1 < $fx0) { $x0 = $x1; $x1 = MP::adds($x1, 0.01); // Enlarge second } else { $x1 = MP::divs(MP::add($x1, $x0), 2.0); } // Get to the midpoint $error = $fx1 / $this->dimensions; } while ($error <= $epsilon || $iteration++ < 10); // Return α = θ / d // For accuracy, choose a dimension which maximize |d[i]| $imax = 0; for ($i = 1; $i <= $this->dimensions; ++$i) { if (abs($d[$i]) > abs($d[$imax])) { $imax = $i; } } if ($d[$imax] == 0) { return $x1[$imax] - $this->theta[$imax]; } return ($x1[$imax] - $this->theta[$imax]) / $d[$imax]; }
php
protected function getAlpha(array $d): float { $small = MP::muls($d, 0.0001); $large = MP::muls($d, 0.01); // Obtain θ + α.d for two initial values, x0 and x1 $x0 = MP::add($this->theta, $small); $x1 = MP::add($this->theta, $large); $epsilon = 0.0001; $iteration = 0; do { $fx1 = $this->cost($x1); $fx0 = $this->cost($x0); // If the difference between two values is small enough // then break the loop if (abs($fx1 - $fx0) <= $epsilon) { break; } if ($fx1 < $fx0) { $x0 = $x1; $x1 = MP::adds($x1, 0.01); // Enlarge second } else { $x1 = MP::divs(MP::add($x1, $x0), 2.0); } // Get to the midpoint $error = $fx1 / $this->dimensions; } while ($error <= $epsilon || $iteration++ < 10); // Return α = θ / d // For accuracy, choose a dimension which maximize |d[i]| $imax = 0; for ($i = 1; $i <= $this->dimensions; ++$i) { if (abs($d[$i]) > abs($d[$imax])) { $imax = $i; } } if ($d[$imax] == 0) { return $x1[$imax] - $this->theta[$imax]; } return ($x1[$imax] - $this->theta[$imax]) / $d[$imax]; }
[ "protected", "function", "getAlpha", "(", "array", "$", "d", ")", ":", "float", "{", "$", "small", "=", "MP", "::", "muls", "(", "$", "d", ",", "0.0001", ")", ";", "$", "large", "=", "MP", "::", "muls", "(", "$", "d", ",", "0.01", ")", ";", "...
Calculates alpha that minimizes the function f(θ + α.d) by performing a line search that does not rely upon the derivation. There are several alternatives for this function. For now, we prefer a method inspired from the bisection method for its simplicity. This algorithm attempts to find an optimum alpha value between 0.0001 and 0.01 Algorithm as follows: a) Probe a small alpha (0.0001) and calculate cost function b) Probe a larger alpha (0.01) and calculate cost function b-1) If cost function decreases, continue enlarging alpha b-2) If cost function increases, take the midpoint and try again
[ "Calculates", "alpha", "that", "minimizes", "the", "function", "f", "(", "θ", "+", "α", ".", "d", ")", "by", "performing", "a", "line", "search", "that", "does", "not", "rely", "upon", "the", "derivation", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Helper/Optimizer/ConjugateGradient.php#L111-L156
train
Return the alpha value of the matrix
[ 30522, 5123, 3853, 2131, 2389, 21890, 1006, 9140, 1002, 1040, 1007, 1024, 14257, 1063, 1002, 2235, 1027, 6131, 1024, 1024, 14163, 4877, 1006, 1002, 1040, 1010, 1014, 1012, 2199, 2487, 1007, 1025, 1002, 2312, 1027, 6131, 1024, 1024, 14163, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
CompiledUrlMatcherDumper.compileStaticRoutes
private function compileStaticRoutes(array $staticRoutes, array &$conditions): array { if (!$staticRoutes) { return []; } $compiledRoutes = []; foreach ($staticRoutes as $url => $routes) { $compiledRoutes[$url] = []; foreach ($routes as $name => list($route, $hasTrailingSlash)) { $compiledRoutes[$url][] = $this->compileRoute($route, $name, (!$route->compile()->getHostVariables() ? $route->getHost() : $route->compile()->getHostRegex()) ?: null, $hasTrailingSlash, false, $conditions); } } return $compiledRoutes; }
php
private function compileStaticRoutes(array $staticRoutes, array &$conditions): array { if (!$staticRoutes) { return []; } $compiledRoutes = []; foreach ($staticRoutes as $url => $routes) { $compiledRoutes[$url] = []; foreach ($routes as $name => list($route, $hasTrailingSlash)) { $compiledRoutes[$url][] = $this->compileRoute($route, $name, (!$route->compile()->getHostVariables() ? $route->getHost() : $route->compile()->getHostRegex()) ?: null, $hasTrailingSlash, false, $conditions); } } return $compiledRoutes; }
[ "private", "function", "compileStaticRoutes", "(", "array", "$", "staticRoutes", ",", "array", "&", "$", "conditions", ")", ":", "array", "{", "if", "(", "!", "$", "staticRoutes", ")", "{", "return", "[", "]", ";", "}", "$", "compiledRoutes", "=", "[", ...
Compiles static routes in a switch statement. Condition-less paths are put in a static array in the switch's default, with generic matching logic. Paths that can match two or more routes, or have user-specified conditions are put in separate switch's cases. @throws \LogicException
[ "Compiles", "static", "routes", "in", "a", "switch", "statement", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php#L215-L230
train
Compiles static routes into array of static routes
[ 30522, 2797, 3853, 4012, 22090, 16677, 22494, 4570, 1006, 9140, 1002, 10763, 22494, 4570, 1010, 9140, 1004, 1002, 3785, 1007, 1024, 9140, 1063, 2065, 1006, 999, 1002, 10763, 22494, 4570, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 1002, 9227,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...