id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
201,100
freddieannobil/doo-pagination
src/DooPagination.php
DooPagination.next
public function next($html, $html2 = '') { # Only show if you are not on the last page $r = ($this->get < $this->pages()) ? str_replace('{nr}', $this->get + 1, $html) : str_replace('{nr}', $this->get + 1, $html2); return $r; }
php
public function next($html, $html2 = '') { # Only show if you are not on the last page $r = ($this->get < $this->pages()) ? str_replace('{nr}', $this->get + 1, $html) : str_replace('{nr}', $this->get + 1, $html2); return $r; }
[ "public", "function", "next", "(", "$", "html", ",", "$", "html2", "=", "''", ")", "{", "# Only show if you are not on the last page", "$", "r", "=", "(", "$", "this", "->", "get", "<", "$", "this", "->", "pages", "(", ")", ")", "?", "str_replace", "("...
This shows the 'next' link with custom html @param string $html The HTML you wish to use to display the link @return string The Same HTML replaced the tags with the proper number
[ "This", "shows", "the", "next", "link", "with", "custom", "html" ]
7f638c5647585386a71190610592249fd7f735de
https://github.com/freddieannobil/doo-pagination/blob/7f638c5647585386a71190610592249fd7f735de/src/DooPagination.php#L138-L144
201,101
freddieannobil/doo-pagination
src/DooPagination.php
DooPagination.last
public function last($html, $html2 = '') { # Only show if you are not on the last page $r = ($this->get < $this->pages()) ? str_replace('{nr}', $this->pages(), $html) : str_replace('{nr}', $this->pages(), $html2); return $r; }
php
public function last($html, $html2 = '') { # Only show if you are not on the last page $r = ($this->get < $this->pages()) ? str_replace('{nr}', $this->pages(), $html) : str_replace('{nr}', $this->pages(), $html2); return $r; }
[ "public", "function", "last", "(", "$", "html", ",", "$", "html2", "=", "''", ")", "{", "# Only show if you are not on the last page", "$", "r", "=", "(", "$", "this", "->", "get", "<", "$", "this", "->", "pages", "(", ")", ")", "?", "str_replace", "("...
This shows the 'last' link with custom html @param string $html The HTML you wish to use to display the link @return string The Same HTML replaced the tags with the proper number
[ "This", "shows", "the", "last", "link", "with", "custom", "html" ]
7f638c5647585386a71190610592249fd7f735de
https://github.com/freddieannobil/doo-pagination/blob/7f638c5647585386a71190610592249fd7f735de/src/DooPagination.php#L151-L157
201,102
freddieannobil/doo-pagination
src/DooPagination.php
DooPagination.numbers
public function numbers($link, $current, $reversed = false) { $r = ''; $range = floor(($this->max_items - 1) / 2); if (!$this->max_items) { $page_nums = range(1, $this->pages()); } else { $lower_limit = max($this->get - $range, 1); $upper_limit = m...
php
public function numbers($link, $current, $reversed = false) { $r = ''; $range = floor(($this->max_items - 1) / 2); if (!$this->max_items) { $page_nums = range(1, $this->pages()); } else { $lower_limit = max($this->get - $range, 1); $upper_limit = m...
[ "public", "function", "numbers", "(", "$", "link", ",", "$", "current", ",", "$", "reversed", "=", "false", ")", "{", "$", "r", "=", "''", ";", "$", "range", "=", "floor", "(", "(", "$", "this", "->", "max_items", "-", "1", ")", "/", "2", ")", ...
This shows an loop of 'numbers' with their appropriate link in custom html @param string $link The HTML to display a number with a link @param string $current The HTML to display a the current page number without a link @param string $reversed Optional Parameter, set to true if you want the numbers reversed (align to r...
[ "This", "shows", "an", "loop", "of", "numbers", "with", "their", "appropriate", "link", "in", "custom", "html" ]
7f638c5647585386a71190610592249fd7f735de
https://github.com/freddieannobil/doo-pagination/blob/7f638c5647585386a71190610592249fd7f735de/src/DooPagination.php#L166-L190
201,103
tuanlq11/dbi18n
src/I18NDBTrait.php
I18NDBTrait.saveI18N
public function saveI18N() { if (empty($this->i18n_data)) return; $this->i18n_relation()->getQuery()->whereIn($this->getI18NCodeField(), array_keys($this->i18n_data))->delete(); foreach ($this->i18n_data as $locale => $data) { $obj = new $this->i18n_cl...
php
public function saveI18N() { if (empty($this->i18n_data)) return; $this->i18n_relation()->getQuery()->whereIn($this->getI18NCodeField(), array_keys($this->i18n_data))->delete(); foreach ($this->i18n_data as $locale => $data) { $obj = new $this->i18n_cl...
[ "public", "function", "saveI18N", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "i18n_data", ")", ")", "return", ";", "$", "this", "->", "i18n_relation", "(", ")", "->", "getQuery", "(", ")", "->", "whereIn", "(", "$", "this", "->", "g...
Store I18N to database
[ "Store", "I18N", "to", "database" ]
56d01eceae043f2770e01b92e7bcc7e52a5047e7
https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NDBTrait.php#L59-L69
201,104
tuanlq11/dbi18n
src/I18NDBTrait.php
I18NDBTrait.filterI18NColumn
public function filterI18NColumn() { $overrideData = array_only($this->attributes, $this->i18n_fillable); if (!empty($overrideData)) { $this->i18n_data[$this->i18n_default_locale] = $overrideData; foreach ($this->i18n_fillable as $key) { unset($this->$key); ...
php
public function filterI18NColumn() { $overrideData = array_only($this->attributes, $this->i18n_fillable); if (!empty($overrideData)) { $this->i18n_data[$this->i18n_default_locale] = $overrideData; foreach ($this->i18n_fillable as $key) { unset($this->$key); ...
[ "public", "function", "filterI18NColumn", "(", ")", "{", "$", "overrideData", "=", "array_only", "(", "$", "this", "->", "attributes", ",", "$", "this", "->", "i18n_fillable", ")", ";", "if", "(", "!", "empty", "(", "$", "overrideData", ")", ")", "{", ...
Filter & remove i18n column from attributes. Mean, is not save to model self.
[ "Filter", "&", "remove", "i18n", "column", "from", "attributes", ".", "Mean", "is", "not", "save", "to", "model", "self", "." ]
56d01eceae043f2770e01b92e7bcc7e52a5047e7
https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NDBTrait.php#L75-L89
201,105
tuanlq11/dbi18n
src/I18NDBTrait.php
I18NDBTrait.scopeI18N
public function scopeI18N($query, $locale = null) { $i18nTranAlias = "i18n_translation"; $i18nAlias = "i18n"; $primary = $this->primaryKey; $i18nPrimary = $this->i18n_primary; $table = $this->table; $i18n_table = (new $this->i18n_class())->getTa...
php
public function scopeI18N($query, $locale = null) { $i18nTranAlias = "i18n_translation"; $i18nAlias = "i18n"; $primary = $this->primaryKey; $i18nPrimary = $this->i18n_primary; $table = $this->table; $i18n_table = (new $this->i18n_class())->getTa...
[ "public", "function", "scopeI18N", "(", "$", "query", ",", "$", "locale", "=", "null", ")", "{", "$", "i18nTranAlias", "=", "\"i18n_translation\"", ";", "$", "i18nAlias", "=", "\"i18n\"", ";", "$", "primary", "=", "$", "this", "->", "primaryKey", ";", "$...
Join I18N data to this @param $query Builder @param $locale string|null @return Builder
[ "Join", "I18N", "data", "to", "this" ]
56d01eceae043f2770e01b92e7bcc7e52a5047e7
https://github.com/tuanlq11/dbi18n/blob/56d01eceae043f2770e01b92e7bcc7e52a5047e7/src/I18NDBTrait.php#L123-L147
201,106
ARCANESOFT/Auth
src/Seeds/PermissionsSeeder.php
PermissionsSeeder.seed
public function seed(array $seeds) { foreach ($seeds as $seed) { /** @var \Arcanesoft\Auth\Models\PermissionsGroup $group */ $group = PermissionsGroup::create($seed['group']); $permissions = array_map(function ($permission) { return new Permission(...
php
public function seed(array $seeds) { foreach ($seeds as $seed) { /** @var \Arcanesoft\Auth\Models\PermissionsGroup $group */ $group = PermissionsGroup::create($seed['group']); $permissions = array_map(function ($permission) { return new Permission(...
[ "public", "function", "seed", "(", "array", "$", "seeds", ")", "{", "foreach", "(", "$", "seeds", "as", "$", "seed", ")", "{", "/** @var \\Arcanesoft\\Auth\\Models\\PermissionsGroup $group */", "$", "group", "=", "PermissionsGroup", "::", "create", "(", "$", "...
Seed permissions. @param array $seeds
[ "Seed", "permissions", "." ]
b33ca82597a76b1e395071f71ae3e51f1ec67e62
https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Seeds/PermissionsSeeder.php#L25-L36
201,107
solid-framework/core
src/Config/Config.php
Config.get
public function get(string $settingsField = null, $default = null) { // if no settings field was given return all settings if (is_null($settingsField)) { return $this->settings; } $setting = $this->settings; foreach (explode('.', $settingsField) as $field) { ...
php
public function get(string $settingsField = null, $default = null) { // if no settings field was given return all settings if (is_null($settingsField)) { return $this->settings; } $setting = $this->settings; foreach (explode('.', $settingsField) as $field) { ...
[ "public", "function", "get", "(", "string", "$", "settingsField", "=", "null", ",", "$", "default", "=", "null", ")", "{", "// if no settings field was given return all settings", "if", "(", "is_null", "(", "$", "settingsField", ")", ")", "{", "return", "$", "...
Returns the given settings field if set or the default value Note: If no settings field is given all settings are returned. @api @since 0.1.0 @param string $settingsField The settings field to retrieve. @param mixed $default The default value to use. @return mixed
[ "Returns", "the", "given", "settings", "field", "if", "set", "or", "the", "default", "value" ]
418e78fc4c630c35a147832615adda0336271569
https://github.com/solid-framework/core/blob/418e78fc4c630c35a147832615adda0336271569/src/Config/Config.php#L79-L97
201,108
solid-framework/core
src/Config/Config.php
Config.merge
public function merge(array $settings, string $field = null, bool $mergeArrays = false) { $merged = self::mergeSettings($this->get($field), $settings, $mergeArrays); if (!is_null($field)) { $this->put($field, $merged); } else { $this->set($merged); } }
php
public function merge(array $settings, string $field = null, bool $mergeArrays = false) { $merged = self::mergeSettings($this->get($field), $settings, $mergeArrays); if (!is_null($field)) { $this->put($field, $merged); } else { $this->set($merged); } }
[ "public", "function", "merge", "(", "array", "$", "settings", ",", "string", "$", "field", "=", "null", ",", "bool", "$", "mergeArrays", "=", "false", ")", "{", "$", "merged", "=", "self", "::", "mergeSettings", "(", "$", "this", "->", "get", "(", "$...
Merges the given settings into the given field @api @since 0.1.0 @param array $settings The settings to merge into the given field. @param string|null $field The field to merge the given settings into. @param bool $mergeArrays Whether to merge indexed arrays. @return void
[ "Merges", "the", "given", "settings", "into", "the", "given", "field" ]
418e78fc4c630c35a147832615adda0336271569
https://github.com/solid-framework/core/blob/418e78fc4c630c35a147832615adda0336271569/src/Config/Config.php#L137-L146
201,109
solid-framework/core
src/Config/Config.php
Config.mergeSettings
private static function mergeSettings(array $a, array $b, $mergeArrays = false): array { foreach ($b as $key => $value) { if (array_key_exists($key, $a)) { if (self::isAssoc($a[$key]) && self::isAssoc($b[$key])) { $a[$key] = self::mergeSettings( ...
php
private static function mergeSettings(array $a, array $b, $mergeArrays = false): array { foreach ($b as $key => $value) { if (array_key_exists($key, $a)) { if (self::isAssoc($a[$key]) && self::isAssoc($b[$key])) { $a[$key] = self::mergeSettings( ...
[ "private", "static", "function", "mergeSettings", "(", "array", "$", "a", ",", "array", "$", "b", ",", "$", "mergeArrays", "=", "false", ")", ":", "array", "{", "foreach", "(", "$", "b", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", ...
Recursively merges the two given arrays giving priority to the second @internal @since 0.1.0 @param array $a The array to merge in the second array into. @param array $b The array to merge into the first array. @param bool $mergeArrays Whether to merge indexed arrays. @return array
[ "Recursively", "merges", "the", "two", "given", "arrays", "giving", "priority", "to", "the", "second" ]
418e78fc4c630c35a147832615adda0336271569
https://github.com/solid-framework/core/blob/418e78fc4c630c35a147832615adda0336271569/src/Config/Config.php#L158-L179
201,110
FlexModel/FlexModel
src/FlexModel.php
FlexModel.load
public function load(DOMDocument $domDocument, $cachePath, $xmlSchemaFile = null) { $this->domDocument = $domDocument; $this->cachePath = $cachePath; if (isset($xmlSchemaFile)) { $this->xmlSchemaFile = $xmlSchemaFile; } $this->loadConfiguration(); }
php
public function load(DOMDocument $domDocument, $cachePath, $xmlSchemaFile = null) { $this->domDocument = $domDocument; $this->cachePath = $cachePath; if (isset($xmlSchemaFile)) { $this->xmlSchemaFile = $xmlSchemaFile; } $this->loadConfiguration(); }
[ "public", "function", "load", "(", "DOMDocument", "$", "domDocument", ",", "$", "cachePath", ",", "$", "xmlSchemaFile", "=", "null", ")", "{", "$", "this", "->", "domDocument", "=", "$", "domDocument", ";", "$", "this", "->", "cachePath", "=", "$", "cach...
Loads the XML configuration. @param DOMDocument $domDocument @param string $cachePath @param string|null $xmlSchemaFile
[ "Loads", "the", "XML", "configuration", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L88-L97
201,111
FlexModel/FlexModel
src/FlexModel.php
FlexModel.reload
public function reload() { $this->configuration = null; $this->load($this->domDocument, $this->cachePath, $this->xmlSchemaFile); }
php
public function reload() { $this->configuration = null; $this->load($this->domDocument, $this->cachePath, $this->xmlSchemaFile); }
[ "public", "function", "reload", "(", ")", "{", "$", "this", "->", "configuration", "=", "null", ";", "$", "this", "->", "load", "(", "$", "this", "->", "domDocument", ",", "$", "this", "->", "cachePath", ",", "$", "this", "->", "xmlSchemaFile", ")", ...
Reloads the configuration.
[ "Reloads", "the", "configuration", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L102-L107
201,112
FlexModel/FlexModel
src/FlexModel.php
FlexModel.hasField
public function hasField($objectName, $fieldName) { $field = $this->getField($objectName, $fieldName); return is_array($field); }
php
public function hasField($objectName, $fieldName) { $field = $this->getField($objectName, $fieldName); return is_array($field); }
[ "public", "function", "hasField", "(", "$", "objectName", ",", "$", "fieldName", ")", "{", "$", "field", "=", "$", "this", "->", "getField", "(", "$", "objectName", ",", "$", "fieldName", ")", ";", "return", "is_array", "(", "$", "field", ")", ";", "...
Returns true when the configuration of an object contains the specified field name. @param string $objectName @param string $fieldName @return bool
[ "Returns", "true", "when", "the", "configuration", "of", "an", "object", "contains", "the", "specified", "field", "name", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L163-L168
201,113
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getObjectNames
public function getObjectNames() { $objectNames = array(); if (is_array($this->configuration)) { $objectNames = array_keys($this->configuration); } return $objectNames; }
php
public function getObjectNames() { $objectNames = array(); if (is_array($this->configuration)) { $objectNames = array_keys($this->configuration); } return $objectNames; }
[ "public", "function", "getObjectNames", "(", ")", "{", "$", "objectNames", "=", "array", "(", ")", ";", "if", "(", "is_array", "(", "$", "this", "->", "configuration", ")", ")", "{", "$", "objectNames", "=", "array_keys", "(", "$", "this", "->", "confi...
Returns all configured object names. @return array
[ "Returns", "all", "configured", "object", "names", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L187-L195
201,114
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getModelConfiguration
public function getModelConfiguration($objectName) { if (isset($this->configuration[$objectName])) { $modelConfiguration = $this->configuration[$objectName]; $modelConfiguration['__object_name'] = $objectName; if (isset($modelConfiguration['fields']) === false) { ...
php
public function getModelConfiguration($objectName) { if (isset($this->configuration[$objectName])) { $modelConfiguration = $this->configuration[$objectName]; $modelConfiguration['__object_name'] = $objectName; if (isset($modelConfiguration['fields']) === false) { ...
[ "public", "function", "getModelConfiguration", "(", "$", "objectName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "configuration", "[", "$", "objectName", "]", ")", ")", "{", "$", "modelConfiguration", "=", "$", "this", "->", "configuration", "[...
Returns the model for the specified object. @param string $objectName @return array|null
[ "Returns", "the", "model", "for", "the", "specified", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L204-L215
201,115
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getFormConfiguration
public function getFormConfiguration($objectName, $formName) { $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['forms'][$formName])) { $formConfiguration = $modelConfiguration['forms'][$formName]; foreach ($formConfiguration['fie...
php
public function getFormConfiguration($objectName, $formName) { $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['forms'][$formName])) { $formConfiguration = $modelConfiguration['forms'][$formName]; foreach ($formConfiguration['fie...
[ "public", "function", "getFormConfiguration", "(", "$", "objectName", ",", "$", "formName", ")", "{", "$", "modelConfiguration", "=", "$", "this", "->", "getModelConfiguration", "(", "$", "objectName", ")", ";", "if", "(", "isset", "(", "$", "modelConfiguratio...
Returns field configuration of the specified form in the object. @param string $objectName @param string $formName @return array
[ "Returns", "field", "configuration", "of", "the", "specified", "form", "in", "the", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L225-L241
201,116
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getViewConfiguration
public function getViewConfiguration($objectName, $viewName) { $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['views'][$viewName])) { $viewConfiguration = $modelConfiguration['views'][$viewName]; if (isset($viewConfiguration['fi...
php
public function getViewConfiguration($objectName, $viewName) { $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['views'][$viewName])) { $viewConfiguration = $modelConfiguration['views'][$viewName]; if (isset($viewConfiguration['fi...
[ "public", "function", "getViewConfiguration", "(", "$", "objectName", ",", "$", "viewName", ")", "{", "$", "modelConfiguration", "=", "$", "this", "->", "getModelConfiguration", "(", "$", "objectName", ")", ";", "if", "(", "isset", "(", "$", "modelConfiguratio...
Returns field configuration of the specified view in the object. @param string $objectName @param string $viewName @return array|null
[ "Returns", "field", "configuration", "of", "the", "specified", "view", "in", "the", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L251-L270
201,117
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getViewConfigurationsByViewgroupOfView
public function getViewConfigurationsByViewgroupOfView($objectName, $viewName) { $viewConfigurations = array(); $modelConfiguration = $this->getModelConfiguration($objectName); $viewConfiguration = $this->getViewConfiguration($objectName, $viewName); if (isset($viewConfiguration['vi...
php
public function getViewConfigurationsByViewgroupOfView($objectName, $viewName) { $viewConfigurations = array(); $modelConfiguration = $this->getModelConfiguration($objectName); $viewConfiguration = $this->getViewConfiguration($objectName, $viewName); if (isset($viewConfiguration['vi...
[ "public", "function", "getViewConfigurationsByViewgroupOfView", "(", "$", "objectName", ",", "$", "viewName", ")", "{", "$", "viewConfigurations", "=", "array", "(", ")", ";", "$", "modelConfiguration", "=", "$", "this", "->", "getModelConfiguration", "(", "$", ...
Returns all the field configurations of views in the viewgroup of the specified view name. @param string $objectName @param string $viewName @return array
[ "Returns", "all", "the", "field", "configurations", "of", "views", "in", "the", "viewgroup", "of", "the", "specified", "view", "name", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L280-L296
201,118
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getFieldNames
public function getFieldNames($objectName) { $fieldNames = array(); $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['__field_index'])) { $fieldNames = array_keys($modelConfiguration['__field_index']); } return $field...
php
public function getFieldNames($objectName) { $fieldNames = array(); $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['__field_index'])) { $fieldNames = array_keys($modelConfiguration['__field_index']); } return $field...
[ "public", "function", "getFieldNames", "(", "$", "objectName", ")", "{", "$", "fieldNames", "=", "array", "(", ")", ";", "$", "modelConfiguration", "=", "$", "this", "->", "getModelConfiguration", "(", "$", "objectName", ")", ";", "if", "(", "isset", "(", ...
Returns the field names of the specified object. @return array
[ "Returns", "the", "field", "names", "of", "the", "specified", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L303-L312
201,119
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getFieldNamesByView
public function getFieldNamesByView($objectName, $viewName) { $fieldNames = array(); $fieldConfigurations = $this->getFieldsByView($objectName, $viewName); foreach ($fieldConfigurations as $fieldConfiguration) { array_push($fieldNames, $fieldConfiguration['name']); } ...
php
public function getFieldNamesByView($objectName, $viewName) { $fieldNames = array(); $fieldConfigurations = $this->getFieldsByView($objectName, $viewName); foreach ($fieldConfigurations as $fieldConfiguration) { array_push($fieldNames, $fieldConfiguration['name']); } ...
[ "public", "function", "getFieldNamesByView", "(", "$", "objectName", ",", "$", "viewName", ")", "{", "$", "fieldNames", "=", "array", "(", ")", ";", "$", "fieldConfigurations", "=", "$", "this", "->", "getFieldsByView", "(", "$", "objectName", ",", "$", "v...
Returns the field names of the specified view in the object. @param string $objectName @param string $viewName @return array
[ "Returns", "the", "field", "names", "of", "the", "specified", "view", "in", "the", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L322-L331
201,120
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getFields
public function getFields($objectName) { $fieldConfigurations = array(); $modelConfiguration = $this->getModelConfiguration($objectName); if (is_array($modelConfiguration)) { $fieldConfigurations = $modelConfiguration['fields']; } return $fieldConfigurations; ...
php
public function getFields($objectName) { $fieldConfigurations = array(); $modelConfiguration = $this->getModelConfiguration($objectName); if (is_array($modelConfiguration)) { $fieldConfigurations = $modelConfiguration['fields']; } return $fieldConfigurations; ...
[ "public", "function", "getFields", "(", "$", "objectName", ")", "{", "$", "fieldConfigurations", "=", "array", "(", ")", ";", "$", "modelConfiguration", "=", "$", "this", "->", "getModelConfiguration", "(", "$", "objectName", ")", ";", "if", "(", "is_array",...
Returns all fields for the object. @param string $objectName @return array
[ "Returns", "all", "fields", "for", "the", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L340-L349
201,121
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getFieldsByDatatype
public function getFieldsByDatatype($objectName, $datatype) { $datatypeFieldConfigurations = array(); $fieldConfigurations = $this->getFields($objectName); foreach ($fieldConfigurations as $fieldConfiguration) { if ($fieldConfiguration['datatype'] == $datatype) { ...
php
public function getFieldsByDatatype($objectName, $datatype) { $datatypeFieldConfigurations = array(); $fieldConfigurations = $this->getFields($objectName); foreach ($fieldConfigurations as $fieldConfiguration) { if ($fieldConfiguration['datatype'] == $datatype) { ...
[ "public", "function", "getFieldsByDatatype", "(", "$", "objectName", ",", "$", "datatype", ")", "{", "$", "datatypeFieldConfigurations", "=", "array", "(", ")", ";", "$", "fieldConfigurations", "=", "$", "this", "->", "getFields", "(", "$", "objectName", ")", ...
Returns all fields with the specified datatype for an object. @param string $objectName @param string $datatype @return array
[ "Returns", "all", "fields", "with", "the", "specified", "datatype", "for", "an", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L359-L371
201,122
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getFieldsByView
public function getFieldsByView($objectName, $viewName) { $fieldConfigurations = array(); $viewConfiguration = $this->getViewConfiguration($objectName, $viewName); if (is_array($viewConfiguration)) { $fieldConfigurations = $viewConfiguration["fields"]; foreach ($fiel...
php
public function getFieldsByView($objectName, $viewName) { $fieldConfigurations = array(); $viewConfiguration = $this->getViewConfiguration($objectName, $viewName); if (is_array($viewConfiguration)) { $fieldConfigurations = $viewConfiguration["fields"]; foreach ($fiel...
[ "public", "function", "getFieldsByView", "(", "$", "objectName", ",", "$", "viewName", ")", "{", "$", "fieldConfigurations", "=", "array", "(", ")", ";", "$", "viewConfiguration", "=", "$", "this", "->", "getViewConfiguration", "(", "$", "objectName", ",", "...
Returns the fields in the object view. @param string $objectName @param string $viewName @return array
[ "Returns", "the", "fields", "in", "the", "object", "view", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L381-L395
201,123
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getField
public function getField($objectName, $fieldName, $excludeFormDefaults = true) { $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['__field_index'][$fieldName])) { $fieldConfiguration = array_replace_recursive($this->defaultFieldConfiguration,...
php
public function getField($objectName, $fieldName, $excludeFormDefaults = true) { $modelConfiguration = $this->getModelConfiguration($objectName); if (isset($modelConfiguration['__field_index'][$fieldName])) { $fieldConfiguration = array_replace_recursive($this->defaultFieldConfiguration,...
[ "public", "function", "getField", "(", "$", "objectName", ",", "$", "fieldName", ",", "$", "excludeFormDefaults", "=", "true", ")", "{", "$", "modelConfiguration", "=", "$", "this", "->", "getModelConfiguration", "(", "$", "objectName", ")", ";", "if", "(", ...
Returns the configuration of a field in the specified object. @param string $objectName @param string $fieldName @return array|null
[ "Returns", "the", "configuration", "of", "a", "field", "in", "the", "specified", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L405-L416
201,124
FlexModel/FlexModel
src/FlexModel.php
FlexModel.getReferencedField
public function getReferencedField($objectName, $fieldName, array & $excludedFieldNameParts = array(), $objectReferencesOnly = true) { $foundFieldName = null; $fieldNameParts = explode('_', $fieldName); $excludedFieldNameParts = array(); $initial = false; while (count($fieldN...
php
public function getReferencedField($objectName, $fieldName, array & $excludedFieldNameParts = array(), $objectReferencesOnly = true) { $foundFieldName = null; $fieldNameParts = explode('_', $fieldName); $excludedFieldNameParts = array(); $initial = false; while (count($fieldN...
[ "public", "function", "getReferencedField", "(", "$", "objectName", ",", "$", "fieldName", ",", "array", "&", "$", "excludedFieldNameParts", "=", "array", "(", ")", ",", "$", "objectReferencesOnly", "=", "true", ")", "{", "$", "foundFieldName", "=", "null", ...
Returns the field reference of the specified object. The returned excluded field name parts can be used to retrieve the field for the referenced object. @param string $objectName @param string $fieldName @param array $excludedFieldNameParts @param bool $objectReferencesOnly @return array|null
[ "Returns", "the", "field", "reference", "of", "the", "specified", "object", ".", "The", "returned", "excluded", "field", "name", "parts", "can", "be", "used", "to", "retrieve", "the", "field", "for", "the", "referenced", "object", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L429-L452
201,125
FlexModel/FlexModel
src/FlexModel.php
FlexModel.generateCacheFile
private function generateCacheFile() { $previousErrorSetting = libxml_use_internal_errors(true); libxml_clear_errors(); if (@$this->domDocument->schemaValidate($this->xmlSchemaFile)) { $this->domDocument->preserveWhiteSpace = false; // Reload the XML to strip whitespa...
php
private function generateCacheFile() { $previousErrorSetting = libxml_use_internal_errors(true); libxml_clear_errors(); if (@$this->domDocument->schemaValidate($this->xmlSchemaFile)) { $this->domDocument->preserveWhiteSpace = false; // Reload the XML to strip whitespa...
[ "private", "function", "generateCacheFile", "(", ")", "{", "$", "previousErrorSetting", "=", "libxml_use_internal_errors", "(", "true", ")", ";", "libxml_clear_errors", "(", ")", ";", "if", "(", "@", "$", "this", "->", "domDocument", "->", "schemaValidate", "(",...
Generates the cache file.
[ "Generates", "the", "cache", "file", "." ]
83368c13a7c8c2cf0ee95b36fe81d84a7129fee2
https://github.com/FlexModel/FlexModel/blob/83368c13a7c8c2cf0ee95b36fe81d84a7129fee2/src/FlexModel.php#L525-L554
201,126
romm/configuration_object
Classes/Service/Items/Cache/CacheService.php
CacheService.configurationObjectAfter
public function configurationObjectAfter(GetConfigurationObjectDTO $serviceDataTransferObject) { $this->delay( self::PRIORITY_SAVE_OBJECT_IN_CACHE, function (GetConfigurationObjectDTO $serviceDataTransferObject) { $cacheHash = $this->getConfigurationObjectCacheHash($s...
php
public function configurationObjectAfter(GetConfigurationObjectDTO $serviceDataTransferObject) { $this->delay( self::PRIORITY_SAVE_OBJECT_IN_CACHE, function (GetConfigurationObjectDTO $serviceDataTransferObject) { $cacheHash = $this->getConfigurationObjectCacheHash($s...
[ "public", "function", "configurationObjectAfter", "(", "GetConfigurationObjectDTO", "$", "serviceDataTransferObject", ")", "{", "$", "this", "->", "delay", "(", "self", "::", "PRIORITY_SAVE_OBJECT_IN_CACHE", ",", "function", "(", "GetConfigurationObjectDTO", "$", "service...
After a configuration object has been built, it is stored in the cache. @param GetConfigurationObjectDTO $serviceDataTransferObject
[ "After", "a", "configuration", "object", "has", "been", "built", "it", "is", "stored", "in", "the", "cache", "." ]
d3a40903386c2e0766bd8279337fe6da45cf5ce3
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/Cache/CacheService.php#L161-L173
201,127
libreworks/caridea-validate
src/Rule/Set.php
Set.add
public function add(\Caridea\Validate\Rule ...$rules): self { $this->rules = array_merge($this->rules, $rules); return $this; }
php
public function add(\Caridea\Validate\Rule ...$rules): self { $this->rules = array_merge($this->rules, $rules); return $this; }
[ "public", "function", "add", "(", "\\", "Caridea", "\\", "Validate", "\\", "Rule", "...", "$", "rules", ")", ":", "self", "{", "$", "this", "->", "rules", "=", "array_merge", "(", "$", "this", "->", "rules", ",", "$", "rules", ")", ";", "return", "...
Adds one or more `Rule`s into this `Set`. @param \Caridea\Validate\Rule ...$rules The rules to add @return $this Provides a fluent interface
[ "Adds", "one", "or", "more", "Rule", "s", "into", "this", "Set", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Rule/Set.php#L59-L63
201,128
libreworks/caridea-validate
src/Rule/Set.php
Set.addAll
public function addAll(array $rules): self { try { return $this->add(...$rules); } catch (\TypeError $e) { throw new \InvalidArgumentException('Only Rule objects are allowed', 0, $e); } }
php
public function addAll(array $rules): self { try { return $this->add(...$rules); } catch (\TypeError $e) { throw new \InvalidArgumentException('Only Rule objects are allowed', 0, $e); } }
[ "public", "function", "addAll", "(", "array", "$", "rules", ")", ":", "self", "{", "try", "{", "return", "$", "this", "->", "add", "(", "...", "$", "rules", ")", ";", "}", "catch", "(", "\\", "TypeError", "$", "e", ")", "{", "throw", "new", "\\",...
Adds several `Rule`s into this `Set`. @param \Caridea\Validate\Rule[] $rules The rules to add @return $this Provides a fluent interface @throws \InvalidArgumentException if `$rules` contains invalid types
[ "Adds", "several", "Rule", "s", "into", "this", "Set", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Rule/Set.php#L72-L79
201,129
libreworks/caridea-validate
src/Rule/Set.php
Set.merge
public function merge(Set $rules): self { $this->rules = array_merge($this->rules, $rules->rules); return $this; }
php
public function merge(Set $rules): self { $this->rules = array_merge($this->rules, $rules->rules); return $this; }
[ "public", "function", "merge", "(", "Set", "$", "rules", ")", ":", "self", "{", "$", "this", "->", "rules", "=", "array_merge", "(", "$", "this", "->", "rules", ",", "$", "rules", "->", "rules", ")", ";", "return", "$", "this", ";", "}" ]
Adds the entries from another `Set` into this one. @param \Caridea\Validate\Rule\Set $rules The rules to add @return $this Provides a fluent interface
[ "Adds", "the", "entries", "from", "another", "Set", "into", "this", "one", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Rule/Set.php#L87-L91
201,130
vanilla/garden-daemon
src/Daemon.php
Daemon.initializeDaemon
protected function initializeDaemon() { declare (ticks = 100); // Install signal handlers pcntl_signal(SIGHUP, [$this, 'handleSignal']); pcntl_signal(SIGINT, [$this, 'handleSignal']); pcntl_signal(SIGTERM, [$this, 'handleSignal']); pcntl_signal(SIGCHLD, [$this, 'handleSi...
php
protected function initializeDaemon() { declare (ticks = 100); // Install signal handlers pcntl_signal(SIGHUP, [$this, 'handleSignal']); pcntl_signal(SIGINT, [$this, 'handleSignal']); pcntl_signal(SIGTERM, [$this, 'handleSignal']); pcntl_signal(SIGCHLD, [$this, 'handleSi...
[ "protected", "function", "initializeDaemon", "(", ")", "{", "declare", "(", "ticks", "=", "100", ")", ";", "// Install signal handlers", "pcntl_signal", "(", "SIGHUP", ",", "[", "$", "this", ",", "'handleSignal'", "]", ")", ";", "pcntl_signal", "(", "SIGINT", ...
Post-daemonize initialization
[ "Post", "-", "daemonize", "initialization" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L474-L484
201,131
vanilla/garden-daemon
src/Daemon.php
Daemon.getPayloadInstance
protected function getPayloadInstance(): AppInterface { if (!($this->instance instanceof AppInterface)) { $appName = $this->get('appname', null); $appNamespace = $this->get('appnamespace', null); // Run App $appClassName = ucfirst($appName); if (!is_n...
php
protected function getPayloadInstance(): AppInterface { if (!($this->instance instanceof AppInterface)) { $appName = $this->get('appname', null); $appNamespace = $this->get('appnamespace', null); // Run App $appClassName = ucfirst($appName); if (!is_n...
[ "protected", "function", "getPayloadInstance", "(", ")", ":", "AppInterface", "{", "if", "(", "!", "(", "$", "this", "->", "instance", "instanceof", "AppInterface", ")", ")", "{", "$", "appName", "=", "$", "this", "->", "get", "(", "'appname'", ",", "nul...
Get an instance of the app @return AppInterface
[ "Get", "an", "instance", "of", "the", "app" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L491-L505
201,132
vanilla/garden-daemon
src/Daemon.php
Daemon.payloadExec
protected function payloadExec($method, $args = []) { $this->getPayloadInstance(); if (method_exists($this->instance, $method)) { return $this->di->call([$this->instance, $method], $args); } return null; }
php
protected function payloadExec($method, $args = []) { $this->getPayloadInstance(); if (method_exists($this->instance, $method)) { return $this->di->call([$this->instance, $method], $args); } return null; }
[ "protected", "function", "payloadExec", "(", "$", "method", ",", "$", "args", "=", "[", "]", ")", "{", "$", "this", "->", "getPayloadInstance", "(", ")", ";", "if", "(", "method_exists", "(", "$", "this", "->", "instance", ",", "$", "method", ")", ")...
Execute callback on payload @param string $method @param mixed $args @return mixed
[ "Execute", "callback", "on", "payload" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L514-L520
201,133
vanilla/garden-daemon
src/Daemon.php
Daemon.attachPayloadErrorHandler
protected function attachPayloadErrorHandler() { $this->getPayloadInstance(); if (method_exists($this->instance, 'errorHandler')) { $this->di->get(ErrorHandler::class)->addHandler([$this->instance, 'errorHandler']); } }
php
protected function attachPayloadErrorHandler() { $this->getPayloadInstance(); if (method_exists($this->instance, 'errorHandler')) { $this->di->get(ErrorHandler::class)->addHandler([$this->instance, 'errorHandler']); } }
[ "protected", "function", "attachPayloadErrorHandler", "(", ")", "{", "$", "this", "->", "getPayloadInstance", "(", ")", ";", "if", "(", "method_exists", "(", "$", "this", "->", "instance", ",", "'errorHandler'", ")", ")", "{", "$", "this", "->", "di", "->"...
Attach payload error handler
[ "Attach", "payload", "error", "handler" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L525-L530
201,134
vanilla/garden-daemon
src/Daemon.php
Daemon.launchWorker
protected function launchWorker(): bool { $this->log(LogLevel::DEBUG, "[{pid}] launching fleet worker"); // Prepare current state prior to forking $workerConfig = $this->payloadExec('getWorkerConfig'); if ($workerConfig === false) { $this->log(LogLevel::DEBUG, "[{pid}] ...
php
protected function launchWorker(): bool { $this->log(LogLevel::DEBUG, "[{pid}] launching fleet worker"); // Prepare current state prior to forking $workerConfig = $this->payloadExec('getWorkerConfig'); if ($workerConfig === false) { $this->log(LogLevel::DEBUG, "[{pid}] ...
[ "protected", "function", "launchWorker", "(", ")", ":", "bool", "{", "$", "this", "->", "log", "(", "LogLevel", "::", "DEBUG", ",", "\"[{pid}] launching fleet worker\"", ")", ";", "// Prepare current state prior to forking", "$", "workerConfig", "=", "$", "this", ...
Launch a fleet worker @return bool
[ "Launch", "a", "fleet", "worker" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L682-L717
201,135
vanilla/garden-daemon
src/Daemon.php
Daemon.runPayloadApplication
protected function runPayloadApplication($workerConfig = null): int { $this->getPayloadInstance(); try { $runSuccess = $this->instance->run($workerConfig); unset($this->instance); } catch (Exception $ex) { $exitMessage = $ex->getMessage(); $exitFi...
php
protected function runPayloadApplication($workerConfig = null): int { $this->getPayloadInstance(); try { $runSuccess = $this->instance->run($workerConfig); unset($this->instance); } catch (Exception $ex) { $exitMessage = $ex->getMessage(); $exitFi...
[ "protected", "function", "runPayloadApplication", "(", "$", "workerConfig", "=", "null", ")", ":", "int", "{", "$", "this", "->", "getPayloadInstance", "(", ")", ";", "try", "{", "$", "runSuccess", "=", "$", "this", "->", "instance", "->", "run", "(", "$...
Run application worker @internal POST FORK, POST FLEET @param mixed $workerConfig @return int
[ "Run", "application", "worker" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L726-L766
201,136
vanilla/garden-daemon
src/Daemon.php
Daemon.sendSignal
public function sendSignal(int $signal) { $runningPid = $this->lock->getRunningPID(); if (!$runningPid) { return false; } // Send signal return posix_kill($runningPid, $signal); }
php
public function sendSignal(int $signal) { $runningPid = $this->lock->getRunningPID(); if (!$runningPid) { return false; } // Send signal return posix_kill($runningPid, $signal); }
[ "public", "function", "sendSignal", "(", "int", "$", "signal", ")", "{", "$", "runningPid", "=", "$", "this", "->", "lock", "->", "getRunningPID", "(", ")", ";", "if", "(", "!", "$", "runningPid", ")", "{", "return", "false", ";", "}", "// Send signal"...
Send a signal to the running daemon @param int $signal @return bool
[ "Send", "a", "signal", "to", "the", "running", "daemon" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L897-L905
201,137
vanilla/garden-daemon
src/Daemon.php
Daemon.workerSignal
public function workerSignal(int $signal) { $this->log(LogLevel::DEBUG, "[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler"); switch ($signal) { // Daemon was asked to hang up case SIGHUP: $this->payloadExec('signal', [$signal...
php
public function workerSignal(int $signal) { $this->log(LogLevel::DEBUG, "[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler"); switch ($signal) { // Daemon was asked to hang up case SIGHUP: $this->payloadExec('signal', [$signal...
[ "public", "function", "workerSignal", "(", "int", "$", "signal", ")", "{", "$", "this", "->", "log", "(", "LogLevel", "::", "DEBUG", ",", "\"[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler\"", ")", ";", "switch", "(", "$", "signal...
Worker signal handler @param int $signal @throws Exception
[ "Worker", "signal", "handler" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L978-L998
201,138
vanilla/garden-daemon
src/Daemon.php
Daemon.reapChild
protected function reapChild(int $pid, int $status = null) { // One of ours? if (array_key_exists($pid, $this->children)) { $exited = pcntl_wexitstatus($status); if ($this->exitMode == 'worst-case') { if (abs($exited) > abs($this->exit)) { $th...
php
protected function reapChild(int $pid, int $status = null) { // One of ours? if (array_key_exists($pid, $this->children)) { $exited = pcntl_wexitstatus($status); if ($this->exitMode == 'worst-case') { if (abs($exited) > abs($this->exit)) { $th...
[ "protected", "function", "reapChild", "(", "int", "$", "pid", ",", "int", "$", "status", "=", "null", ")", "{", "// One of ours?", "if", "(", "array_key_exists", "(", "$", "pid", ",", "$", "this", "->", "children", ")", ")", "{", "$", "exited", "=", ...
Reap a fleet worker @param int $pid @param int $status
[ "Reap", "a", "fleet", "worker" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1006-L1026
201,139
vanilla/garden-daemon
src/Daemon.php
Daemon.reapZombies
public function reapZombies() { $reaped = 0; // Clean up any exited children do { $status = null; $pid = pcntl_wait($status, WNOHANG); if ($pid > 0) { $this->reapChild($pid, $status); $reaped++; } } while ($p...
php
public function reapZombies() { $reaped = 0; // Clean up any exited children do { $status = null; $pid = pcntl_wait($status, WNOHANG); if ($pid > 0) { $this->reapChild($pid, $status); $reaped++; } } while ($p...
[ "public", "function", "reapZombies", "(", ")", "{", "$", "reaped", "=", "0", ";", "// Clean up any exited children", "do", "{", "$", "status", "=", "null", ";", "$", "pid", "=", "pcntl_wait", "(", "$", "status", ",", "WNOHANG", ")", ";", "if", "(", "$"...
Reap any available exited children @return int
[ "Reap", "any", "available", "exited", "children" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1033-L1045
201,140
vanilla/garden-daemon
src/Daemon.php
Daemon.reapAllChildren
protected function reapAllChildren(): bool { static $killing = false; if (!$killing) { $this->log(LogLevel::DEBUG, "[{pid}] Shutting down fleet operations..."); $killing = true; foreach ($this->children as $childpid => $childtype) { posix_kill($childpi...
php
protected function reapAllChildren(): bool { static $killing = false; if (!$killing) { $this->log(LogLevel::DEBUG, "[{pid}] Shutting down fleet operations..."); $killing = true; foreach ($this->children as $childpid => $childtype) { posix_kill($childpi...
[ "protected", "function", "reapAllChildren", "(", ")", ":", "bool", "{", "static", "$", "killing", "=", "false", ";", "if", "(", "!", "$", "killing", ")", "{", "$", "this", "->", "log", "(", "LogLevel", "::", "DEBUG", ",", "\"[{pid}] Shutting down fleet ope...
Force-reap all children and return @return bool
[ "Force", "-", "reap", "all", "children", "and", "return" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1052-L1078
201,141
vanilla/garden-daemon
src/Daemon.php
Daemon.time
public static function time(string $time = 'now', string $format = null): \DateTimeInterface { $timezone = new \DateTimeZone('utc'); if (is_null($format)) { $date = new \DateTime($time, $timezone); } else { $date = \DateTime::createFromFormat($format, $time, $timezone); ...
php
public static function time(string $time = 'now', string $format = null): \DateTimeInterface { $timezone = new \DateTimeZone('utc'); if (is_null($format)) { $date = new \DateTime($time, $timezone); } else { $date = \DateTime::createFromFormat($format, $time, $timezone); ...
[ "public", "static", "function", "time", "(", "string", "$", "time", "=", "'now'", ",", "string", "$", "format", "=", "null", ")", ":", "\\", "DateTimeInterface", "{", "$", "timezone", "=", "new", "\\", "DateTimeZone", "(", "'utc'", ")", ";", "if", "(",...
Get the time @param string $time @param string $format @return \DateTimeInterface
[ "Get", "the", "time" ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1087-L1097
201,142
vanilla/garden-daemon
src/Daemon.php
Daemon.levelPriority
public function levelPriority(string $level): int { static $priorities = [ LogLevel::DEBUG => LOG_DEBUG, LogLevel::INFO => LOG_INFO, LogLevel::NOTICE => LOG_NOTICE, LogLevel::WARNING => LOG_WARNING, LogLevel::ERROR => LOG_ERR, ...
php
public function levelPriority(string $level): int { static $priorities = [ LogLevel::DEBUG => LOG_DEBUG, LogLevel::INFO => LOG_INFO, LogLevel::NOTICE => LOG_NOTICE, LogLevel::WARNING => LOG_WARNING, LogLevel::ERROR => LOG_ERR, ...
[ "public", "function", "levelPriority", "(", "string", "$", "level", ")", ":", "int", "{", "static", "$", "priorities", "=", "[", "LogLevel", "::", "DEBUG", "=>", "LOG_DEBUG", ",", "LogLevel", "::", "INFO", "=>", "LOG_INFO", ",", "LogLevel", "::", "NOTICE",...
Get the numeric priority for a log level. The priorities are set to the LOG_* constants from the {@link syslog()} function. A lower number is more severe. @param string|int $level The string log level or an actual priority. @return int Returns the numeric log level or `8` if the level is invalid.
[ "Get", "the", "numeric", "priority", "for", "a", "log", "level", "." ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1155-L1172
201,143
vanilla/garden-daemon
src/Daemon.php
Daemon.interpolateContext
protected function interpolateContext(string $format, array $context = []): string { $final = preg_replace_callback('/{([^\s][^}]+[^\s]?)}/', function ($matches) use ($context) { $field = trim($matches[1], '{}'); if (array_key_exists($field, $context)) { return $context[$...
php
protected function interpolateContext(string $format, array $context = []): string { $final = preg_replace_callback('/{([^\s][^}]+[^\s]?)}/', function ($matches) use ($context) { $field = trim($matches[1], '{}'); if (array_key_exists($field, $context)) { return $context[$...
[ "protected", "function", "interpolateContext", "(", "string", "$", "format", ",", "array", "$", "context", "=", "[", "]", ")", ":", "string", "{", "$", "final", "=", "preg_replace_callback", "(", "'/{([^\\s][^}]+[^\\s]?)}/'", ",", "function", "(", "$", "matche...
Interpolate contexts into messages containing bracket-wrapped format strings. @param string $format @param array $context optional. array of key-value pairs to replace into the format. @return string
[ "Interpolate", "contexts", "into", "messages", "containing", "bracket", "-", "wrapped", "format", "strings", "." ]
13a5cbbac08ab6473e4b11bf00179fe1e26235a6
https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1181-L1191
201,144
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/C2M.php
C2M.setCategory
public function setCategory(ChildCategory $v = null) { if ($v === null) { $this->setCategoryId(NULL); } else { $this->setCategoryId($v->getId()); } $this->aCategory = $v; // Add binding for other direction of this n:n relationship. // If this...
php
public function setCategory(ChildCategory $v = null) { if ($v === null) { $this->setCategoryId(NULL); } else { $this->setCategoryId($v->getId()); } $this->aCategory = $v; // Add binding for other direction of this n:n relationship. // If this...
[ "public", "function", "setCategory", "(", "ChildCategory", "$", "v", "=", "null", ")", "{", "if", "(", "$", "v", "===", "null", ")", "{", "$", "this", "->", "setCategoryId", "(", "NULL", ")", ";", "}", "else", "{", "$", "this", "->", "setCategoryId",...
Declares an association between this object and a ChildCategory object. @param ChildCategory $v @return $this|\Attogram\SharedMedia\Orm\C2M The current object (for fluent API support) @throws PropelException
[ "Declares", "an", "association", "between", "this", "object", "and", "a", "ChildCategory", "object", "." ]
81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2M.php#L1080-L1098
201,145
attogram/shared-media-orm
src/Attogram/SharedMedia/Orm/Base/C2M.php
C2M.getCategory
public function getCategory(ConnectionInterface $con = null) { if ($this->aCategory === null && ($this->category_id != 0)) { $this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con); /* The following can be used additionally to guarantee the r...
php
public function getCategory(ConnectionInterface $con = null) { if ($this->aCategory === null && ($this->category_id != 0)) { $this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con); /* The following can be used additionally to guarantee the r...
[ "public", "function", "getCategory", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "aCategory", "===", "null", "&&", "(", "$", "this", "->", "category_id", "!=", "0", ")", ")", "{", "$", "this", "->", "a...
Get the associated ChildCategory object @param ConnectionInterface $con Optional Connection object. @return ChildCategory The associated ChildCategory object. @throws PropelException
[ "Get", "the", "associated", "ChildCategory", "object" ]
81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8
https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2M.php#L1108-L1122
201,146
CodeBlastr/queue
src/Model/Table/QueuesTable.php
QueuesTable.createJob
public function createJob($jobName, $data = null, $notBefore = null, $reference = null) { $data = [ 'type' => $jobName, 'data' => $data, 'reference' => $reference, ]; if ($notBefore !== null) { $data['notbefore'] = new Time($notBefore); ...
php
public function createJob($jobName, $data = null, $notBefore = null, $reference = null) { $data = [ 'type' => $jobName, 'data' => $data, 'reference' => $reference, ]; if ($notBefore !== null) { $data['notbefore'] = new Time($notBefore); ...
[ "public", "function", "createJob", "(", "$", "jobName", ",", "$", "data", "=", "null", ",", "$", "notBefore", "=", "null", ",", "$", "reference", "=", "null", ")", "{", "$", "data", "=", "[", "'type'", "=>", "$", "jobName", ",", "'data'", "=>", "$"...
Add a new Job to the Queue. @param string $jobName QueueTask name @param array|null $data any array @param array|null $notBefore optional date which must not be preceded @param string|null $reference An optional reference string. @return \Cake\ORM\Entity Saved job entity @throws \Exception
[ "Add", "a", "new", "Job", "to", "the", "Queue", "." ]
8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435
https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L58-L73
201,147
CodeBlastr/queue
src/Model/Table/QueuesTable.php
QueuesTable.requestJob
public function requestJob() { $findCond = [ 'conditions' => [ 'completed' => 0 ], 'order' => [ 'created ASC', 'id ASC', ], 'limit' => 3, ]; $jobs = $this->find('all', $findCond)->all...
php
public function requestJob() { $findCond = [ 'conditions' => [ 'completed' => 0 ], 'order' => [ 'created ASC', 'id ASC', ], 'limit' => 3, ]; $jobs = $this->find('all', $findCond)->all...
[ "public", "function", "requestJob", "(", ")", "{", "$", "findCond", "=", "[", "'conditions'", "=>", "[", "'completed'", "=>", "0", "]", ",", "'order'", "=>", "[", "'created ASC'", ",", "'id ASC'", ",", "]", ",", "'limit'", "=>", "3", ",", "]", ";", "...
Find a job to do. @return array
[ "Find", "a", "job", "to", "do", "." ]
8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435
https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L80-L100
201,148
CodeBlastr/queue
src/Model/Table/QueuesTable.php
QueuesTable.markJobDone
public function markJobDone($id) { $entity = $this->get($id); $data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]]; $this->patchEntity($entity, $data, ['valid...
php
public function markJobDone($id) { $entity = $this->get($id); $data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]]; $this->patchEntity($entity, $data, ['valid...
[ "public", "function", "markJobDone", "(", "$", "id", ")", "{", "$", "entity", "=", "$", "this", "->", "get", "(", "$", "id", ")", ";", "$", "data", "=", "[", "'completed'", "=>", "true", ",", "'stats'", "=>", "[", "'tries'", "=>", "(", "$", "enti...
Mark job done and add some stats @param $id @return bool|\Cake\Datasource\EntityInterface|mixed
[ "Mark", "job", "done", "and", "add", "some", "stats" ]
8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435
https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L108-L114
201,149
CodeBlastr/queue
src/Model/Table/QueuesTable.php
QueuesTable.markJobFailed
public function markJobFailed($id, $message = null) { $entity = $this->get($id); $data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]]; $this->patchEntity($enti...
php
public function markJobFailed($id, $message = null) { $entity = $this->get($id); $data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]]; $this->patchEntity($enti...
[ "public", "function", "markJobFailed", "(", "$", "id", ",", "$", "message", "=", "null", ")", "{", "$", "entity", "=", "$", "this", "->", "get", "(", "$", "id", ")", ";", "$", "data", "=", "[", "'completed'", "=>", "false", ",", "'stats'", "=>", ...
Job did not complete, save a few stats so we can see what went wrong. @param $id @param null $message @return bool|\Cake\Datasource\EntityInterface|mixed
[ "Job", "did", "not", "complete", "save", "a", "few", "stats", "so", "we", "can", "see", "what", "went", "wrong", "." ]
8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435
https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L123-L129
201,150
praxigento/mobi_mod_pv
Service/Batch/Transfer/Save/A/ProcessItems.php
ProcessItems.cleanBatches
private function cleanBatches($userId) { $where = EBatch::A_USER_REF . '=' . (int)$userId; $result = $this->daoBatch->delete($where); return $result; }
php
private function cleanBatches($userId) { $where = EBatch::A_USER_REF . '=' . (int)$userId; $result = $this->daoBatch->delete($where); return $result; }
[ "private", "function", "cleanBatches", "(", "$", "userId", ")", "{", "$", "where", "=", "EBatch", "::", "A_USER_REF", ".", "'='", ".", "(", "int", ")", "$", "userId", ";", "$", "result", "=", "$", "this", "->", "daoBatch", "->", "delete", "(", "$", ...
Remove all existing batches for currently logged in admin user. @return int @throws \Exception
[ "Remove", "all", "existing", "batches", "for", "currently", "logged", "in", "admin", "user", "." ]
d1540b7e94264527006e8b9fa68904a72a63928e
https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Service/Batch/Transfer/Save/A/ProcessItems.php#L54-L59
201,151
praxigento/mobi_mod_pv
Service/Batch/Transfer/Save/A/ProcessItems.php
ProcessItems.createBatch
private function createBatch($userId) { $entity = new EBatch(); $entity->setUserRef($userId); $result = $this->daoBatch->create($entity); return $result; }
php
private function createBatch($userId) { $entity = new EBatch(); $entity->setUserRef($userId); $result = $this->daoBatch->create($entity); return $result; }
[ "private", "function", "createBatch", "(", "$", "userId", ")", "{", "$", "entity", "=", "new", "EBatch", "(", ")", ";", "$", "entity", "->", "setUserRef", "(", "$", "userId", ")", ";", "$", "result", "=", "$", "this", "->", "daoBatch", "->", "create"...
Register new batch for currently logged in admin user. @return int @throws \Exception
[ "Register", "new", "batch", "for", "currently", "logged", "in", "admin", "user", "." ]
d1540b7e94264527006e8b9fa68904a72a63928e
https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Service/Batch/Transfer/Save/A/ProcessItems.php#L67-L73
201,152
lasallecms/lasallecms-l5-lasallecmsadmin-pkg
src/FormProcessing/Postupdates/CreatePostupdateFormProcessing.php
CreatePostupdateFormProcessing.quarterback
public function quarterback($createCommand) { // Convert the command bus object into an array $data = (array) $createCommand; // Sanitize $data = $this->sanitize($data, $this->type); // Validate if ($this->validate($data, $this->type) != "passed") { ...
php
public function quarterback($createCommand) { // Convert the command bus object into an array $data = (array) $createCommand; // Sanitize $data = $this->sanitize($data, $this->type); // Validate if ($this->validate($data, $this->type) != "passed") { ...
[ "public", "function", "quarterback", "(", "$", "createCommand", ")", "{", "// Convert the command bus object into an array", "$", "data", "=", "(", "array", ")", "$", "createCommand", ";", "// Sanitize", "$", "data", "=", "$", "this", "->", "sanitize", "(", "$",...
The form processing steps. @param object $createCommand The command bus object @return array The custom response array
[ "The", "form", "processing", "steps", "." ]
5a4b3375e449273a98e84a566bcf60fd2172cb2d
https://github.com/lasallecms/lasallecms-l5-lasallecmsadmin-pkg/blob/5a4b3375e449273a98e84a566bcf60fd2172cb2d/src/FormProcessing/Postupdates/CreatePostupdateFormProcessing.php#L119-L163
201,153
ZFrapid/zfrapid-core
src/Command/AbstractCommand.php
AbstractCommand.processTasks
public function processTasks() { /** @var TaskInterface $task */ foreach ($this->tasks as $task) { $callable = new $task(); $result = call_user_func( $callable, $this->route, $this->console, $this->params ); if (1 === $result) { ...
php
public function processTasks() { /** @var TaskInterface $task */ foreach ($this->tasks as $task) { $callable = new $task(); $result = call_user_func( $callable, $this->route, $this->console, $this->params ); if (1 === $result) { ...
[ "public", "function", "processTasks", "(", ")", "{", "/** @var TaskInterface $task */", "foreach", "(", "$", "this", "->", "tasks", "as", "$", "task", ")", "{", "$", "callable", "=", "new", "$", "task", "(", ")", ";", "$", "result", "=", "call_user_func", ...
Process command tasks
[ "Process", "command", "tasks" ]
8be56b82f9f5a687619a2b2175fcaa66ad3d2233
https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Command/AbstractCommand.php#L71-L87
201,154
johnkrovitch/Sam
Task/TaskBuilder.php
TaskBuilder.build
public function build(array $taskConfigurations) { $resolver = new OptionsResolver(); $tasks = []; foreach ($taskConfigurations as $taskName => $taskConfiguration) { $resolver->clear(); // debug mode if ($this->debug === true) { $...
php
public function build(array $taskConfigurations) { $resolver = new OptionsResolver(); $tasks = []; foreach ($taskConfigurations as $taskName => $taskConfiguration) { $resolver->clear(); // debug mode if ($this->debug === true) { $...
[ "public", "function", "build", "(", "array", "$", "taskConfigurations", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "tasks", "=", "[", "]", ";", "foreach", "(", "$", "taskConfigurations", "as", "$", "taskName", "=>", "$"...
Build and return an array of Task. @param array $taskConfigurations @return Task[]
[ "Build", "and", "return", "an", "array", "of", "Task", "." ]
fbd3770c11eecc0a6d8070f439f149062316f606
https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskBuilder.php#L31-L57
201,155
loevgaard/dandomain-foundation-entities
src/Repository/AbstractRepository.php
AbstractRepository.removeByIds
public function removeByIds(array $in = [], array $notIn = []) { if (!count($in) && !count($notIn)) { return; } $qb = $this->createQueryBuilder('e'); if ($this->getClassMetadata()->hasField('deletedAt')) { $qb->update() ->set('e.deletedAt', '...
php
public function removeByIds(array $in = [], array $notIn = []) { if (!count($in) && !count($notIn)) { return; } $qb = $this->createQueryBuilder('e'); if ($this->getClassMetadata()->hasField('deletedAt')) { $qb->update() ->set('e.deletedAt', '...
[ "public", "function", "removeByIds", "(", "array", "$", "in", "=", "[", "]", ",", "array", "$", "notIn", "=", "[", "]", ")", "{", "if", "(", "!", "count", "(", "$", "in", ")", "&&", "!", "count", "(", "$", "notIn", ")", ")", "{", "return", ";...
Will remove entities based on the ids you input. @param int[] $in @param int[] $notIn
[ "Will", "remove", "entities", "based", "on", "the", "ids", "you", "input", "." ]
256f7aa8b40d2bd9488046c3c2b1e04e982d78ad
https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Repository/AbstractRepository.php#L79-L107
201,156
Ydle/HubBundle
Controller/ConfigController.php
ConfigController.typeroomAction
public function typeroomAction(Request $request) { $roomType = new RoomType(); $form = $this->createForm("room_types", $roomType); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($roomType); ...
php
public function typeroomAction(Request $request) { $roomType = new RoomType(); $form = $this->createForm("room_types", $roomType); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($roomType); ...
[ "public", "function", "typeroomAction", "(", "Request", "$", "request", ")", "{", "$", "roomType", "=", "new", "RoomType", "(", ")", ";", "$", "form", "=", "$", "this", "->", "createForm", "(", "\"room_types\"", ",", "$", "roomType", ")", ";", "$", "fo...
Homepage for type room, listing and editing types @param \Symfony\Component\HttpFoundation\Request $request @return type
[ "Homepage", "for", "type", "room", "listing", "and", "editing", "types" ]
7fa423241246bcfd115f2ed3ad3997b4b63adb01
https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/ConfigController.php#L26-L55
201,157
native5/native5-sdk-client-php
src/Native5/Identity/DefaultSecurityManager.php
DefaultSecurityManager.login
public function login(&$subject, $token) { global $logger; global $app; try { if($app->getConfiguration()->isPreventMultipleLogins()) { list($authInfo, $roles, $tokens,$hashedSessionId) = $this->authenticate($token, true); $app->getSessionManager()...
php
public function login(&$subject, $token) { global $logger; global $app; try { if($app->getConfiguration()->isPreventMultipleLogins()) { list($authInfo, $roles, $tokens,$hashedSessionId) = $this->authenticate($token, true); $app->getSessionManager()...
[ "public", "function", "login", "(", "&", "$", "subject", ",", "$", "token", ")", "{", "global", "$", "logger", ";", "global", "$", "app", ";", "try", "{", "if", "(", "$", "app", "->", "getConfiguration", "(", ")", "->", "isPreventMultipleLogins", "(", ...
login Logs in the subject. @param mixed $subject Subject to authenticate @param mixed $token Token to be used for authentication. @access public @return void @throws AuthenticationException
[ "login", "Logs", "in", "the", "subject", "." ]
e1f598cf27654d81bb5facace1990b737242a2f9
https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L86-L119
201,158
native5/native5-sdk-client-php
src/Native5/Identity/DefaultSecurityManager.php
DefaultSecurityManager._generateCSRFToken
private function _generateCSRFToken($length=32) { $randUtils = new RandomUtils(); $randToken = $randUtils->getBytes($length, true); return base64_encode($randToken); }
php
private function _generateCSRFToken($length=32) { $randUtils = new RandomUtils(); $randToken = $randUtils->getBytes($length, true); return base64_encode($randToken); }
[ "private", "function", "_generateCSRFToken", "(", "$", "length", "=", "32", ")", "{", "$", "randUtils", "=", "new", "RandomUtils", "(", ")", ";", "$", "randToken", "=", "$", "randUtils", "->", "getBytes", "(", "$", "length", ",", "true", ")", ";", "ret...
Generate CSRF Token of given length. @param mixed $length @access private @return void
[ "Generate", "CSRF", "Token", "of", "given", "length", "." ]
e1f598cf27654d81bb5facace1990b737242a2f9
https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L129-L134
201,159
native5/native5-sdk-client-php
src/Native5/Identity/DefaultSecurityManager.php
DefaultSecurityManager._logAnalytics
private function _logAnalytics($app, $subject) { if($app->getConfiguration()->logAnalytics() == true) { $clientIP = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $ana...
php
private function _logAnalytics($app, $subject) { if($app->getConfiguration()->logAnalytics() == true) { $clientIP = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $ana...
[ "private", "function", "_logAnalytics", "(", "$", "app", ",", "$", "subject", ")", "{", "if", "(", "$", "app", "->", "getConfiguration", "(", ")", "->", "logAnalytics", "(", ")", "==", "true", ")", "{", "$", "clientIP", "=", "(", "isset", "(", "$", ...
Log Analytics using the route logger @param mixed $app @access private @return void
[ "Log", "Analytics", "using", "the", "route", "logger" ]
e1f598cf27654d81bb5facace1990b737242a2f9
https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L144-L160
201,160
native5/native5-sdk-client-php
src/Native5/Identity/DefaultSecurityManager.php
DefaultSecurityManager.createSubject
public function createSubject($context) { global $logger; //$copyContext = $this->copy($context); //$copyContext = $this->_ensureSecurityMgr($copyContext); //$copyContext = $this->_resolveSession($copyContext); //$copyContext = $this->_resolvePrincipals($copyContext); ...
php
public function createSubject($context) { global $logger; //$copyContext = $this->copy($context); //$copyContext = $this->_ensureSecurityMgr($copyContext); //$copyContext = $this->_resolveSession($copyContext); //$copyContext = $this->_resolvePrincipals($copyContext); ...
[ "public", "function", "createSubject", "(", "$", "context", ")", "{", "global", "$", "logger", ";", "//$copyContext = $this->copy($context);", "//$copyContext = $this->_ensureSecurityMgr($copyContext);", "//$copyContext = $this->_resolveSession($copyContext);", "//$copyContext = $this-...
createSubject Creating the subject using the given context. @param mixed $context The context used to create the subject. @access public @return void
[ "createSubject", "Creating", "the", "subject", "using", "the", "given", "context", "." ]
e1f598cf27654d81bb5facace1990b737242a2f9
https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L191-L203
201,161
kaiohken1982/NeobazaarMailerModule
src/Mailer/Mvc/UserActivationListener.php
UserActivationListener.onUserActivationPost
public function onUserActivationPost(UserActivationEvent $e) { $password = $e->getParam('password'); $email = $e->getParam('to'); $siteUrl = $e->getParam('siteurl'); $loginUri = $this->getModuleOptions()->getLoginUri(); // something got really wrong if we get here... ...
php
public function onUserActivationPost(UserActivationEvent $e) { $password = $e->getParam('password'); $email = $e->getParam('to'); $siteUrl = $e->getParam('siteurl'); $loginUri = $this->getModuleOptions()->getLoginUri(); // something got really wrong if we get here... ...
[ "public", "function", "onUserActivationPost", "(", "UserActivationEvent", "$", "e", ")", "{", "$", "password", "=", "$", "e", "->", "getParam", "(", "'password'", ")", ";", "$", "email", "=", "$", "e", "->", "getParam", "(", "'to'", ")", ";", "$", "sit...
User Activation mail @param EventManagerInterface $events @return PrerenderListener
[ "User", "Activation", "mail" ]
0afc66196a0a392ecb4f052f483f2b5ff606bd8f
https://github.com/kaiohken1982/NeobazaarMailerModule/blob/0afc66196a0a392ecb4f052f483f2b5ff606bd8f/src/Mailer/Mvc/UserActivationListener.php#L124-L147
201,162
zhaoxianfang/tools
src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
PrototypedArrayNode.setDefaultValue
public function setDefaultValue($value) { if (!is_array($value)) { throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.'); } $this->defaultValue = $value; }
php
public function setDefaultValue($value) { if (!is_array($value)) { throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.'); } $this->defaultValue = $value; }
[ "public", "function", "setDefaultValue", "(", "$", "value", ")", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "$", "this", "->", "getPath", "(", ")", ".", "': the default value of...
Sets the default value of this node. @param string $value @throws \InvalidArgumentException if the default value is not an array
[ "Sets", "the", "default", "value", "of", "this", "node", "." ]
d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7
https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php#L95-L102
201,163
zhaoxianfang/tools
src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
PrototypedArrayNode.setAddChildrenIfNoneSet
public function setAddChildrenIfNoneSet($children = array('defaults')) { if (null === $children) { $this->defaultChildren = array('defaults'); } else { $this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children; } }
php
public function setAddChildrenIfNoneSet($children = array('defaults')) { if (null === $children) { $this->defaultChildren = array('defaults'); } else { $this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children; } }
[ "public", "function", "setAddChildrenIfNoneSet", "(", "$", "children", "=", "array", "(", "'defaults'", ")", ")", "{", "if", "(", "null", "===", "$", "children", ")", "{", "$", "this", "->", "defaultChildren", "=", "array", "(", "'defaults'", ")", ";", "...
Adds default children when none are set. @param int|string|array|null $children The number of children|The child name|The children names to be added
[ "Adds", "default", "children", "when", "none", "are", "set", "." ]
d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7
https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php#L117-L124
201,164
eureka-framework/component-cache
src/Cache/CacheWrapperAbstract.php
CacheWrapperAbstract.prefix
public function prefix($prefix = null) { if (null !== $prefix) { $this->prefix = substr(md5($prefix), 0, 10) . '_'; } return $this->prefix; }
php
public function prefix($prefix = null) { if (null !== $prefix) { $this->prefix = substr(md5($prefix), 0, 10) . '_'; } return $this->prefix; }
[ "public", "function", "prefix", "(", "$", "prefix", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "prefix", ")", "{", "$", "this", "->", "prefix", "=", "substr", "(", "md5", "(", "$", "prefix", ")", ",", "0", ",", "10", ")", ".", "'_'",...
Define prefix for Cache Application and return it. @param string $prefix Base prefix (Cache Application) @return string Return base prefix.
[ "Define", "prefix", "for", "Cache", "Application", "and", "return", "it", "." ]
c110441ac7bb20edd2ecd8162f4302596d875785
https://github.com/eureka-framework/component-cache/blob/c110441ac7bb20edd2ecd8162f4302596d875785/src/Cache/CacheWrapperAbstract.php#L144-L151
201,165
MinyFramework/Miny-Core
src/HTTP/Session.php
Session.destroy
public function destroy($reopen = false) { if ($this->isOpen) { $params = session_get_cookie_params(); setcookie( session_name(), '', time() - 42000, $params['path'], $params['domain'], $p...
php
public function destroy($reopen = false) { if ($this->isOpen) { $params = session_get_cookie_params(); setcookie( session_name(), '', time() - 42000, $params['path'], $params['domain'], $p...
[ "public", "function", "destroy", "(", "$", "reopen", "=", "false", ")", "{", "if", "(", "$", "this", "->", "isOpen", ")", "{", "$", "params", "=", "session_get_cookie_params", "(", ")", ";", "setcookie", "(", "session_name", "(", ")", ",", "''", ",", ...
Destroys the current session and its data.
[ "Destroys", "the", "current", "session", "and", "its", "data", "." ]
a1bfe801a44a49cf01f16411cb4663473e9c827c
https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L57-L76
201,166
MinyFramework/Miny-Core
src/HTTP/Session.php
Session.open
public function open($data = null) { if (!session_start()) { throw new \RuntimeException('Could not open session.'); } session_regenerate_id(true); $this->isOpen = true; if ($data === null) { if ($this->data === null) { $data =& $_SESS...
php
public function open($data = null) { if (!session_start()) { throw new \RuntimeException('Could not open session.'); } session_regenerate_id(true); $this->isOpen = true; if ($data === null) { if ($this->data === null) { $data =& $_SESS...
[ "public", "function", "open", "(", "$", "data", "=", "null", ")", "{", "if", "(", "!", "session_start", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Could not open session.'", ")", ";", "}", "session_regenerate_id", "(", "true", ")"...
Starts the session. Regenerates the session ID each request for security reasons and updates flash variables. @param mixed $data The data to use as session data. Pass null to use the previous data, if any. @throws \RuntimeException When the session can not be opened.
[ "Starts", "the", "session", ".", "Regenerates", "the", "session", "ID", "each", "request", "for", "security", "reasons", "and", "updates", "flash", "variables", "." ]
a1bfe801a44a49cf01f16411cb4663473e9c827c
https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L86-L113
201,167
MinyFramework/Miny-Core
src/HTTP/Session.php
Session.sessionName
public function sessionName($name = null) { if ($name === null) { return session_name(); } if ($this->isOpen) { throw new \InvalidArgumentException('The session has already been opened.'); } if (!is_string($name)) { throw new \InvalidArgume...
php
public function sessionName($name = null) { if ($name === null) { return session_name(); } if ($this->isOpen) { throw new \InvalidArgumentException('The session has already been opened.'); } if (!is_string($name)) { throw new \InvalidArgume...
[ "public", "function", "sessionName", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "===", "null", ")", "{", "return", "session_name", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isOpen", ")", "{", "throw", "new", "\\", "...
Sets or gets the session name. @param string $name the session name for the current session @throws \InvalidArgumentException @return string the current session name
[ "Sets", "or", "gets", "the", "session", "name", "." ]
a1bfe801a44a49cf01f16411cb4663473e9c827c
https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L134-L146
201,168
MinyFramework/Miny-Core
src/HTTP/Session.php
Session.savePath
public function savePath($path = null) { if ($path === null) { return session_save_path(); } if ($this->isOpen) { throw new \InvalidArgumentException('The session has already been opened.'); } if (!is_string($path)) { throw new \InvalidArgu...
php
public function savePath($path = null) { if ($path === null) { return session_save_path(); } if ($this->isOpen) { throw new \InvalidArgumentException('The session has already been opened.'); } if (!is_string($path)) { throw new \InvalidArgu...
[ "public", "function", "savePath", "(", "$", "path", "=", "null", ")", "{", "if", "(", "$", "path", "===", "null", ")", "{", "return", "session_save_path", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isOpen", ")", "{", "throw", "new", "\\", ...
Sets or gets the current session save path. @param string|null $path @throws \InvalidArgumentException @return string the current session save path.
[ "Sets", "or", "gets", "the", "current", "session", "save", "path", "." ]
a1bfe801a44a49cf01f16411cb4663473e9c827c
https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L156-L171
201,169
wb-crowdfusion/crowdfusion
system/context/Events.php
Events.trigger
public function trigger($eventName, $arg1 = 'NULLPARAMETER') { $this->Logger->debug('Triggering event ['.$eventName.']'); if(($event = $this->ApplicationContext->getEvent($eventName)) == false) return; $args = array(); $stack = null; if($arg1 !== 'NULLPARAMETER')...
php
public function trigger($eventName, $arg1 = 'NULLPARAMETER') { $this->Logger->debug('Triggering event ['.$eventName.']'); if(($event = $this->ApplicationContext->getEvent($eventName)) == false) return; $args = array(); $stack = null; if($arg1 !== 'NULLPARAMETER')...
[ "public", "function", "trigger", "(", "$", "eventName", ",", "$", "arg1", "=", "'NULLPARAMETER'", ")", "{", "$", "this", "->", "Logger", "->", "debug", "(", "'Triggering event ['", ".", "$", "eventName", ".", "']'", ")", ";", "if", "(", "(", "$", "even...
Trigger the event, passing parameters to callbacks All additional parameters beyond the first parameter {@link $eventName} will be passed through to the callback function as parameters. Executes all bound callbacks in ascending priority order. If two callbacks are bound with the same priority, they are executed in t...
[ "Trigger", "the", "event", "passing", "parameters", "to", "callbacks" ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/context/Events.php#L87-L136
201,170
RudyMas/filemanager
src/FileManager/FileManager.php
FileManager.createFolder
public function createFolder($folder, $allFolders = FALSE) { if (substr($folder, -1) != '/') $folder = $folder . '/'; if (!is_dir($folder)) { @mkdir($folder, 0777, $allFolders) or die ("Error creating folder '{$folder}'."); } }
php
public function createFolder($folder, $allFolders = FALSE) { if (substr($folder, -1) != '/') $folder = $folder . '/'; if (!is_dir($folder)) { @mkdir($folder, 0777, $allFolders) or die ("Error creating folder '{$folder}'."); } }
[ "public", "function", "createFolder", "(", "$", "folder", ",", "$", "allFolders", "=", "FALSE", ")", "{", "if", "(", "substr", "(", "$", "folder", ",", "-", "1", ")", "!=", "'/'", ")", "$", "folder", "=", "$", "folder", ".", "'/'", ";", "if", "("...
To create a new folder @param string $folder The folder to create @param bool $allFolders Allows the creation of nested directories specified in the pathname. (Default: FALSE)
[ "To", "create", "a", "new", "folder" ]
f47f0f07922221fd879fbbc66559c8cd89cdfe0d
https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L27-L33
201,171
RudyMas/filemanager
src/FileManager/FileManager.php
FileManager.moveFile
public function moveFile($file, $originalFolder, $newFolder) { if (substr($originalFolder, -1) != '/') $originalFolder = $originalFolder . '/'; if (substr($newFolder, -1) != '/') $newFolder = $newFolder . '/'; $this->copyFile($originalFolder . $file, $newFolder . $file); $this->delet...
php
public function moveFile($file, $originalFolder, $newFolder) { if (substr($originalFolder, -1) != '/') $originalFolder = $originalFolder . '/'; if (substr($newFolder, -1) != '/') $newFolder = $newFolder . '/'; $this->copyFile($originalFolder . $file, $newFolder . $file); $this->delet...
[ "public", "function", "moveFile", "(", "$", "file", ",", "$", "originalFolder", ",", "$", "newFolder", ")", "{", "if", "(", "substr", "(", "$", "originalFolder", ",", "-", "1", ")", "!=", "'/'", ")", "$", "originalFolder", "=", "$", "originalFolder", "...
To move a file @param string $file The file to move @param string $originalFolder The original folder where the file is @param string $newFolder The folder where the file has to go
[ "To", "move", "a", "file" ]
f47f0f07922221fd879fbbc66559c8cd89cdfe0d
https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L53-L59
201,172
RudyMas/filemanager
src/FileManager/FileManager.php
FileManager.copyFile
public function copyFile($originalFile, $newFile) { if (is_file($originalFile)) { @copy($originalFile, $newFile) or die("File '{$originalFile}' can't be copied to '{$newFile}'."); } else { die("File '{$originalFile}' doesn't exist."); } }
php
public function copyFile($originalFile, $newFile) { if (is_file($originalFile)) { @copy($originalFile, $newFile) or die("File '{$originalFile}' can't be copied to '{$newFile}'."); } else { die("File '{$originalFile}' doesn't exist."); } }
[ "public", "function", "copyFile", "(", "$", "originalFile", ",", "$", "newFile", ")", "{", "if", "(", "is_file", "(", "$", "originalFile", ")", ")", "{", "@", "copy", "(", "$", "originalFile", ",", "$", "newFile", ")", "or", "die", "(", "\"File '{$orig...
To copy a file @param string $originalFile Original file to copy @param string $newFile The copy of the original file
[ "To", "copy", "a", "file" ]
f47f0f07922221fd879fbbc66559c8cd89cdfe0d
https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L67-L74
201,173
RudyMas/filemanager
src/FileManager/FileManager.php
FileManager.readFolder
public function readFolder($folder, $sort = 0) { if (substr($folder, -1) != '/') $folder = $folder . '/'; $this->data = @scandir($folder, $sort) or die("Error reading folder: '{$folder}'."); $this->numberOfFiles = count($this->data); }
php
public function readFolder($folder, $sort = 0) { if (substr($folder, -1) != '/') $folder = $folder . '/'; $this->data = @scandir($folder, $sort) or die("Error reading folder: '{$folder}'."); $this->numberOfFiles = count($this->data); }
[ "public", "function", "readFolder", "(", "$", "folder", ",", "$", "sort", "=", "0", ")", "{", "if", "(", "substr", "(", "$", "folder", ",", "-", "1", ")", "!=", "'/'", ")", "$", "folder", "=", "$", "folder", ".", "'/'", ";", "$", "this", "->", ...
Reading the files and folders of a certain folder @param string $folder The folder to read @param int $sort How the data has to be sorted (Default: ascending) - SCANDIR_SORT_DESCENDING: Sort descending (z -> a) - SCANDIR_SORT_NONE: No sorting done $this->data An array with all the information of the fold...
[ "Reading", "the", "files", "and", "folders", "of", "a", "certain", "folder" ]
f47f0f07922221fd879fbbc66559c8cd89cdfe0d
https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L92-L97
201,174
RudyMas/filemanager
src/FileManager/FileManager.php
FileManager.processUploadedFile
public function processUploadedFile($originalFile, $newFile, $folder) { if (substr($folder, -1) != '/') $folder = $folder . '/'; @move_uploaded_file($originalFile, $folder . $newFile) or die("File: '{$originalFile}' couldn't be moved '{$folder}'."); @chmod($folder . $newFile, 0777) or die("E...
php
public function processUploadedFile($originalFile, $newFile, $folder) { if (substr($folder, -1) != '/') $folder = $folder . '/'; @move_uploaded_file($originalFile, $folder . $newFile) or die("File: '{$originalFile}' couldn't be moved '{$folder}'."); @chmod($folder . $newFile, 0777) or die("E...
[ "public", "function", "processUploadedFile", "(", "$", "originalFile", ",", "$", "newFile", ",", "$", "folder", ")", "{", "if", "(", "substr", "(", "$", "folder", ",", "-", "1", ")", "!=", "'/'", ")", "$", "folder", "=", "$", "folder", ".", "'/'", ...
Process an uploaded file and moved to a folder on the server @param string $originalFile The original file inside the temporary folder @param string $newFile The new name for the file @param string $folder The folder where the file has to go
[ "Process", "an", "uploaded", "file", "and", "moved", "to", "a", "folder", "on", "the", "server" ]
f47f0f07922221fd879fbbc66559c8cd89cdfe0d
https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L131-L136
201,175
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Relations/HasOneOrMany.php
HasOneOrMany.findOrNew
public function findOrNew($id, $columns = ['*']) { if (is_null($instance = $this->find($id, $columns))) { $instance = $this->related->newInstance(); $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); } return $instance; }
php
public function findOrNew($id, $columns = ['*']) { if (is_null($instance = $this->find($id, $columns))) { $instance = $this->related->newInstance(); $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); } return $instance; }
[ "public", "function", "findOrNew", "(", "$", "id", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "is_null", "(", "$", "instance", "=", "$", "this", "->", "find", "(", "$", "id", ",", "$", "columns", ")", ")", ")", "{", "$", ...
Find a model by its primary key or return new instance of the related model. @param mixed $id @param array $columns @return Model
[ "Find", "a", "model", "by", "its", "primary", "key", "or", "return", "new", "instance", "of", "the", "related", "model", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Relations/HasOneOrMany.php#L248-L257
201,176
djmattyg007/Handlebars
src/Tokenizer.php
Tokenizer.tokenize
public function tokenize($callback = null) { $this->reset(); if (!is_callable($callback)) { $callback = function() {}; } for ($line = 1, $i = 0; $i < $this->strlen; $i++) { if (mb_substr($this->source, $i, 1) === "\n") { $line++; }...
php
public function tokenize($callback = null) { $this->reset(); if (!is_callable($callback)) { $callback = function() {}; } for ($line = 1, $i = 0; $i < $this->strlen; $i++) { if (mb_substr($this->source, $i, 1) === "\n") { $line++; }...
[ "public", "function", "tokenize", "(", "$", "callback", "=", "null", ")", "{", "$", "this", "->", "reset", "(", ")", ";", "if", "(", "!", "is_callable", "(", "$", "callback", ")", ")", "{", "$", "callback", "=", "function", "(", ")", "{", "}", ";...
Main rendering function that passes tokens to the supplied callback. @param callable|null $callback @return Tokenizer
[ "Main", "rendering", "function", "that", "passes", "tokens", "to", "the", "supplied", "callback", "." ]
3f5b36ec22194cdc5d937a77aa71d500a760ebed
https://github.com/djmattyg007/Handlebars/blob/3f5b36ec22194cdc5d937a77aa71d500a760ebed/src/Tokenizer.php#L71-L115
201,177
djmattyg007/Handlebars
src/Tokenizer.php
Tokenizer.addNode
protected function addNode(int $start, string $type, int $line, int $offset1, int $offset2, $callback) { $this->flushText($start, $callback); switch ($type) { case self::TYPE_VARIABLE_ESCAPE: $end = $this->findVariable($start, true); break; ca...
php
protected function addNode(int $start, string $type, int $line, int $offset1, int $offset2, $callback) { $this->flushText($start, $callback); switch ($type) { case self::TYPE_VARIABLE_ESCAPE: $end = $this->findVariable($start, true); break; ca...
[ "protected", "function", "addNode", "(", "int", "$", "start", ",", "string", "$", "type", ",", "int", "$", "line", ",", "int", "$", "offset1", ",", "int", "$", "offset2", ",", "$", "callback", ")", "{", "$", "this", "->", "flushText", "(", "$", "st...
Forms the node and passes to the callback @param int $start @param string $type @param int $line @param int $offset1 @param int $offset2 @param callable $callback @return Tokenizer
[ "Forms", "the", "node", "and", "passes", "to", "the", "callback" ]
3f5b36ec22194cdc5d937a77aa71d500a760ebed
https://github.com/djmattyg007/Handlebars/blob/3f5b36ec22194cdc5d937a77aa71d500a760ebed/src/Tokenizer.php#L128-L163
201,178
djmattyg007/Handlebars
src/Tokenizer.php
Tokenizer.findVariable
protected function findVariable(int $i, bool $escape): int { $close = ($escape === true ? '}}}' : '}}'); for (; mb_substr($this->source, $i, mb_strlen($close)) !== $close; $i++) { } return $i + mb_strlen($close); }
php
protected function findVariable(int $i, bool $escape): int { $close = ($escape === true ? '}}}' : '}}'); for (; mb_substr($this->source, $i, mb_strlen($close)) !== $close; $i++) { } return $i + mb_strlen($close); }
[ "protected", "function", "findVariable", "(", "int", "$", "i", ",", "bool", "$", "escape", ")", ":", "int", "{", "$", "close", "=", "(", "$", "escape", "===", "true", "?", "'}}}'", ":", "'}}'", ")", ";", "for", "(", ";", "mb_substr", "(", "$", "t...
Since we know where the start is, we need to find the end in the source. @param int $i @param bool $escape @return int
[ "Since", "we", "know", "where", "the", "start", "is", "we", "need", "to", "find", "the", "end", "in", "the", "source", "." ]
3f5b36ec22194cdc5d937a77aa71d500a760ebed
https://github.com/djmattyg007/Handlebars/blob/3f5b36ec22194cdc5d937a77aa71d500a760ebed/src/Tokenizer.php#L202-L210
201,179
Facebook-Anonymous-Publisher/shortener
src/Drivers/Base.php
Base.save
protected function save($origin, $short = null) { $shortener = Shortener::updateOrCreate( ['hash' => hash('sha512', $origin)], ['url' => $origin, 'short' => $short] ); return $shortener->exists ? $shortener->getKey() : false; }
php
protected function save($origin, $short = null) { $shortener = Shortener::updateOrCreate( ['hash' => hash('sha512', $origin)], ['url' => $origin, 'short' => $short] ); return $shortener->exists ? $shortener->getKey() : false; }
[ "protected", "function", "save", "(", "$", "origin", ",", "$", "short", "=", "null", ")", "{", "$", "shortener", "=", "Shortener", "::", "updateOrCreate", "(", "[", "'hash'", "=>", "hash", "(", "'sha512'", ",", "$", "origin", ")", "]", ",", "[", "'ur...
Save record to database. @param string $origin @param string|null $short @return mixed
[ "Save", "record", "to", "database", "." ]
3b2e49d9cdd96758d35cf57a7a27659d2b6682aa
https://github.com/Facebook-Anonymous-Publisher/shortener/blob/3b2e49d9cdd96758d35cf57a7a27659d2b6682aa/src/Drivers/Base.php#L17-L25
201,180
fridge-project/dbal
src/Fridge/DBAL/Schema/Index.php
Index.addColumnName
public function addColumnName($columnName) { if (!is_string($columnName) || (strlen($columnName) <= 0)) { throw SchemaException::invalidIndexColumnName($this->getName()); } $this->columnNames[] = $columnName; }
php
public function addColumnName($columnName) { if (!is_string($columnName) || (strlen($columnName) <= 0)) { throw SchemaException::invalidIndexColumnName($this->getName()); } $this->columnNames[] = $columnName; }
[ "public", "function", "addColumnName", "(", "$", "columnName", ")", "{", "if", "(", "!", "is_string", "(", "$", "columnName", ")", "||", "(", "strlen", "(", "$", "columnName", ")", "<=", "0", ")", ")", "{", "throw", "SchemaException", "::", "invalidIndex...
Adds a column name to the index. @param string $columnName The column name to add. @throws \Fridge\DBAL\Exception\SchemaException If the column name is not a valid string.
[ "Adds", "a", "column", "name", "to", "the", "index", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Index.php#L77-L84
201,181
fridge-project/dbal
src/Fridge/DBAL/Schema/Index.php
Index.setUnique
public function setUnique($unique) { if (!is_bool($unique)) { throw SchemaException::invalidIndexUniqueFlag($this->getName()); } $this->unique = $unique; }
php
public function setUnique($unique) { if (!is_bool($unique)) { throw SchemaException::invalidIndexUniqueFlag($this->getName()); } $this->unique = $unique; }
[ "public", "function", "setUnique", "(", "$", "unique", ")", "{", "if", "(", "!", "is_bool", "(", "$", "unique", ")", ")", "{", "throw", "SchemaException", "::", "invalidIndexUniqueFlag", "(", "$", "this", "->", "getName", "(", ")", ")", ";", "}", "$", ...
Sets the unique index flag. @param boolean $unique TRUE if the index is unique else FALSE. @throws \Fridge\DBAL\Exception\SchemaException If the unique flag is not a boolean.
[ "Sets", "the", "unique", "index", "flag", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Index.php#L103-L110
201,182
fridge-project/dbal
src/Fridge/DBAL/Schema/Index.php
Index.isBetterThan
public function isBetterThan(Index $index) { if ($this->hasSameColumnNames($index->getColumnNames()) && $this->isUnique() && !$index->isUnique()) { return true; } return false; }
php
public function isBetterThan(Index $index) { if ($this->hasSameColumnNames($index->getColumnNames()) && $this->isUnique() && !$index->isUnique()) { return true; } return false; }
[ "public", "function", "isBetterThan", "(", "Index", "$", "index", ")", "{", "if", "(", "$", "this", "->", "hasSameColumnNames", "(", "$", "index", "->", "getColumnNames", "(", ")", ")", "&&", "$", "this", "->", "isUnique", "(", ")", "&&", "!", "$", "...
Checks if the index is better than the given index. Better means the index can replace the given. @param Fridge\DBAL\Schema\Index $index The candidate index. @return boolean TRUE if the index is better than the given else FALSE.
[ "Checks", "if", "the", "index", "is", "better", "than", "the", "given", "index", ".", "Better", "means", "the", "index", "can", "replace", "the", "given", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Index.php#L142-L149
201,183
ciims/ciims-modules-api
controllers/UserController.php
UserController.createUser
private function createUser($sendEmail = true) { $model = new RegisterForm; if (!empty($_POST)) { $model->attributes = $_POST; // Save the user's information if ($model->save($sendEmail)) return Users::model()->findByAttributes(array('email' => $_POST['email']))->getAPIAttributes(array('...
php
private function createUser($sendEmail = true) { $model = new RegisterForm; if (!empty($_POST)) { $model->attributes = $_POST; // Save the user's information if ($model->save($sendEmail)) return Users::model()->findByAttributes(array('email' => $_POST['email']))->getAPIAttributes(array('...
[ "private", "function", "createUser", "(", "$", "sendEmail", "=", "true", ")", "{", "$", "model", "=", "new", "RegisterForm", ";", "if", "(", "!", "empty", "(", "$", "_POST", ")", ")", "{", "$", "model", "->", "attributes", "=", "$", "_POST", ";", "...
Utilizes the registration form to create a new user @return array
[ "Utilizes", "the", "registration", "form", "to", "create", "a", "new", "user" ]
4351855328da0b112ac27bde7e7e07e212be8689
https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/UserController.php#L222-L238
201,184
Vectrex/vxPHP
src/Debug/ErrorHandler.php
ErrorHandler.handle
public function handle($errorLevel, $message, $file, $line, $context) { if ($this->errorLevel === 0) { return FALSE; } if ( $this->displayErrors && error_reporting() & $errorLevel && $this->errorLevel & $errorLevel ) { throw new \ErrorException(sprintf( '%s: %s in %s line %d', isset($th...
php
public function handle($errorLevel, $message, $file, $line, $context) { if ($this->errorLevel === 0) { return FALSE; } if ( $this->displayErrors && error_reporting() & $errorLevel && $this->errorLevel & $errorLevel ) { throw new \ErrorException(sprintf( '%s: %s in %s line %d', isset($th...
[ "public", "function", "handle", "(", "$", "errorLevel", ",", "$", "message", ",", "$", "file", ",", "$", "line", ",", "$", "context", ")", "{", "if", "(", "$", "this", "->", "errorLevel", "===", "0", ")", "{", "return", "FALSE", ";", "}", "if", "...
handle error and throw exception when error level limits are met @param integer $errorLevel @param string $message @param string $file @param string $line @param string $context @throws \ErrorException @return boolean
[ "handle", "error", "and", "throw", "exception", "when", "error", "level", "limits", "are", "met" ]
295c21b00e7ef6085efcdf5b64fabb28d499b5a6
https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Debug/ErrorHandler.php#L133-L154
201,185
rougin/blueprint
src/Blueprint.php
Blueprint.setTemplatePath
public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = []) { $this->paths['templates'] = $path; if (is_null($twig) === true) { $loader = new \Twig_Loader_Filesystem($path); $twig = new \Twig_Environment($loader); } $twig->setEx...
php
public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = []) { $this->paths['templates'] = $path; if (is_null($twig) === true) { $loader = new \Twig_Loader_Filesystem($path); $twig = new \Twig_Environment($loader); } $twig->setEx...
[ "public", "function", "setTemplatePath", "(", "$", "path", ",", "\\", "Twig_Environment", "$", "twig", "=", "null", ",", "$", "extensions", "=", "[", "]", ")", "{", "$", "this", "->", "paths", "[", "'templates'", "]", "=", "$", "path", ";", "if", "("...
Sets the templates path. @param string $path @param \Twig_Environment|null $twig @param array $extensions @return self
[ "Sets", "the", "templates", "path", "." ]
02dab857b0fab60e060632f11f73e24467483e5b
https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Blueprint.php#L70-L85
201,186
rougin/blueprint
src/Blueprint.php
Blueprint.run
public function run($console = false) { $instance = $this->console(); return $console ? $instance : $instance->run(); }
php
public function run($console = false) { $instance = $this->console(); return $console ? $instance : $instance->run(); }
[ "public", "function", "run", "(", "$", "console", "=", "false", ")", "{", "$", "instance", "=", "$", "this", "->", "console", "(", ")", ";", "return", "$", "console", "?", "$", "instance", ":", "$", "instance", "->", "run", "(", ")", ";", "}" ]
Runs the current console. @param boolean $console @return \Symfony\Component\Console\Application|boolean
[ "Runs", "the", "current", "console", "." ]
02dab857b0fab60e060632f11f73e24467483e5b
https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Blueprint.php#L139-L144
201,187
rougin/blueprint
src/Blueprint.php
Blueprint.console
protected function console() { $files = glob($this->getCommandPath() . '/*.php'); $path = strlen($this->getCommandPath() . DIRECTORY_SEPARATOR); $pattern = '/\\.[^.\\s]{3,4}$/'; foreach ((array) $files as $file) { $class = preg_replace($pattern, '', substr($file, $path...
php
protected function console() { $files = glob($this->getCommandPath() . '/*.php'); $path = strlen($this->getCommandPath() . DIRECTORY_SEPARATOR); $pattern = '/\\.[^.\\s]{3,4}$/'; foreach ((array) $files as $file) { $class = preg_replace($pattern, '', substr($file, $path...
[ "protected", "function", "console", "(", ")", "{", "$", "files", "=", "glob", "(", "$", "this", "->", "getCommandPath", "(", ")", ".", "'/*.php'", ")", ";", "$", "path", "=", "strlen", "(", "$", "this", "->", "getCommandPath", "(", ")", ".", "DIRECTO...
Sets up Twig and gets all commands from the specified path. @return \Symfony\Component\Console\Application
[ "Sets", "up", "Twig", "and", "gets", "all", "commands", "from", "the", "specified", "path", "." ]
02dab857b0fab60e060632f11f73e24467483e5b
https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Blueprint.php#L151-L172
201,188
story75/FileToClassMapper
src/Mapper.php
Mapper.createMap
public function createMap(...$paths) { $classes = []; $this->finder->files() ->ignoreUnreadableDirs() ->in($paths); foreach($this->excludePathPatterns as $exclude) { $this->finder->notPath($exclude); } foreach($this->inPathPatter...
php
public function createMap(...$paths) { $classes = []; $this->finder->files() ->ignoreUnreadableDirs() ->in($paths); foreach($this->excludePathPatterns as $exclude) { $this->finder->notPath($exclude); } foreach($this->inPathPatter...
[ "public", "function", "createMap", "(", "...", "$", "paths", ")", "{", "$", "classes", "=", "[", "]", ";", "$", "this", "->", "finder", "->", "files", "(", ")", "->", "ignoreUnreadableDirs", "(", ")", "->", "in", "(", "$", "paths", ")", ";", "forea...
Create a map for a given path @param array $paths @return array
[ "Create", "a", "map", "for", "a", "given", "path" ]
c28328fb0df67171e4c5a40c96aca9ed74533d12
https://github.com/story75/FileToClassMapper/blob/c28328fb0df67171e4c5a40c96aca9ed74533d12/src/Mapper.php#L77-L125
201,189
fridge-project/dbal
src/Fridge/DBAL/Schema/Comparator/ColumnComparator.php
ColumnComparator.compare
public function compare(Column $oldColumn, Column $newColumn) { $differences = array(); if ($oldColumn->getType() !== $newColumn->getType()) { $differences[] = 'type'; } if ($oldColumn->getLength() !== $newColumn->getLength()) { $differences[] = 'length'; ...
php
public function compare(Column $oldColumn, Column $newColumn) { $differences = array(); if ($oldColumn->getType() !== $newColumn->getType()) { $differences[] = 'type'; } if ($oldColumn->getLength() !== $newColumn->getLength()) { $differences[] = 'length'; ...
[ "public", "function", "compare", "(", "Column", "$", "oldColumn", ",", "Column", "$", "newColumn", ")", "{", "$", "differences", "=", "array", "(", ")", ";", "if", "(", "$", "oldColumn", "->", "getType", "(", ")", "!==", "$", "newColumn", "->", "getTyp...
Compares two columns. @param \Fridge\DBAL\Schema\Column $oldColumn The old column. @param \Fridge\DBAL\Schema\Column $newColumn The new column. @return \Fridge\DBAL\Schema\Diff\ColumnDiff The difference between the two columns.
[ "Compares", "two", "columns", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Comparator/ColumnComparator.php#L32-L77
201,190
ARCANESOFT/Blog
src/Models/Post.php
Post.scopePublishedAt
public function scopePublishedAt(Builder $query, $year) { return $this->scopePublished($query) ->where(DB::raw('YEAR(published_at)'), $year); }
php
public function scopePublishedAt(Builder $query, $year) { return $this->scopePublished($query) ->where(DB::raw('YEAR(published_at)'), $year); }
[ "public", "function", "scopePublishedAt", "(", "Builder", "$", "query", ",", "$", "year", ")", "{", "return", "$", "this", "->", "scopePublished", "(", "$", "query", ")", "->", "where", "(", "DB", "::", "raw", "(", "'YEAR(published_at)'", ")", ",", "$", ...
Scope only published posts. @param \Illuminate\Database\Eloquent\Builder $query @param int $year @return \Illuminate\Database\Eloquent\Builder
[ "Scope", "only", "published", "posts", "." ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Models/Post.php#L136-L140
201,191
ARCANESOFT/Blog
src/Models/Post.php
Post.extractSeoAttributes
protected static function extractSeoAttributes(array $inputs) { return [ 'title' => Arr::get($inputs, 'seo_title'), 'description' => Arr::get($inputs, 'seo_description'), 'keywords' => Arr::get($inputs, 'seo_keywords'), 'metas' => Arr::get($inpu...
php
protected static function extractSeoAttributes(array $inputs) { return [ 'title' => Arr::get($inputs, 'seo_title'), 'description' => Arr::get($inputs, 'seo_description'), 'keywords' => Arr::get($inputs, 'seo_keywords'), 'metas' => Arr::get($inpu...
[ "protected", "static", "function", "extractSeoAttributes", "(", "array", "$", "inputs", ")", "{", "return", "[", "'title'", "=>", "Arr", "::", "get", "(", "$", "inputs", ",", "'seo_title'", ")", ",", "'description'", "=>", "Arr", "::", "get", "(", "$", "...
Extract the seo attributes. @param array $inputs @return array
[ "Extract", "the", "seo", "attributes", "." ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Models/Post.php#L321-L329
201,192
BenjaminMedia/video-helper
src/VideoHelper.php
VideoHelper.identify_service
public static function identify_service($url) { if (preg_match('%youtube|youtu\.be%i', $url)) { return self::YOUTUBE; } elseif (preg_match('%vimeo%i', $url)) { return self::VIMEO; } elseif (preg_match('%23video%', $url)) { return self::TWENTYTHREE; ...
php
public static function identify_service($url) { if (preg_match('%youtube|youtu\.be%i', $url)) { return self::YOUTUBE; } elseif (preg_match('%vimeo%i', $url)) { return self::VIMEO; } elseif (preg_match('%23video%', $url)) { return self::TWENTYTHREE; ...
[ "public", "static", "function", "identify_service", "(", "$", "url", ")", "{", "if", "(", "preg_match", "(", "'%youtube|youtu\\.be%i'", ",", "$", "url", ")", ")", "{", "return", "self", "::", "YOUTUBE", ";", "}", "elseif", "(", "preg_match", "(", "'%vimeo%...
Determines which cloud video provider is being used based on the passed url. @param string $url The url @return null|string Null on failure to match, the service's name on success
[ "Determines", "which", "cloud", "video", "provider", "is", "being", "used", "based", "on", "the", "passed", "url", "." ]
0ab5e775899d56ee9dc23314ca842c6275817487
https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L24-L34
201,193
BenjaminMedia/video-helper
src/VideoHelper.php
VideoHelper.get_url_id
public static function get_url_id($url) { $service = self::identify_service($url); //TODO use a function for this, it is duplicated if ($service == self::YOUTUBE) { return self::get_youtube_id($url); } elseif ($service == self::VIMEO) { return self::get_vimeo_...
php
public static function get_url_id($url) { $service = self::identify_service($url); //TODO use a function for this, it is duplicated if ($service == self::YOUTUBE) { return self::get_youtube_id($url); } elseif ($service == self::VIMEO) { return self::get_vimeo_...
[ "public", "static", "function", "get_url_id", "(", "$", "url", ")", "{", "$", "service", "=", "self", "::", "identify_service", "(", "$", "url", ")", ";", "//TODO use a function for this, it is duplicated", "if", "(", "$", "service", "==", "self", "::", "YOUTU...
Determines which cloud video provider is being used based on the passed url, and extracts the video id from the url. @param string $url The url @return null|string Null on failure, the video's id on success
[ "Determines", "which", "cloud", "video", "provider", "is", "being", "used", "based", "on", "the", "passed", "url", "and", "extracts", "the", "video", "id", "from", "the", "url", "." ]
0ab5e775899d56ee9dc23314ca842c6275817487
https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L43-L55
201,194
BenjaminMedia/video-helper
src/VideoHelper.php
VideoHelper.get_url_embed
public static function get_url_embed($url) { $service = self::identify_service($url); $id = self::get_url_id($url); if ($service == self::YOUTUBE) { return self::get_youtube_embed($id); } elseif ($service == self::VIMEO) { return self::get_vimeo_embed($id); ...
php
public static function get_url_embed($url) { $service = self::identify_service($url); $id = self::get_url_id($url); if ($service == self::YOUTUBE) { return self::get_youtube_embed($id); } elseif ($service == self::VIMEO) { return self::get_vimeo_embed($id); ...
[ "public", "static", "function", "get_url_embed", "(", "$", "url", ")", "{", "$", "service", "=", "self", "::", "identify_service", "(", "$", "url", ")", ";", "$", "id", "=", "self", "::", "get_url_id", "(", "$", "url", ")", ";", "if", "(", "$", "se...
Determines which cloud video provider is being used based on the passed url, extracts the video id from the url, and builds an embed url. @param string $url The url @return null|string Null on failure, the video's embed url on success
[ "Determines", "which", "cloud", "video", "provider", "is", "being", "used", "based", "on", "the", "passed", "url", "extracts", "the", "video", "id", "from", "the", "url", "and", "builds", "an", "embed", "url", "." ]
0ab5e775899d56ee9dc23314ca842c6275817487
https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L64-L78
201,195
BenjaminMedia/video-helper
src/VideoHelper.php
VideoHelper.get_youtube_id
public static function get_youtube_id($input) { // match: <iframe width="560" height="315" src="https://www.youtube.com/embed/dXxEIZTkqMg" ... // match: https://www.youtube.com/embed/dXxEIZTkqMg if (preg_match('#/embed/([^\?&"]+)#', $input, $matches)) { return $matches[1]; ...
php
public static function get_youtube_id($input) { // match: <iframe width="560" height="315" src="https://www.youtube.com/embed/dXxEIZTkqMg" ... // match: https://www.youtube.com/embed/dXxEIZTkqMg if (preg_match('#/embed/([^\?&"]+)#', $input, $matches)) { return $matches[1]; ...
[ "public", "static", "function", "get_youtube_id", "(", "$", "input", ")", "{", "// match: <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/dXxEIZTkqMg\" ...", "// match: https://www.youtube.com/embed/dXxEIZTkqMg", "if", "(", "preg_match", "(", "'#/embed/([^\\?&\...
Parses various youtube urls and returns video identifier. @param string $input The url or the embed code @return string the url's id
[ "Parses", "various", "youtube", "urls", "and", "returns", "video", "identifier", "." ]
0ab5e775899d56ee9dc23314ca842c6275817487
https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L87-L107
201,196
BenjaminMedia/video-helper
src/VideoHelper.php
VideoHelper.get_vimeo_id
public static function get_vimeo_id($input) { // match: https://vimeo.com/39502360 if (preg_match('#/vimeo.com/(\d+)#', $input, $matches)) { return $matches[1]; } // match: <iframe src="https://player.vimeo.com/video/39502360" width="640" height="480" frameborder="0" ......
php
public static function get_vimeo_id($input) { // match: https://vimeo.com/39502360 if (preg_match('#/vimeo.com/(\d+)#', $input, $matches)) { return $matches[1]; } // match: <iframe src="https://player.vimeo.com/video/39502360" width="640" height="480" frameborder="0" ......
[ "public", "static", "function", "get_vimeo_id", "(", "$", "input", ")", "{", "// match: https://vimeo.com/39502360", "if", "(", "preg_match", "(", "'#/vimeo.com/(\\d+)#'", ",", "$", "input", ",", "$", "matches", ")", ")", "{", "return", "$", "matches", "[", "1...
Parses various vimeo urls and returns video identifier. @param string $input The url or the embed code @return string The url's id
[ "Parses", "various", "vimeo", "urls", "and", "returns", "video", "identifier", "." ]
0ab5e775899d56ee9dc23314ca842c6275817487
https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L129-L142
201,197
wb-crowdfusion/crowdfusion
system/core/classes/systemdb/elements/ElementService.php
ElementService.findAllWithAspect
public function findAllWithAspect($aspectName, $restrictSiteSlug = null) { // if (!$this->AspectService->getBySlug($aspectName)) // throw new Exception('Cannot find Elements with Aspect ['.$aspectName.'], Aspect does not exist'); $dto = new DTO(); $dto->setParameter("IncludesAspe...
php
public function findAllWithAspect($aspectName, $restrictSiteSlug = null) { // if (!$this->AspectService->getBySlug($aspectName)) // throw new Exception('Cannot find Elements with Aspect ['.$aspectName.'], Aspect does not exist'); $dto = new DTO(); $dto->setParameter("IncludesAspe...
[ "public", "function", "findAllWithAspect", "(", "$", "aspectName", ",", "$", "restrictSiteSlug", "=", "null", ")", "{", "// if (!$this->AspectService->getBySlug($aspectName))", "// throw new Exception('Cannot find Elements with Aspect ['.$aspectName.'], Aspect does not ...
Returns all elements that have the specified aspect @param string $aspectName The name of the desired aspect @return array An array of the results
[ "Returns", "all", "elements", "that", "have", "the", "specified", "aspect" ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/elements/ElementService.php#L52-L66
201,198
wb-crowdfusion/crowdfusion
system/core/classes/systemdb/elements/ElementService.php
ElementService.findAllFromString
public function findAllFromString($aspectsOrElements) { $results = array(); foreach (explode(',', $aspectsOrElements) as $aspectOrElement) { $aspectOrElement = trim($aspectOrElement); if (substr($aspectOrElement, 0, 1) == '@') { $els = $this->findAllWithAspect...
php
public function findAllFromString($aspectsOrElements) { $results = array(); foreach (explode(',', $aspectsOrElements) as $aspectOrElement) { $aspectOrElement = trim($aspectOrElement); if (substr($aspectOrElement, 0, 1) == '@') { $els = $this->findAllWithAspect...
[ "public", "function", "findAllFromString", "(", "$", "aspectsOrElements", ")", "{", "$", "results", "=", "array", "(", ")", ";", "foreach", "(", "explode", "(", "','", ",", "$", "aspectsOrElements", ")", "as", "$", "aspectOrElement", ")", "{", "$", "aspect...
Returns all elements for given aspect names and element slugs @param string $aspectOrElement Comma separated list of aspects names and/or elements slugs @return array An array of Element keyed by the elements' ids
[ "Returns", "all", "elements", "for", "given", "aspect", "names", "and", "element", "slugs" ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/elements/ElementService.php#L76-L93
201,199
EXSyst/IO
StringReader.php
StringReader.read
public function read($byteCount, $allowIncomplete = false) { $maxByteCount = $this->getRemainingByteCount(); if (!$allowIncomplete && $maxByteCount < $byteCount) { throw new Exception\UnderflowException('The source doesn\'t have enough remaining data to fulfill the request'); } ...
php
public function read($byteCount, $allowIncomplete = false) { $maxByteCount = $this->getRemainingByteCount(); if (!$allowIncomplete && $maxByteCount < $byteCount) { throw new Exception\UnderflowException('The source doesn\'t have enough remaining data to fulfill the request'); } ...
[ "public", "function", "read", "(", "$", "byteCount", ",", "$", "allowIncomplete", "=", "false", ")", "{", "$", "maxByteCount", "=", "$", "this", "->", "getRemainingByteCount", "(", ")", ";", "if", "(", "!", "$", "allowIncomplete", "&&", "$", "maxByteCount"...
Reads and consumes data from the source. @param int $byteCount Number of bytes to read @param bool $allowIncomplete true to accept any amount of data smaller than or equal to the requested amount, false (default) to throw an exception if the exact requested amount cannot be read @throws Exception\UnderflowExce...
[ "Reads", "and", "consumes", "data", "from", "the", "source", "." ]
4c30ba79b09d2cc41d0a7cd340255a87cac54326
https://github.com/EXSyst/IO/blob/4c30ba79b09d2cc41d0a7cd340255a87cac54326/StringReader.php#L178-L190