repo
stringclasses
21 values
path
stringlengths
10
105
func_name
stringlengths
6
64
original_string
stringlengths
105
15.6k
language
stringclasses
1 value
code
stringlengths
105
15.6k
code_tokens
listlengths
29
2.15k
docstring
stringlengths
11
2.85k
docstring_tokens
listlengths
1
290
sha
stringclasses
21 values
url
stringlengths
100
194
partition
stringclasses
1 value
summary
stringlengths
8
319
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
z-song/laravel-admin
src/Show/Field.php
Field.variables
protected function variables() { return [ 'content' => $this->value, 'escape' => $this->escape, 'label' => $this->getLabel(), 'wrapped' => $this->border, 'width' => $this->width, ]; }
php
protected function variables() { return [ 'content' => $this->value, 'escape' => $this->escape, 'label' => $this->getLabel(), 'wrapped' => $this->border, 'width' => $this->width, ]; }
[ "protected", "function", "variables", "(", ")", "{", "return", "[", "'content'", "=>", "$", "this", "->", "value", ",", "'escape'", "=>", "$", "this", "->", "escape", ",", "'label'", "=>", "$", "this", "->", "getLabel", "(", ")", ",", "'wrapped'", "=>"...
Get all variables passed to field view. @return array
[ "Get", "all", "variables", "passed", "to", "field", "view", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Field.php#L545-L554
train
Return variables of the form control
[ 30522, 5123, 3853, 10857, 1006, 1007, 1063, 2709, 1031, 1005, 4180, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 3643, 1010, 1005, 4019, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 4019, 1010, 1005, 3830, 1005, 1027, 1028, 1002, 2023, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/Table.php
Table.fillNextRows
private function fillNextRows(array $rows, int $line): array { $unmergedRows = []; foreach ($rows[$line] as $column => $cell) { if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) { throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell))); } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; $lines = [$cell]; if (strstr($cell, "\n")) { $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell)); $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan()]); unset($lines[0]); } // create a two dimensional array (rowspan x colspan) $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows); foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan()]); if ($nbLines === $unmergedRowKey - $line) { break; } } } } foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { // we need to know if $unmergedRow will be merged or inserted into $rows if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { foreach ($unmergedRow as $cellKey => $cell) { // insert cell into row at cellKey position array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]); } } else { $row = $this->copyRow($rows, $unmergedRowKey - 1); foreach ($unmergedRow as $column => $cell) { if (!empty($cell)) { $row[$column] = $unmergedRow[$column]; } } array_splice($rows, $unmergedRowKey, 0, [$row]); } } return $rows; }
php
private function fillNextRows(array $rows, int $line): array { $unmergedRows = []; foreach ($rows[$line] as $column => $cell) { if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) { throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell))); } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; $lines = [$cell]; if (strstr($cell, "\n")) { $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell)); $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan()]); unset($lines[0]); } // create a two dimensional array (rowspan x colspan) $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows); foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan()]); if ($nbLines === $unmergedRowKey - $line) { break; } } } } foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { // we need to know if $unmergedRow will be merged or inserted into $rows if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { foreach ($unmergedRow as $cellKey => $cell) { // insert cell into row at cellKey position array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]); } } else { $row = $this->copyRow($rows, $unmergedRowKey - 1); foreach ($unmergedRow as $column => $cell) { if (!empty($cell)) { $row[$column] = $unmergedRow[$column]; } } array_splice($rows, $unmergedRowKey, 0, [$row]); } } return $rows; }
[ "private", "function", "fillNextRows", "(", "array", "$", "rows", ",", "int", "$", "line", ")", ":", "array", "{", "$", "unmergedRows", "=", "[", "]", ";", "foreach", "(", "$", "rows", "[", "$", "line", "]", "as", "$", "column", "=>", "$", "cell", ...
fill rows that contains rowspan > 1. @throws InvalidArgumentException
[ "fill", "rows", "that", "contains", "rowspan", ">", "1", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L581-L630
train
Fill next rows
[ 30522, 2797, 3853, 6039, 2638, 18413, 10524, 2015, 1006, 9140, 1002, 10281, 1010, 20014, 1002, 2240, 1007, 1024, 9140, 1063, 1002, 4895, 5017, 5999, 10524, 2015, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 10281, 1031, 1002, 2240, 1033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Live/VisitorDetails.php
VisitorDetails.getReferrerSummaryForVisit
public static function getReferrerSummaryForVisit($visit) { $referrerType = $visit->getColumn('referrerType'); if ($referrerType === false || $referrerType == 'direct' ) { return Piwik::translate('Referrers_DirectEntry'); } if ($referrerType == 'search') { $referrerName = $visit->getColumn('referrerName'); $keyword = $visit->getColumn('referrerKeyword'); if ($keyword !== false && $keyword != APIReferrers::getKeywordNotDefinedString() ) { $referrerName .= ' (' . $keyword . ')'; } return $referrerName; } if ($referrerType == 'campaign') { $summary = Piwik::translate('Referrers_ColumnCampaign') . ': ' . $visit->getColumn('referrerName'); $keyword = $visit->getColumn('referrerKeyword'); if (!empty($keyword)) { $summary .= ' - ' . $keyword; } return $summary; } return $visit->getColumn('referrerName'); }
php
public static function getReferrerSummaryForVisit($visit) { $referrerType = $visit->getColumn('referrerType'); if ($referrerType === false || $referrerType == 'direct' ) { return Piwik::translate('Referrers_DirectEntry'); } if ($referrerType == 'search') { $referrerName = $visit->getColumn('referrerName'); $keyword = $visit->getColumn('referrerKeyword'); if ($keyword !== false && $keyword != APIReferrers::getKeywordNotDefinedString() ) { $referrerName .= ' (' . $keyword . ')'; } return $referrerName; } if ($referrerType == 'campaign') { $summary = Piwik::translate('Referrers_ColumnCampaign') . ': ' . $visit->getColumn('referrerName'); $keyword = $visit->getColumn('referrerKeyword'); if (!empty($keyword)) { $summary .= ' - ' . $keyword; } return $summary; } return $visit->getColumn('referrerName'); }
[ "public", "static", "function", "getReferrerSummaryForVisit", "(", "$", "visit", ")", "{", "$", "referrerType", "=", "$", "visit", "->", "getColumn", "(", "'referrerType'", ")", ";", "if", "(", "$", "referrerType", "===", "false", "||", "$", "referrerType", ...
Returns a summary for a visit's referral. @param DataTable\Row $visit @return bool|mixed|string
[ "Returns", "a", "summary", "for", "a", "visit", "s", "referral", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/VisitorDetails.php#L255-L288
train
Returns the summary of the referrer name for a given visit
[ 30522, 2270, 10763, 3853, 2131, 2890, 7512, 14544, 17421, 7849, 2100, 29278, 11365, 4183, 1006, 1002, 3942, 1007, 1063, 1002, 6523, 14544, 13874, 1027, 1002, 3942, 1011, 1028, 2131, 25778, 2819, 2078, 1006, 1005, 6523, 14544, 13874, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/CacheManager.php
CacheManager.repository
public function repository(Store $store) { $repository = new Repository($store); if ($this->app->bound(DispatcherContract::class)) { $repository->setEventDispatcher( $this->app[DispatcherContract::class] ); } return $repository; }
php
public function repository(Store $store) { $repository = new Repository($store); if ($this->app->bound(DispatcherContract::class)) { $repository->setEventDispatcher( $this->app[DispatcherContract::class] ); } return $repository; }
[ "public", "function", "repository", "(", "Store", "$", "store", ")", "{", "$", "repository", "=", "new", "Repository", "(", "$", "store", ")", ";", "if", "(", "$", "this", "->", "app", "->", "bound", "(", "DispatcherContract", "::", "class", ")", ")", ...
Create a new cache repository with the given implementation. @param \Illuminate\Contracts\Cache\Store $store @return \Illuminate\Cache\Repository
[ "Create", "a", "new", "cache", "repository", "with", "the", "given", "implementation", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/CacheManager.php#L258-L269
train
Returns the repository for the given store
[ 30522, 2270, 3853, 22409, 1006, 3573, 1002, 3573, 1007, 1063, 1002, 22409, 1027, 2047, 22409, 1006, 1002, 3573, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 5391, 1006, 18365, 2121, 8663, 6494, 6593, 1024, 1024, 2465, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/DateFormat/DayTransformer.php
DayTransformer.format
public function format(\DateTime $dateTime, int $length): string { return $this->padLeft($dateTime->format('j'), $length); }
php
public function format(\DateTime $dateTime, int $length): string { return $this->padLeft($dateTime->format('j'), $length); }
[ "public", "function", "format", "(", "\\", "DateTime", "$", "dateTime", ",", "int", "$", "length", ")", ":", "string", "{", "return", "$", "this", "->", "padLeft", "(", "$", "dateTime", "->", "format", "(", "'j'", ")", ",", "$", "length", ")", ";", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/DayTransformer.php#L26-L29
train
Format a date time to a string
[ 30522, 2270, 3853, 4289, 1006, 1032, 3058, 7292, 1002, 3058, 7292, 1010, 20014, 1002, 3091, 1007, 1024, 5164, 1063, 2709, 1002, 2023, 1011, 1028, 11687, 2571, 6199, 1006, 1002, 3058, 7292, 1011, 1028, 4289, 1006, 1005, 1046, 1005, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Site.php
Site.getIdSitesFromIdSitesString
public static function getIdSitesFromIdSitesString($ids, $_restrictSitesToLogin = false) { if ($ids === 'all') { return API::getInstance()->getSitesIdWithAtLeastViewAccess($_restrictSitesToLogin); } if (is_bool($ids)) { return array(); } if (!is_array($ids)) { $ids = explode(',', $ids); } $validIds = array(); foreach ($ids as $id) { $id = trim($id); if (!empty($id) && is_numeric($id) && $id > 0) { $validIds[] = $id; } } $validIds = array_filter($validIds); $validIds = array_unique($validIds); return $validIds; }
php
public static function getIdSitesFromIdSitesString($ids, $_restrictSitesToLogin = false) { if ($ids === 'all') { return API::getInstance()->getSitesIdWithAtLeastViewAccess($_restrictSitesToLogin); } if (is_bool($ids)) { return array(); } if (!is_array($ids)) { $ids = explode(',', $ids); } $validIds = array(); foreach ($ids as $id) { $id = trim($id); if (!empty($id) && is_numeric($id) && $id > 0) { $validIds[] = $id; } } $validIds = array_filter($validIds); $validIds = array_unique($validIds); return $validIds; }
[ "public", "static", "function", "getIdSitesFromIdSitesString", "(", "$", "ids", ",", "$", "_restrictSitesToLogin", "=", "false", ")", "{", "if", "(", "$", "ids", "===", "'all'", ")", "{", "return", "API", "::", "getInstance", "(", ")", "->", "getSitesIdWithA...
Checks the given string for valid site IDs and returns them as an array. @param string|array $ids Comma separated idSite list, eg, `'1,2,3,4'` or an array of IDs, eg, `array(1, 2, 3, 4)`. @param bool|string $_restrictSitesToLogin Implementation detail. Used only when running as a scheduled task. @return array An array of valid, unique integers.
[ "Checks", "the", "given", "string", "for", "valid", "site", "IDs", "and", "returns", "them", "as", "an", "array", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Site.php#L426-L449
train
Returns an array of site IDs from a string containing the list of site IDs.
[ 30522, 2270, 10763, 3853, 2131, 9821, 7616, 19699, 20936, 5104, 7616, 3367, 4892, 1006, 1002, 8909, 2015, 1010, 1002, 1035, 21573, 28032, 4355, 12898, 11528, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 8909, 2015, 1027, 1027, 1027, 1005, 2035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OpenWork/SuiteAuth/ServiceProvider.php
ServiceProvider.register
public function register(Container $app) { $app['suite_ticket'] = function ($app) { return new SuiteTicket($app); }; isset($app['suite_access_token']) || $app['suite_access_token'] = function ($app) { return new AccessToken($app); }; }
php
public function register(Container $app) { $app['suite_ticket'] = function ($app) { return new SuiteTicket($app); }; isset($app['suite_access_token']) || $app['suite_access_token'] = function ($app) { return new AccessToken($app); }; }
[ "public", "function", "register", "(", "Container", "$", "app", ")", "{", "$", "app", "[", "'suite_ticket'", "]", "=", "function", "(", "$", "app", ")", "{", "return", "new", "SuiteTicket", "(", "$", "app", ")", ";", "}", ";", "isset", "(", "$", "a...
{@inheritdoc}.
[ "{" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenWork/SuiteAuth/ServiceProvider.php#L27-L36
train
Register the suite ticket and access token
[ 30522, 2270, 3853, 4236, 1006, 11661, 1002, 10439, 1007, 1063, 1002, 10439, 1031, 1005, 7621, 1035, 7281, 1005, 1033, 1027, 3853, 1006, 1002, 10439, 1007, 1063, 2709, 2047, 7621, 26348, 3388, 1006, 1002, 10439, 1007, 1025, 1065, 1025, 26354...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/Command/StopWorkersCommand.php
StopWorkersCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); $cacheItem = $this->restartSignalCachePool->getItem(StopWhenRestartSignalIsReceived::RESTART_REQUESTED_TIMESTAMP_KEY); $cacheItem->set(microtime(true)); $this->restartSignalCachePool->save($cacheItem); $io->success('Signal successfully sent to stop any running workers.'); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output); $cacheItem = $this->restartSignalCachePool->getItem(StopWhenRestartSignalIsReceived::RESTART_REQUESTED_TIMESTAMP_KEY); $cacheItem->set(microtime(true)); $this->restartSignalCachePool->save($cacheItem); $io->success('Signal successfully sent to stop any running workers.'); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", "instanceof", "ConsoleOutputInterface", "?", "$", "output", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Command/StopWorkersCommand.php#L64-L73
train
Executes the command.
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 22834, 1027, 2047, 25353, 2213, 14876, 4890, 21756, 2571, 1006, 1002, 30524, 1027, 1002, 2023, 1011, 1028, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Db/Adapter/Pdo/Mssql.php
Mssql.getConnection
public function getConnection() { // if we already have a PDO object, no need to re-connect. if ($this->_connection) { return $this->_connection; } $this->_pdoType = "sqlsrv"; // get the dsn first, because some adapters alter the $_pdoType //$dsn = $this->_dsn(); // check for PDO extension if (!extension_loaded('pdo')) { /** * @see Zend_Db_Adapter_Exception */ throw new \Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded'); } // check the PDO driver is available if (!in_array($this->_pdoType, PDO::getAvailableDrivers())) { /** * @see Zend_Db_Adapter_Exception */ throw new \Zend_Db_Adapter_Exception('The ' . $this->_pdoType . ' driver is not currently installed'); } // create PDO connection $q = $this->_profiler->queryStart('connect', Zend_Db_Profiler::CONNECT); // add the persistence flag if we find it in our config array if (isset($this->_config['persistent']) && ($this->_config['persistent'] == true)) { $this->_config['driver_options'][PDO::ATTR_PERSISTENT] = true; } try { $serverName = $this->_config["host"]; $database = $this->_config["dbname"]; if (is_null($database)) { $database = 'master'; } $uid = $this->_config['username']; $pwd = $this->_config['password']; if ($this->_config["port"] != "") { $serverName = $serverName . "," . $this->_config["port"]; } $this->_connection = new PDO("sqlsrv:$serverName", $uid, $pwd, array('Database' => $database)); if ($this->_connection === false) { die(self::FormatErrors(sqlsrv_errors())); } /* $this->_connection = new PDO( $dsn, $this->_config['username'], $this->_config['password'], $this->_config['driver_options'] ); */ $this->_profiler->queryEnd($q); // set the PDO connection to perform case-folding on array keys, or not $this->_connection->setAttribute(PDO::ATTR_CASE, $this->_caseFolding); $this->_connection->setAttribute(PDO::SQLSRV_ENCODING_UTF8, true); // always use exceptions. $this->_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $this->_connection; } catch (PDOException $e) { /** * @see Zend_Db_Adapter_Exception */ throw new \Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e); } }
php
public function getConnection() { // if we already have a PDO object, no need to re-connect. if ($this->_connection) { return $this->_connection; } $this->_pdoType = "sqlsrv"; // get the dsn first, because some adapters alter the $_pdoType //$dsn = $this->_dsn(); // check for PDO extension if (!extension_loaded('pdo')) { /** * @see Zend_Db_Adapter_Exception */ throw new \Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded'); } // check the PDO driver is available if (!in_array($this->_pdoType, PDO::getAvailableDrivers())) { /** * @see Zend_Db_Adapter_Exception */ throw new \Zend_Db_Adapter_Exception('The ' . $this->_pdoType . ' driver is not currently installed'); } // create PDO connection $q = $this->_profiler->queryStart('connect', Zend_Db_Profiler::CONNECT); // add the persistence flag if we find it in our config array if (isset($this->_config['persistent']) && ($this->_config['persistent'] == true)) { $this->_config['driver_options'][PDO::ATTR_PERSISTENT] = true; } try { $serverName = $this->_config["host"]; $database = $this->_config["dbname"]; if (is_null($database)) { $database = 'master'; } $uid = $this->_config['username']; $pwd = $this->_config['password']; if ($this->_config["port"] != "") { $serverName = $serverName . "," . $this->_config["port"]; } $this->_connection = new PDO("sqlsrv:$serverName", $uid, $pwd, array('Database' => $database)); if ($this->_connection === false) { die(self::FormatErrors(sqlsrv_errors())); } /* $this->_connection = new PDO( $dsn, $this->_config['username'], $this->_config['password'], $this->_config['driver_options'] ); */ $this->_profiler->queryEnd($q); // set the PDO connection to perform case-folding on array keys, or not $this->_connection->setAttribute(PDO::ATTR_CASE, $this->_caseFolding); $this->_connection->setAttribute(PDO::SQLSRV_ENCODING_UTF8, true); // always use exceptions. $this->_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $this->_connection; } catch (PDOException $e) { /** * @see Zend_Db_Adapter_Exception */ throw new \Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "getConnection", "(", ")", "{", "// if we already have a PDO object, no need to re-connect.", "if", "(", "$", "this", "->", "_connection", ")", "{", "return", "$", "this", "->", "_connection", ";", "}", "$", "this", "->", "_pdoType", "=", "...
Returns connection handle @throws Zend_Db_Adapter_Exception @return resource
[ "Returns", "connection", "handle" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Pdo/Mssql.php#L32-L110
train
Get the connection object
[ 30522, 2270, 3853, 2131, 8663, 2638, 7542, 1006, 1007, 1063, 1013, 1013, 2065, 2057, 2525, 2031, 1037, 22851, 2080, 4874, 1010, 2053, 2342, 2000, 2128, 1011, 7532, 1012, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 1007, 1063, 2709, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Route.php
Route.setHost
public function setHost($pattern) { $this->host = (string) $pattern; $this->compiled = null; return $this; }
php
public function setHost($pattern) { $this->host = (string) $pattern; $this->compiled = null; return $this; }
[ "public", "function", "setHost", "(", "$", "pattern", ")", "{", "$", "this", "->", "host", "=", "(", "string", ")", "$", "pattern", ";", "$", "this", "->", "compiled", "=", "null", ";", "return", "$", "this", ";", "}" ]
Sets the pattern for the host. This method implements a fluent interface. @param string $pattern The host pattern @return $this
[ "Sets", "the", "pattern", "for", "the", "host", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Route.php#L175-L181
train
Set Host Name
[ 30522, 2270, 3853, 6662, 14122, 1006, 1002, 5418, 1007, 1063, 1002, 2023, 1011, 1028, 3677, 1027, 1006, 5164, 1007, 1002, 5418, 1025, 1002, 2023, 1011, 1028, 9227, 1027, 19701, 1025, 2709, 1002, 2023, 1025, 1065, 102, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/Console/ClearCommand.php
ClearCommand.handle
public function handle() { $this->laravel['events']->dispatch( 'cache:clearing', [$this->argument('store'), $this->tags()] ); $successful = $this->cache()->flush(); $this->flushFacades(); if (! $successful) { return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.'); } $this->laravel['events']->dispatch( 'cache:cleared', [$this->argument('store'), $this->tags()] ); $this->info('Application cache cleared!'); }
php
public function handle() { $this->laravel['events']->dispatch( 'cache:clearing', [$this->argument('store'), $this->tags()] ); $successful = $this->cache()->flush(); $this->flushFacades(); if (! $successful) { return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.'); } $this->laravel['events']->dispatch( 'cache:cleared', [$this->argument('store'), $this->tags()] ); $this->info('Application cache cleared!'); }
[ "public", "function", "handle", "(", ")", "{", "$", "this", "->", "laravel", "[", "'events'", "]", "->", "dispatch", "(", "'cache:clearing'", ",", "[", "$", "this", "->", "argument", "(", "'store'", ")", ",", "$", "this", "->", "tags", "(", ")", "]",...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Console/ClearCommand.php#L61-L80
train
Clear application cache
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 13679, 15985, 1031, 1005, 2824, 1005, 1033, 1011, 1028, 18365, 1006, 1005, 17053, 1024, 8430, 1005, 1010, 1031, 1002, 2023, 1011, 1028, 6685, 1006, 1005, 3573, 1005, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Filesystem.php
Filesystem.createIndexFilesToPreventDirectoryListing
private static function createIndexFilesToPreventDirectoryListing($path) { if (!self::isPathWithinTmpFolder($path)) { return; } $filesToCreate = array( $path . '/index.htm', $path . '/index.php' ); foreach ($filesToCreate as $file) { @file_put_contents($file, 'Nothing to see here.'); } }
php
private static function createIndexFilesToPreventDirectoryListing($path) { if (!self::isPathWithinTmpFolder($path)) { return; } $filesToCreate = array( $path . '/index.htm', $path . '/index.php' ); foreach ($filesToCreate as $file) { @file_put_contents($file, 'Nothing to see here.'); } }
[ "private", "static", "function", "createIndexFilesToPreventDirectoryListing", "(", "$", "path", ")", "{", "if", "(", "!", "self", "::", "isPathWithinTmpFolder", "(", "$", "path", ")", ")", "{", "return", ";", "}", "$", "filesToCreate", "=", "array", "(", "$"...
in tmp/ (sub-)folder(s) we create empty index.htm|php files @param $path
[ "in", "tmp", "/", "(", "sub", "-", ")", "folder", "(", "s", ")", "we", "create", "empty", "index", ".", "htm|php", "files" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Filesystem.php#L546-L558
train
Creates index. htm and index. php files that prevent directory listing
[ 30522, 2797, 10763, 3853, 3443, 22254, 10288, 8873, 4244, 14399, 2890, 15338, 4305, 2890, 16761, 8516, 2923, 2075, 1006, 1002, 4130, 1007, 1063, 2065, 1006, 999, 2969, 1024, 1024, 2003, 15069, 24415, 18447, 8737, 10371, 2121, 1006, 1002, 41...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/CalculateEvolutionFilter.php
CalculateEvolutionFilter.getPercentageValue
private static function getPercentageValue($value, $divisor, $quotientPrecision) { if ($value == 0) { $evolution = 0; } elseif ($divisor == 0) { $evolution = 100; } else { $evolution = ($value / $divisor) * 100; } $evolution = round($evolution, $quotientPrecision); return $evolution; }
php
private static function getPercentageValue($value, $divisor, $quotientPrecision) { if ($value == 0) { $evolution = 0; } elseif ($divisor == 0) { $evolution = 100; } else { $evolution = ($value / $divisor) * 100; } $evolution = round($evolution, $quotientPrecision); return $evolution; }
[ "private", "static", "function", "getPercentageValue", "(", "$", "value", ",", "$", "divisor", ",", "$", "quotientPrecision", ")", "{", "if", "(", "$", "value", "==", "0", ")", "{", "$", "evolution", "=", "0", ";", "}", "elseif", "(", "$", "divisor", ...
Returns an evolution percent based on a value & divisor.
[ "Returns", "an", "evolution", "percent", "based", "on", "a", "value", "&", "divisor", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/CalculateEvolutionFilter.php#L184-L196
train
Returns the percentage value of the value
[ 30522, 2797, 10763, 3853, 2131, 4842, 13013, 4270, 10175, 5657, 1006, 1002, 3643, 1010, 1002, 4487, 11365, 2953, 1010, 1002, 22035, 9515, 3372, 28139, 28472, 1007, 1063, 2065, 1006, 1002, 3643, 1027, 1027, 1014, 1007, 1063, 1002, 6622, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Route.php
Route.setSchemes
public function setSchemes($schemes) { $this->schemes = array_map('strtolower', (array) $schemes); $this->compiled = null; return $this; }
php
public function setSchemes($schemes) { $this->schemes = array_map('strtolower', (array) $schemes); $this->compiled = null; return $this; }
[ "public", "function", "setSchemes", "(", "$", "schemes", ")", "{", "$", "this", "->", "schemes", "=", "array_map", "(", "'strtolower'", ",", "(", "array", ")", "$", "schemes", ")", ";", "$", "this", "->", "compiled", "=", "null", ";", "return", "$", ...
Sets the schemes (e.g. 'https') this route is restricted to. So an empty array means that any scheme is allowed. This method implements a fluent interface. @param string|string[] $schemes The scheme or an array of schemes @return $this
[ "Sets", "the", "schemes", "(", "e", ".", "g", ".", "https", ")", "this", "route", "is", "restricted", "to", ".", "So", "an", "empty", "array", "means", "that", "any", "scheme", "is", "allowed", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Route.php#L204-L210
train
Set the schemes of the request
[ 30522, 2270, 3853, 4520, 5403, 7834, 1006, 1002, 11683, 1007, 1063, 1002, 2023, 1011, 1028, 11683, 1027, 9140, 1035, 4949, 1006, 1005, 2358, 5339, 12898, 13777, 1005, 1010, 1006, 9140, 1007, 1002, 11683, 1007, 1025, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php
WebLinkExtension.link
public function link($uri, $rel, array $attributes = []) { if (!$request = $this->requestStack->getMasterRequest()) { return $uri; } $link = new Link($rel, $uri); foreach ($attributes as $key => $value) { $link = $link->withAttribute($key, $value); } $linkProvider = $request->attributes->get('_links', new GenericLinkProvider()); $request->attributes->set('_links', $linkProvider->withLink($link)); return $uri; }
php
public function link($uri, $rel, array $attributes = []) { if (!$request = $this->requestStack->getMasterRequest()) { return $uri; } $link = new Link($rel, $uri); foreach ($attributes as $key => $value) { $link = $link->withAttribute($key, $value); } $linkProvider = $request->attributes->get('_links', new GenericLinkProvider()); $request->attributes->set('_links', $linkProvider->withLink($link)); return $uri; }
[ "public", "function", "link", "(", "$", "uri", ",", "$", "rel", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "if", "(", "!", "$", "request", "=", "$", "this", "->", "requestStack", "->", "getMasterRequest", "(", ")", ")", "{", "return"...
Adds a "Link" HTTP header. @param string $uri The relation URI @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch") @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]") @return string The relation URI
[ "Adds", "a", "Link", "HTTP", "header", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php#L58-L73
train
Link a URI with a rel and a value
[ 30522, 2270, 3853, 4957, 1006, 1002, 24471, 2072, 1010, 1002, 2128, 2140, 1010, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 1002, 5227, 1027, 1002, 2023, 1011, 1028, 11186, 2696, 3600, 1011, 1028, 2131, 8706, 2890, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Container/ContextualBindingBuilder.php
ContextualBindingBuilder.give
public function give($implementation) { foreach (Arr::wrap($this->concrete) as $concrete) { $this->container->addContextualBinding($concrete, $this->needs, $implementation); } }
php
public function give($implementation) { foreach (Arr::wrap($this->concrete) as $concrete) { $this->container->addContextualBinding($concrete, $this->needs, $implementation); } }
[ "public", "function", "give", "(", "$", "implementation", ")", "{", "foreach", "(", "Arr", "::", "wrap", "(", "$", "this", "->", "concrete", ")", "as", "$", "concrete", ")", "{", "$", "this", "->", "container", "->", "addContextualBinding", "(", "$", "...
Define the implementation for the contextual binding. @param \Closure|string $implementation @return void
[ "Define", "the", "implementation", "for", "the", "contextual", "binding", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/ContextualBindingBuilder.php#L64-L69
train
Adds the concrete to the container.
[ 30522, 2270, 3853, 2507, 1006, 1002, 7375, 1007, 1063, 18921, 6776, 1006, 12098, 2099, 1024, 1024, 10236, 1006, 1002, 2023, 1011, 1028, 5509, 1007, 2004, 1002, 5509, 1007, 1063, 1002, 2023, 1011, 1028, 11661, 1011, 1028, 5587, 8663, 18209, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpKernel.php
HttpKernel.handleException
private function handleException(\Exception $e, Request $request, int $type): Response { $event = new ExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch($event, KernelEvents::EXCEPTION); // a listener might have replaced the exception $e = $event->getException(); if (!$event->hasResponse()) { $this->finishRequest($request, $type); throw $e; } $response = $event->getResponse(); // the developer asked for a specific status code if (!$event->isAllowingCustomResponseCode() && !$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { // ensure that we actually have an error response if ($e instanceof HttpExceptionInterface) { // keep the HTTP status code and headers $response->setStatusCode($e->getStatusCode()); $response->headers->add($e->getHeaders()); } else { $response->setStatusCode(500); } } try { return $this->filterResponse($response, $request, $type); } catch (\Exception $e) { return $response; } }
php
private function handleException(\Exception $e, Request $request, int $type): Response { $event = new ExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch($event, KernelEvents::EXCEPTION); // a listener might have replaced the exception $e = $event->getException(); if (!$event->hasResponse()) { $this->finishRequest($request, $type); throw $e; } $response = $event->getResponse(); // the developer asked for a specific status code if (!$event->isAllowingCustomResponseCode() && !$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { // ensure that we actually have an error response if ($e instanceof HttpExceptionInterface) { // keep the HTTP status code and headers $response->setStatusCode($e->getStatusCode()); $response->headers->add($e->getHeaders()); } else { $response->setStatusCode(500); } } try { return $this->filterResponse($response, $request, $type); } catch (\Exception $e) { return $response; } }
[ "private", "function", "handleException", "(", "\\", "Exception", "$", "e", ",", "Request", "$", "request", ",", "int", "$", "type", ")", ":", "Response", "{", "$", "event", "=", "new", "ExceptionEvent", "(", "$", "this", ",", "$", "request", ",", "$",...
Handles an exception by trying to convert it to a Response. @param \Exception $e An \Exception instance @param Request $request A Request instance @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) @throws \Exception
[ "Handles", "an", "exception", "by", "trying", "to", "convert", "it", "to", "a", "Response", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernel.php#L219-L252
train
Handle an exception and return the response
[ 30522, 2797, 3853, 5047, 10288, 24422, 1006, 1032, 6453, 1002, 1041, 1010, 5227, 1002, 5227, 1010, 20014, 1002, 2828, 1007, 1024, 3433, 1063, 1002, 2724, 1027, 2047, 6453, 18697, 3372, 1006, 1002, 2023, 1010, 1002, 5227, 1010, 1002, 2828, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
SQLiteGrammar.prepareBindingsForDelete
public function prepareBindingsForDelete(array $bindings) { $cleanBindings = Arr::except($bindings, ['select', 'join']); return array_values( array_merge($bindings['join'], Arr::flatten($cleanBindings)) ); }
php
public function prepareBindingsForDelete(array $bindings) { $cleanBindings = Arr::except($bindings, ['select', 'join']); return array_values( array_merge($bindings['join'], Arr::flatten($cleanBindings)) ); }
[ "public", "function", "prepareBindingsForDelete", "(", "array", "$", "bindings", ")", "{", "$", "cleanBindings", "=", "Arr", "::", "except", "(", "$", "bindings", ",", "[", "'select'", ",", "'join'", "]", ")", ";", "return", "array_values", "(", "array_merge...
Prepare the bindings for a delete statement. @param array $bindings @return array
[ "Prepare", "the", "bindings", "for", "a", "delete", "statement", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php#L246-L253
train
Prepare bindings for delete
[ 30522, 2270, 3853, 7374, 8428, 4667, 17658, 12260, 2618, 1006, 9140, 1002, 8031, 2015, 1007, 1063, 1002, 4550, 8428, 4667, 2015, 1027, 12098, 2099, 1024, 1024, 3272, 1006, 1002, 8031, 2015, 1010, 1031, 1005, 7276, 1005, 1010, 1005, 3693, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter.php
Filter.fullUrlWithoutQuery
protected function fullUrlWithoutQuery($keys) { if ($keys instanceof Arrayable) { $keys = $keys->toArray(); } $keys = (array) $keys; $request = request(); $query = $request->query(); Arr::forget($query, $keys); $question = $request->getBaseUrl().$request->getPathInfo() == '/' ? '/?' : '?'; return count($request->query()) > 0 ? $request->url().$question.http_build_query($query) : $request->fullUrl(); }
php
protected function fullUrlWithoutQuery($keys) { if ($keys instanceof Arrayable) { $keys = $keys->toArray(); } $keys = (array) $keys; $request = request(); $query = $request->query(); Arr::forget($query, $keys); $question = $request->getBaseUrl().$request->getPathInfo() == '/' ? '/?' : '?'; return count($request->query()) > 0 ? $request->url().$question.http_build_query($query) : $request->fullUrl(); }
[ "protected", "function", "fullUrlWithoutQuery", "(", "$", "keys", ")", "{", "if", "(", "$", "keys", "instanceof", "Arrayable", ")", "{", "$", "keys", "=", "$", "keys", "->", "toArray", "(", ")", ";", "}", "$", "keys", "=", "(", "array", ")", "$", "...
Get full url without query strings. @param Arrayable|array|string $keys @return string
[ "Get", "full", "url", "without", "query", "strings", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter.php#L586-L604
train
Get full url without query string
[ 30522, 5123, 3853, 2440, 3126, 2140, 24415, 5833, 4226, 2854, 1006, 1002, 6309, 1007, 1063, 2065, 1006, 1002, 6309, 6013, 11253, 9140, 3085, 1007, 1063, 1002, 6309, 1027, 1002, 6309, 1011, 1028, 2000, 2906, 9447, 1006, 1007, 1025, 1065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Part.php
Zend_Mail_Part.getHeader
public function getHeader($name, $format = null) { if ($this->_headers === null) { $this->getHeaders(); } $lowerName = strtolower($name); if ($this->headerExists($name) == false) { $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name)); if($this->headerExists($lowerName) == false) { /** * @see Zend_Mail_Exception */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found"); } } $name = $lowerName; $header = $this->_headers[$name]; switch ($format) { case 'string': if (is_array($header)) { $header = implode(Zend_Mime::LINEEND, $header); } break; case 'array': $header = (array)$header; default: // do nothing } return $header; }
php
public function getHeader($name, $format = null) { if ($this->_headers === null) { $this->getHeaders(); } $lowerName = strtolower($name); if ($this->headerExists($name) == false) { $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name)); if($this->headerExists($lowerName) == false) { /** * @see Zend_Mail_Exception */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found"); } } $name = $lowerName; $header = $this->_headers[$name]; switch ($format) { case 'string': if (is_array($header)) { $header = implode(Zend_Mime::LINEEND, $header); } break; case 'array': $header = (array)$header; default: // do nothing } return $header; }
[ "public", "function", "getHeader", "(", "$", "name", ",", "$", "format", "=", "null", ")", "{", "if", "(", "$", "this", "->", "_headers", "===", "null", ")", "{", "$", "this", "->", "getHeaders", "(", ")", ";", "}", "$", "lowerName", "=", "strtolow...
Get a header in specificed format Internally headers that occur more than once are saved as array, all other as string. If $format is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim). @param string $name name of header, matches case-insensitive, but camel-case is replaced with dashes @param string $format change type of return value to 'string' or 'array' @return string|array value of header in wanted or internal format @throws Zend_Mail_Exception
[ "Get", "a", "header", "in", "specificed", "format" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Part.php#L332-L367
train
Get header by name
[ 30522, 2270, 3853, 2131, 4974, 2121, 1006, 1002, 2171, 1010, 1002, 4289, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 20346, 2015, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2131, 4974, 2545, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.refresh
public function refresh() { if (! $this->exists) { return $this; } $this->setRawAttributes( static::newQueryWithoutScopes()->findOrFail($this->getKey())->attributes ); $this->load(collect($this->relations)->except('pivot')->keys()->toArray()); $this->syncOriginal(); return $this; }
php
public function refresh() { if (! $this->exists) { return $this; } $this->setRawAttributes( static::newQueryWithoutScopes()->findOrFail($this->getKey())->attributes ); $this->load(collect($this->relations)->except('pivot')->keys()->toArray()); $this->syncOriginal(); return $this; }
[ "public", "function", "refresh", "(", ")", "{", "if", "(", "!", "$", "this", "->", "exists", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "setRawAttributes", "(", "static", "::", "newQueryWithoutScopes", "(", ")", "->", "findOrFail", "...
Reload the current model instance with fresh attributes from the database. @return $this
[ "Reload", "the", "current", "model", "instance", "with", "fresh", "attributes", "from", "the", "database", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L1139-L1154
train
Refreshes the current object with all the related objects.
[ 30522, 2270, 3853, 25416, 21898, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6526, 1007, 1063, 2709, 1002, 2023, 1025, 1065, 1002, 2023, 1011, 1028, 2275, 2527, 24281, 18886, 8569, 4570, 1006, 10763, 1024, 1024, 2047, 4226, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Archive.php
Archive.get
protected function get($archiveNames, $archiveDataType, $idSubtable = null) { if (!is_array($archiveNames)) { $archiveNames = array($archiveNames); } // apply idSubtable if ($idSubtable !== null && $idSubtable != self::ID_SUBTABLE_LOAD_ALL_SUBTABLES ) { // this is also done in ArchiveSelector. It should be actually only done in ArchiveSelector but DataCollection // does require to have the subtableId appended. Needs to be changed in refactoring to have it only in one // place. $dataNames = array(); foreach ($archiveNames as $name) { $dataNames[] = ArchiveSelector::appendIdsubtable($name, $idSubtable); } } else { $dataNames = $archiveNames; } $result = new Archive\DataCollection( $dataNames, $archiveDataType, $this->params->getIdSites(), $this->params->getPeriods(), $defaultRow = null); $archiveIds = $this->getArchiveIds($archiveNames); if (empty($archiveIds)) { /** * Triggered when no archive data is found in an API request. * @ignore */ Piwik::postEvent('Archive.noArchivedData'); return $result; } $archiveData = ArchiveSelector::getArchiveData($archiveIds, $archiveNames, $archiveDataType, $idSubtable); $isNumeric = $archiveDataType == 'numeric'; foreach ($archiveData as $row) { // values are grouped by idsite (site ID), date1-date2 (date range), then name (field name) $periodStr = $row['date1'] . ',' . $row['date2']; if ($isNumeric) { $row['value'] = $this->formatNumericValue($row['value']); } else { $result->addMetadata($row['idsite'], $periodStr, DataTable::ARCHIVED_DATE_METADATA_NAME, $row['ts_archived']); } $result->set($row['idsite'], $periodStr, $row['name'], $row['value']); } return $result; }
php
protected function get($archiveNames, $archiveDataType, $idSubtable = null) { if (!is_array($archiveNames)) { $archiveNames = array($archiveNames); } // apply idSubtable if ($idSubtable !== null && $idSubtable != self::ID_SUBTABLE_LOAD_ALL_SUBTABLES ) { // this is also done in ArchiveSelector. It should be actually only done in ArchiveSelector but DataCollection // does require to have the subtableId appended. Needs to be changed in refactoring to have it only in one // place. $dataNames = array(); foreach ($archiveNames as $name) { $dataNames[] = ArchiveSelector::appendIdsubtable($name, $idSubtable); } } else { $dataNames = $archiveNames; } $result = new Archive\DataCollection( $dataNames, $archiveDataType, $this->params->getIdSites(), $this->params->getPeriods(), $defaultRow = null); $archiveIds = $this->getArchiveIds($archiveNames); if (empty($archiveIds)) { /** * Triggered when no archive data is found in an API request. * @ignore */ Piwik::postEvent('Archive.noArchivedData'); return $result; } $archiveData = ArchiveSelector::getArchiveData($archiveIds, $archiveNames, $archiveDataType, $idSubtable); $isNumeric = $archiveDataType == 'numeric'; foreach ($archiveData as $row) { // values are grouped by idsite (site ID), date1-date2 (date range), then name (field name) $periodStr = $row['date1'] . ',' . $row['date2']; if ($isNumeric) { $row['value'] = $this->formatNumericValue($row['value']); } else { $result->addMetadata($row['idsite'], $periodStr, DataTable::ARCHIVED_DATE_METADATA_NAME, $row['ts_archived']); } $result->set($row['idsite'], $periodStr, $row['name'], $row['value']); } return $result; }
[ "protected", "function", "get", "(", "$", "archiveNames", ",", "$", "archiveDataType", ",", "$", "idSubtable", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "archiveNames", ")", ")", "{", "$", "archiveNames", "=", "array", "(", "$", "arc...
Queries archive tables for data and returns the result. @param array|string $archiveNames @param $archiveDataType @param null|int $idSubtable @return Archive\DataCollection
[ "Queries", "archive", "tables", "for", "data", "and", "returns", "the", "result", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L525-L577
train
Returns the data collection with the specified names archive data type and subtable ID.
[ 30522, 5123, 3853, 2131, 1006, 1002, 8756, 18442, 30524, 1065, 1013, 1013, 6611, 8909, 6342, 19279, 3085, 2065, 1006, 1002, 8909, 6342, 19279, 3085, 999, 1027, 1027, 19701, 1004, 1004, 1002, 8909, 6342, 19279, 3085, 999, 1027, 2969, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Theme.php
Theme.resetCache
public static function resetCache() { self::$activeThemeCache = false; self::$editThemeCache = false; Cache::forget(self::ACTIVE_KEY); Cache::forget(self::EDIT_KEY); }
php
public static function resetCache() { self::$activeThemeCache = false; self::$editThemeCache = false; Cache::forget(self::ACTIVE_KEY); Cache::forget(self::EDIT_KEY); }
[ "public", "static", "function", "resetCache", "(", ")", "{", "self", "::", "$", "activeThemeCache", "=", "false", ";", "self", "::", "$", "editThemeCache", "=", "false", ";", "Cache", "::", "forget", "(", "self", "::", "ACTIVE_KEY", ")", ";", "Cache", ":...
Resets any memory or cache involved with the active or edit theme. @return void
[ "Resets", "any", "memory", "or", "cache", "involved", "with", "the", "active", "or", "edit", "theme", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L480-L487
train
Reset the active and edit theme caches
[ 30522, 2270, 10763, 3853, 25141, 3540, 5403, 1006, 1007, 1063, 2969, 1024, 1024, 1002, 3161, 10760, 4168, 3540, 5403, 1027, 6270, 1025, 2969, 1024, 1024, 1002, 10086, 10760, 4168, 3540, 5403, 1027, 6270, 1025, 17053, 1024, 1024, 5293, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Cache.php
Cache.clearCache
public static function clearCache($remove = 'standard') { $locator = Grav::instance()['locator']; $output = []; $user_config = USER_DIR . 'config/system.yaml'; switch ($remove) { case 'all': $remove_paths = self::$all_remove; break; case 'assets-only': $remove_paths = self::$assets_remove; break; case 'images-only': $remove_paths = self::$images_remove; break; case 'cache-only': $remove_paths = self::$cache_remove; break; case 'tmp-only': $remove_paths = self::$tmp_remove; break; case 'invalidate': $remove_paths = []; break; default: if (Grav::instance()['config']->get('system.cache.clear_images_by_default')) { $remove_paths = self::$standard_remove; } else { $remove_paths = self::$standard_remove_no_images; } } // Delete entries in the doctrine cache if required if (in_array($remove, ['all', 'standard'])) { $cache = Grav::instance()['cache']; $cache->driver->deleteAll(); } // Clearing cache event to add paths to clear Grav::instance()->fireEvent('onBeforeCacheClear', new Event(['remove' => $remove, 'paths' => &$remove_paths])); foreach ($remove_paths as $stream) { // Convert stream to a real path try { $path = $locator->findResource($stream, true, true); if($path === false) continue; $anything = false; $files = glob($path . '/*'); if (is_array($files)) { foreach ($files as $file) { if (is_link($file)) { $output[] = '<yellow>Skipping symlink: </yellow>' . $file; } elseif (is_file($file)) { if (@unlink($file)) { $anything = true; } } elseif (is_dir($file)) { if (Folder::delete($file)) { $anything = true; } } } } if ($anything) { $output[] = '<red>Cleared: </red>' . $path . '/*'; } } catch (\Exception $e) { // stream not found or another error while deleting files. $output[] = '<red>ERROR: </red>' . $e->getMessage(); } } $output[] = ''; if (($remove === 'all' || $remove === 'standard') && file_exists($user_config)) { touch($user_config); $output[] = '<red>Touched: </red>' . $user_config; $output[] = ''; } // Clear stat cache @clearstatcache(); // Clear opcache if (function_exists('opcache_reset')) { @opcache_reset(); } return $output; }
php
public static function clearCache($remove = 'standard') { $locator = Grav::instance()['locator']; $output = []; $user_config = USER_DIR . 'config/system.yaml'; switch ($remove) { case 'all': $remove_paths = self::$all_remove; break; case 'assets-only': $remove_paths = self::$assets_remove; break; case 'images-only': $remove_paths = self::$images_remove; break; case 'cache-only': $remove_paths = self::$cache_remove; break; case 'tmp-only': $remove_paths = self::$tmp_remove; break; case 'invalidate': $remove_paths = []; break; default: if (Grav::instance()['config']->get('system.cache.clear_images_by_default')) { $remove_paths = self::$standard_remove; } else { $remove_paths = self::$standard_remove_no_images; } } // Delete entries in the doctrine cache if required if (in_array($remove, ['all', 'standard'])) { $cache = Grav::instance()['cache']; $cache->driver->deleteAll(); } // Clearing cache event to add paths to clear Grav::instance()->fireEvent('onBeforeCacheClear', new Event(['remove' => $remove, 'paths' => &$remove_paths])); foreach ($remove_paths as $stream) { // Convert stream to a real path try { $path = $locator->findResource($stream, true, true); if($path === false) continue; $anything = false; $files = glob($path . '/*'); if (is_array($files)) { foreach ($files as $file) { if (is_link($file)) { $output[] = '<yellow>Skipping symlink: </yellow>' . $file; } elseif (is_file($file)) { if (@unlink($file)) { $anything = true; } } elseif (is_dir($file)) { if (Folder::delete($file)) { $anything = true; } } } } if ($anything) { $output[] = '<red>Cleared: </red>' . $path . '/*'; } } catch (\Exception $e) { // stream not found or another error while deleting files. $output[] = '<red>ERROR: </red>' . $e->getMessage(); } } $output[] = ''; if (($remove === 'all' || $remove === 'standard') && file_exists($user_config)) { touch($user_config); $output[] = '<red>Touched: </red>' . $user_config; $output[] = ''; } // Clear stat cache @clearstatcache(); // Clear opcache if (function_exists('opcache_reset')) { @opcache_reset(); } return $output; }
[ "public", "static", "function", "clearCache", "(", "$", "remove", "=", "'standard'", ")", "{", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "$", "output", "=", "[", "]", ";", "$", "user_config", "=", "USER_DIR", ...
Helper method to clear all Grav caches @param string $remove standard|all|assets-only|images-only|cache-only @return array
[ "Helper", "method", "to", "clear", "all", "Grav", "caches" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L418-L514
train
Clear all cache entries
[ 30522, 2270, 10763, 3853, 3154, 3540, 5403, 1006, 1002, 6366, 1027, 1005, 3115, 1005, 1007, 1063, 1002, 8840, 11266, 2953, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 8840, 11266, 2953, 1005, 1033, 1025, 1002, 6434, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/SettingsServer.php
SettingsServer.setMemoryLimit
protected static function setMemoryLimit($minimumMemoryLimit) { // in Megabytes $currentValue = self::getMemoryLimitValue(); if ($currentValue === false || ($currentValue < $minimumMemoryLimit && @ini_set('memory_limit', $minimumMemoryLimit . 'M')) ) { return true; } return false; }
php
protected static function setMemoryLimit($minimumMemoryLimit) { // in Megabytes $currentValue = self::getMemoryLimitValue(); if ($currentValue === false || ($currentValue < $minimumMemoryLimit && @ini_set('memory_limit', $minimumMemoryLimit . 'M')) ) { return true; } return false; }
[ "protected", "static", "function", "setMemoryLimit", "(", "$", "minimumMemoryLimit", ")", "{", "// in Megabytes", "$", "currentValue", "=", "self", "::", "getMemoryLimitValue", "(", ")", ";", "if", "(", "$", "currentValue", "===", "false", "||", "(", "$", "cur...
Set PHP memory limit Note: system settings may prevent scripts from overriding the master value @param int $minimumMemoryLimit @return bool true if set; false otherwise
[ "Set", "PHP", "memory", "limit" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/SettingsServer.php#L163-L173
train
Set Memory Limit
[ 30522, 5123, 10763, 3853, 2275, 4168, 5302, 23320, 27605, 2102, 1006, 1002, 6263, 4168, 5302, 23320, 27605, 2102, 1007, 1063, 1013, 1013, 1999, 13164, 3762, 4570, 1002, 2783, 10175, 5657, 1027, 2969, 1024, 1024, 2131, 4168, 5302, 23320, 276...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/Dumper/MoFileDumper.php
MoFileDumper.formatCatalogue
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $sources = $targets = $sourceOffsets = $targetOffsets = ''; $offsets = []; $size = 0; foreach ($messages->all($domain) as $source => $target) { $offsets[] = array_map('strlen', [$sources, $source, $targets, $target]); $sources .= "\0".$source; $targets .= "\0".$target; ++$size; } $header = [ 'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC, 'formatRevision' => 0, 'count' => $size, 'offsetId' => MoFileLoader::MO_HEADER_SIZE, 'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size), 'sizeHashes' => 0, 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), ]; $sourcesSize = \strlen($sources); $sourcesStart = $header['offsetHashes'] + 1; foreach ($offsets as $offset) { $sourceOffsets .= $this->writeLong($offset[1]) .$this->writeLong($offset[0] + $sourcesStart); $targetOffsets .= $this->writeLong($offset[3]) .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } $output = implode('', array_map([$this, 'writeLong'], $header)) .$sourceOffsets .$targetOffsets .$sources .$targets ; return $output; }
php
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $sources = $targets = $sourceOffsets = $targetOffsets = ''; $offsets = []; $size = 0; foreach ($messages->all($domain) as $source => $target) { $offsets[] = array_map('strlen', [$sources, $source, $targets, $target]); $sources .= "\0".$source; $targets .= "\0".$target; ++$size; } $header = [ 'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC, 'formatRevision' => 0, 'count' => $size, 'offsetId' => MoFileLoader::MO_HEADER_SIZE, 'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size), 'sizeHashes' => 0, 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), ]; $sourcesSize = \strlen($sources); $sourcesStart = $header['offsetHashes'] + 1; foreach ($offsets as $offset) { $sourceOffsets .= $this->writeLong($offset[1]) .$this->writeLong($offset[0] + $sourcesStart); $targetOffsets .= $this->writeLong($offset[3]) .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } $output = implode('', array_map([$this, 'writeLong'], $header)) .$sourceOffsets .$targetOffsets .$sources .$targets ; return $output; }
[ "public", "function", "formatCatalogue", "(", "MessageCatalogue", "$", "messages", ",", "$", "domain", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "sources", "=", "$", "targets", "=", "$", "sourceOffsets", "=", "$", "targetOffsets", "=", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Dumper/MoFileDumper.php#L27-L68
train
Formats a message catalogue
[ 30522, 2270, 3853, 4289, 11266, 23067, 9077, 1006, 4471, 11266, 23067, 9077, 1002, 7696, 1010, 1002, 5884, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 4216, 1027, 1002, 7889, 1027, 1002, 3120, 27475, 8454, 1027, 1002, 4539, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SegmentEditor/API.php
API.update
public function update($idSegment, $name, $definition, $idSite = false, $autoArchive = false, $enabledAllUsers = false) { $segment = $this->getSegmentOrFail($idSegment); $this->checkUserCanEditOrDeleteSegment($segment); $idSite = $this->checkIdSite($idSite); $this->checkSegmentName($name); $definition = $this->checkSegmentValue($definition, $idSite); $enabledAllUsers = $this->checkEnabledAllUsers($enabledAllUsers); $autoArchive = $this->checkAutoArchive($autoArchive, $idSite); $bind = array( 'name' => $name, 'definition' => $definition, 'enable_all_users' => $enabledAllUsers, 'enable_only_idsite' => $idSite, 'auto_archive' => $autoArchive, 'ts_last_edit' => Date::now()->getDatetime(), ); /** * Triggered before a segment is modified. * * This event can be used by plugins to throw an exception * or do something else. * * @param int $idSegment The ID of the segment which visibility is reduced. */ Piwik::postEvent('SegmentEditor.update', array($idSegment, $bind)); $this->getModel()->updateSegment($idSegment, $bind); return true; }
php
public function update($idSegment, $name, $definition, $idSite = false, $autoArchive = false, $enabledAllUsers = false) { $segment = $this->getSegmentOrFail($idSegment); $this->checkUserCanEditOrDeleteSegment($segment); $idSite = $this->checkIdSite($idSite); $this->checkSegmentName($name); $definition = $this->checkSegmentValue($definition, $idSite); $enabledAllUsers = $this->checkEnabledAllUsers($enabledAllUsers); $autoArchive = $this->checkAutoArchive($autoArchive, $idSite); $bind = array( 'name' => $name, 'definition' => $definition, 'enable_all_users' => $enabledAllUsers, 'enable_only_idsite' => $idSite, 'auto_archive' => $autoArchive, 'ts_last_edit' => Date::now()->getDatetime(), ); /** * Triggered before a segment is modified. * * This event can be used by plugins to throw an exception * or do something else. * * @param int $idSegment The ID of the segment which visibility is reduced. */ Piwik::postEvent('SegmentEditor.update', array($idSegment, $bind)); $this->getModel()->updateSegment($idSegment, $bind); return true; }
[ "public", "function", "update", "(", "$", "idSegment", ",", "$", "name", ",", "$", "definition", ",", "$", "idSite", "=", "false", ",", "$", "autoArchive", "=", "false", ",", "$", "enabledAllUsers", "=", "false", ")", "{", "$", "segment", "=", "$", "...
Modifies an existing stored segment. @param int $idSegment The ID of the stored segment to modify. @param string $name The new name of the segment. @param string $definition The new definition of the segment. @param bool $idSite If supplied, associates the stored segment with as single site. @param bool $autoArchive Whether to automatically archive data with the segment or not. @param bool $enabledAllUsers Whether the stored segment is viewable by all users or just the one that created it. @return bool
[ "Modifies", "an", "existing", "stored", "segment", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/API.php#L229-L262
train
Update a segment
[ 30522, 2270, 3853, 10651, 1006, 1002, 8909, 3366, 21693, 4765, 1010, 1002, 2171, 1010, 1002, 6210, 1010, 1002, 8909, 28032, 2063, 1027, 6270, 1010, 1002, 8285, 2906, 5428, 3726, 1027, 6270, 1010, 1002, 9124, 8095, 20330, 2015, 1027, 6270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/thrift
lib/php/lib/Transport/TCurlClient.php
TCurlClient.read
public function read($len) { if ($len >= strlen($this->response_)) { return $this->response_; } else { $ret = substr($this->response_, 0, $len); $this->response_ = substr($this->response_, $len); return $ret; } }
php
public function read($len) { if ($len >= strlen($this->response_)) { return $this->response_; } else { $ret = substr($this->response_, 0, $len); $this->response_ = substr($this->response_, $len); return $ret; } }
[ "public", "function", "read", "(", "$", "len", ")", "{", "if", "(", "$", "len", ">=", "strlen", "(", "$", "this", "->", "response_", ")", ")", "{", "return", "$", "this", "->", "response_", ";", "}", "else", "{", "$", "ret", "=", "substr", "(", ...
Read some data into the array. @param int $len How much to read @return string The data that has been read @throws TTransportException if cannot read any more data
[ "Read", "some", "data", "into", "the", "array", "." ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TCurlClient.php#L160-L170
train
Read from the response buffer
[ 30522, 2270, 3853, 3191, 1006, 1002, 18798, 1007, 1063, 2065, 1006, 1002, 18798, 1028, 1027, 2358, 20927, 2078, 1006, 1002, 2023, 1011, 1028, 3433, 1035, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 3433, 1035, 1025, 1065, 2842, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Memcached.php
Zend_Cache_Backend_Memcached.getMetadatas
public function getMetadatas($id) { $tmp = $this->_memcache->get($id); if (is_array($tmp)) { $data = $tmp[0]; $mtime = $tmp[1]; if (!isset($tmp[2])) { // because this record is only with 1.7 release // if old cache records are still there... return false; } $lifetime = $tmp[2]; return array( 'expire' => $mtime + $lifetime, 'tags' => array(), 'mtime' => $mtime ); } return false; }
php
public function getMetadatas($id) { $tmp = $this->_memcache->get($id); if (is_array($tmp)) { $data = $tmp[0]; $mtime = $tmp[1]; if (!isset($tmp[2])) { // because this record is only with 1.7 release // if old cache records are still there... return false; } $lifetime = $tmp[2]; return array( 'expire' => $mtime + $lifetime, 'tags' => array(), 'mtime' => $mtime ); } return false; }
[ "public", "function", "getMetadatas", "(", "$", "id", ")", "{", "$", "tmp", "=", "$", "this", "->", "_memcache", "->", "get", "(", "$", "id", ")", ";", "if", "(", "is_array", "(", "$", "tmp", ")", ")", "{", "$", "data", "=", "$", "tmp", "[", ...
Return an array of metadatas for the given cache id The array must include these keys : - expire : the expire timestamp - tags : a string array of tags - mtime : timestamp of last modification time @param string $id cache id @return array array of metadatas (false if the cache id is not found)
[ "Return", "an", "array", "of", "metadatas", "for", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Memcached.php#L420-L439
train
Returns array of cache record information
[ 30522, 2270, 3853, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1063, 1002, 1056, 8737, 1027, 1002, 2023, 1011, 1028, 1035, 2033, 12458, 15395, 1011, 1028, 2131, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 2003, 1035, 9140, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/BrowserKit/Client.php
Client.getAbsoluteUri
protected function getAbsoluteUri($uri) { // already absolute? if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) { return $uri; } if (!$this->history->isEmpty()) { $currentUri = $this->history->current()->getUri(); } else { $currentUri = sprintf('http%s://%s/', isset($this->server['HTTPS']) ? 's' : '', isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost' ); } // protocol relative URL if (0 === strpos($uri, '//')) { return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri; } // anchor or query string parameters? if (!$uri || '#' == $uri[0] || '?' == $uri[0]) { return preg_replace('/[#?].*?$/', '', $currentUri).$uri; } if ('/' !== $uri[0]) { $path = parse_url($currentUri, PHP_URL_PATH); if ('/' !== substr($path, -1)) { $path = substr($path, 0, strrpos($path, '/') + 1); } $uri = $path.$uri; } return preg_replace('#^(.*?//[^/]+)\/.*$#', '$1', $currentUri).$uri; }
php
protected function getAbsoluteUri($uri) { // already absolute? if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) { return $uri; } if (!$this->history->isEmpty()) { $currentUri = $this->history->current()->getUri(); } else { $currentUri = sprintf('http%s://%s/', isset($this->server['HTTPS']) ? 's' : '', isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost' ); } // protocol relative URL if (0 === strpos($uri, '//')) { return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri; } // anchor or query string parameters? if (!$uri || '#' == $uri[0] || '?' == $uri[0]) { return preg_replace('/[#?].*?$/', '', $currentUri).$uri; } if ('/' !== $uri[0]) { $path = parse_url($currentUri, PHP_URL_PATH); if ('/' !== substr($path, -1)) { $path = substr($path, 0, strrpos($path, '/') + 1); } $uri = $path.$uri; } return preg_replace('#^(.*?//[^/]+)\/.*$#', '$1', $currentUri).$uri; }
[ "protected", "function", "getAbsoluteUri", "(", "$", "uri", ")", "{", "// already absolute?", "if", "(", "0", "===", "strpos", "(", "$", "uri", ",", "'http://'", ")", "||", "0", "===", "strpos", "(", "$", "uri", ",", "'https://'", ")", ")", "{", "retur...
Takes a URI and converts it to absolute if it is not already absolute. @param string $uri A URI @return string An absolute URI
[ "Takes", "a", "URI", "and", "converts", "it", "to", "absolute", "if", "it", "is", "not", "already", "absolute", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Client.php#L666-L703
train
Get absolute URI
[ 30522, 5123, 3853, 2131, 7875, 19454, 10421, 9496, 1006, 1002, 24471, 2072, 1007, 1063, 1013, 1013, 2525, 7619, 1029, 2065, 1006, 1014, 1027, 1027, 1027, 2358, 14536, 2891, 1006, 1002, 24471, 2072, 1010, 1005, 8299, 1024, 1013, 1013, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Container.php
Container.reset
public function reset() { $services = $this->services + $this->privates; $this->services = $this->factories = $this->privates = []; foreach ($services as $service) { try { if ($service instanceof ResetInterface) { $service->reset(); } } catch (\Throwable $e) { continue; } } }
php
public function reset() { $services = $this->services + $this->privates; $this->services = $this->factories = $this->privates = []; foreach ($services as $service) { try { if ($service instanceof ResetInterface) { $service->reset(); } } catch (\Throwable $e) { continue; } } }
[ "public", "function", "reset", "(", ")", "{", "$", "services", "=", "$", "this", "->", "services", "+", "$", "this", "->", "privates", ";", "$", "this", "->", "services", "=", "$", "this", "->", "factories", "=", "$", "this", "->", "privates", "=", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Container.php#L304-L318
train
Reset all services and privates
[ 30522, 2270, 3853, 25141, 1006, 1007, 30524, 2797, 2015, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2578, 2004, 1002, 2326, 1007, 1063, 3046, 1063, 2065, 1006, 1002, 2326, 6013, 11253, 25141, 18447, 2121, 12172, 1007, 1063, 1002, 2326...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/BaseNode.php
BaseNode.merge
final public function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); } if ($leftSide !== $leftPlaceholders = self::resolvePlaceholderValue($leftSide)) { foreach ($leftPlaceholders as $leftPlaceholder) { $this->handlingPlaceholder = $leftSide; try { $this->merge($leftPlaceholder, $rightSide); } finally { $this->handlingPlaceholder = null; } } return $rightSide; } if ($rightSide !== $rightPlaceholders = self::resolvePlaceholderValue($rightSide)) { foreach ($rightPlaceholders as $rightPlaceholder) { $this->handlingPlaceholder = $rightSide; try { $this->merge($leftSide, $rightPlaceholder); } finally { $this->handlingPlaceholder = null; } } return $rightSide; } $this->doValidateType($leftSide); $this->doValidateType($rightSide); return $this->mergeValues($leftSide, $rightSide); }
php
final public function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); } if ($leftSide !== $leftPlaceholders = self::resolvePlaceholderValue($leftSide)) { foreach ($leftPlaceholders as $leftPlaceholder) { $this->handlingPlaceholder = $leftSide; try { $this->merge($leftPlaceholder, $rightSide); } finally { $this->handlingPlaceholder = null; } } return $rightSide; } if ($rightSide !== $rightPlaceholders = self::resolvePlaceholderValue($rightSide)) { foreach ($rightPlaceholders as $rightPlaceholder) { $this->handlingPlaceholder = $rightSide; try { $this->merge($leftSide, $rightPlaceholder); } finally { $this->handlingPlaceholder = null; } } return $rightSide; } $this->doValidateType($leftSide); $this->doValidateType($rightSide); return $this->mergeValues($leftSide, $rightSide); }
[ "final", "public", "function", "merge", "(", "$", "leftSide", ",", "$", "rightSide", ")", "{", "if", "(", "!", "$", "this", "->", "allowOverwrite", ")", "{", "throw", "new", "ForbiddenOverwriteException", "(", "sprintf", "(", "'Configuration path \"%s\" cannot b...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/BaseNode.php#L288-L324
train
Merges two configuration values.
[ 30522, 2345, 2270, 3853, 13590, 1006, 1002, 2187, 7363, 1010, 1002, 2916, 5178, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 3499, 7840, 26373, 1007, 1063, 5466, 2047, 10386, 7840, 26373, 10288, 24422, 1006, 9043, 2546, 1006, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/Table.php
Table.renderColumnSeparator
private function renderColumnSeparator($type = self::BORDER_OUTSIDE) { $borders = $this->style->getBorderChars(); return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]); }
php
private function renderColumnSeparator($type = self::BORDER_OUTSIDE) { $borders = $this->style->getBorderChars(); return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]); }
[ "private", "function", "renderColumnSeparator", "(", "$", "type", "=", "self", "::", "BORDER_OUTSIDE", ")", "{", "$", "borders", "=", "$", "this", "->", "style", "->", "getBorderChars", "(", ")", ";", "return", "sprintf", "(", "$", "this", "->", "style", ...
Renders vertical column separator.
[ "Renders", "vertical", "column", "separator", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L442-L447
train
Render column separator
[ 30522, 2797, 3853, 17552, 25778, 2819, 12325, 28689, 4263, 1006, 1002, 2828, 1027, 2969, 1024, 1024, 3675, 1035, 2648, 1007, 1063, 1002, 6645, 1027, 1002, 2023, 1011, 1028, 2806, 1011, 1028, 2131, 12821, 4063, 7507, 2869, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.orWhere
public function orWhere($column, $operator = null, $value = null) { [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); return $this->where($column, $operator, $value, 'or'); }
php
public function orWhere($column, $operator = null, $value = null) { [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); return $this->where($column, $operator, $value, 'or'); }
[ "public", "function", "orWhere", "(", "$", "column", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "[", "$", "value", ",", "$", "operator", "]", "=", "$", "this", "->", "prepareValueAndOperator", "(", "$", "value", ",",...
Add an "or where" clause to the query. @param string|array|\Closure $column @param mixed $operator @param mixed $value @return \Illuminate\Database\Query\Builder|static
[ "Add", "an", "or", "where", "clause", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L744-L751
train
Adds a where clause to the query.
[ 30522, 2270, 3853, 2030, 2860, 5886, 2063, 1006, 1002, 5930, 1010, 1002, 6872, 1027, 19701, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 1031, 1002, 3643, 1010, 1002, 6872, 1033, 1027, 1002, 2023, 1011, 1028, 7374, 10175, 5657, 28574, 4842, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php
SymfonyQuestionHelper.writePrompt
protected function writePrompt(OutputInterface $output, Question $question) { $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); $default = $question->getDefault(); switch (true) { case null === $default: $text = sprintf(' <info>%s</info>:', $text); break; case $question instanceof ConfirmationQuestion: $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no'); break; case $question instanceof ChoiceQuestion && $question->isMultiselect(): $choices = $question->getChoices(); $default = explode(',', $default); foreach ($default as $key => $value) { $default[$key] = $choices[trim($value)]; } $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default))); break; case $question instanceof ChoiceQuestion: $choices = $question->getChoices(); $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default)); break; default: $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default)); } $output->writeln($text); if ($question instanceof ChoiceQuestion) { $width = max(array_map('strlen', array_keys($question->getChoices()))); foreach ($question->getChoices() as $key => $value) { $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value)); } } $output->write(' > '); }
php
protected function writePrompt(OutputInterface $output, Question $question) { $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); $default = $question->getDefault(); switch (true) { case null === $default: $text = sprintf(' <info>%s</info>:', $text); break; case $question instanceof ConfirmationQuestion: $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no'); break; case $question instanceof ChoiceQuestion && $question->isMultiselect(): $choices = $question->getChoices(); $default = explode(',', $default); foreach ($default as $key => $value) { $default[$key] = $choices[trim($value)]; } $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default))); break; case $question instanceof ChoiceQuestion: $choices = $question->getChoices(); $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default)); break; default: $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default)); } $output->writeln($text); if ($question instanceof ChoiceQuestion) { $width = max(array_map('strlen', array_keys($question->getChoices()))); foreach ($question->getChoices() as $key => $value) { $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value)); } } $output->write(' > '); }
[ "protected", "function", "writePrompt", "(", "OutputInterface", "$", "output", ",", "Question", "$", "question", ")", "{", "$", "text", "=", "OutputFormatter", "::", "escapeTrailingBackslash", "(", "$", "question", "->", "getQuestion", "(", ")", ")", ";", "$",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php#L31-L80
train
Write the prompt
[ 30522, 5123, 3853, 4339, 21572, 27718, 1006, 6434, 18447, 2121, 12172, 1002, 6434, 1010, 3160, 1002, 3160, 1007, 1063, 1002, 3793, 1027, 6434, 14192, 20097, 1024, 1024, 4019, 6494, 16281, 12221, 27067, 1006, 1002, 3160, 1011, 1028, 2131, 15...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Language/Language.php
Language.getTranslation
public function getTranslation($lang, $key, $array_support = false) { $translation = Grav::instance()['languages']->get($lang . '.' . $key, null); if (!$array_support && is_array($translation)) { return (string)array_shift($translation); } return $translation; }
php
public function getTranslation($lang, $key, $array_support = false) { $translation = Grav::instance()['languages']->get($lang . '.' . $key, null); if (!$array_support && is_array($translation)) { return (string)array_shift($translation); } return $translation; }
[ "public", "function", "getTranslation", "(", "$", "lang", ",", "$", "key", ",", "$", "array_support", "=", "false", ")", "{", "$", "translation", "=", "Grav", "::", "instance", "(", ")", "[", "'languages'", "]", "->", "get", "(", "$", "lang", ".", "'...
Lookup the translation text for a given lang and key @param string $lang lang code @param string $key key to lookup with @param bool $array_support @return string
[ "Lookup", "the", "translation", "text", "for", "a", "given", "lang", "and", "key" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Language/Language.php#L478-L486
train
Get the translation of a language
[ 30522, 2270, 3853, 2131, 6494, 3619, 13490, 1006, 1002, 11374, 1010, 1002, 3145, 1010, 1002, 9140, 1035, 2490, 1027, 6270, 1007, 1063, 1002, 5449, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 4155, 1005, 1033, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Map.php
Map.queueFilter
public function queueFilter($className, $parameters = array()) { foreach ($this->getDataTables() as $table) { $table->queueFilter($className, $parameters); } }
php
public function queueFilter($className, $parameters = array()) { foreach ($this->getDataTables() as $table) { $table->queueFilter($className, $parameters); } }
[ "public", "function", "queueFilter", "(", "$", "className", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "foreach", "(", "$", "this", "->", "getDataTables", "(", ")", "as", "$", "table", ")", "{", "$", "table", "->", "queueFilter", "(", ...
Queue a filter to {@link DataTable} child of contained by this instance. See {@link Piwik\DataTable::queueFilter()} for more information.. @param string|Closure $className Filter name, eg. `'Limit'` or a Closure. @param array $parameters Filter parameters, eg. `array(50, 10)`.
[ "Queue", "a", "filter", "to", "{", "@link", "DataTable", "}", "child", "of", "contained", "by", "this", "instance", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Map.php#L83-L88
train
Queues a filter to all data tables
[ 30522, 2270, 3853, 24240, 8873, 21928, 1006, 1002, 2465, 18442, 1010, 1002, 11709, 1027, 9140, 1006, 1007, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 2850, 29336, 3085, 2015, 1006, 1007, 2004, 1002, 2795, 1007, 1063, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement.php
Zend_Db_Statement.fetchColumn
public function fetchColumn($col = 0) { $data = array(); $col = (int) $col; $row = $this->fetch(Zend_Db::FETCH_NUM); if (!is_array($row)) { return false; } return $row[$col]; }
php
public function fetchColumn($col = 0) { $data = array(); $col = (int) $col; $row = $this->fetch(Zend_Db::FETCH_NUM); if (!is_array($row)) { return false; } return $row[$col]; }
[ "public", "function", "fetchColumn", "(", "$", "col", "=", "0", ")", "{", "$", "data", "=", "array", "(", ")", ";", "$", "col", "=", "(", "int", ")", "$", "col", ";", "$", "row", "=", "$", "this", "->", "fetch", "(", "Zend_Db", "::", "FETCH_NUM...
Returns a single column from the next row of a result set. @param int $col OPTIONAL Position of the column to fetch. @return string One value from the next row of result set, or false.
[ "Returns", "a", "single", "column", "from", "the", "next", "row", "of", "a", "result", "set", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement.php#L358-L367
train
Fetch one column from the result set
[ 30522, 2270, 3853, 18584, 25778, 2819, 2078, 1006, 1002, 8902, 1027, 1014, 1007, 1063, 1002, 2951, 1027, 9140, 1006, 1007, 1025, 1002, 8902, 1027, 1006, 20014, 1007, 1002, 8902, 1025, 1002, 5216, 1027, 1002, 2023, 1011, 1028, 18584, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.diffUsing
public function diffUsing($items, callable $callback) { return new static(array_udiff($this->items, $this->getArrayableItems($items), $callback)); }
php
public function diffUsing($items, callable $callback) { return new static(array_udiff($this->items, $this->getArrayableItems($items), $callback)); }
[ "public", "function", "diffUsing", "(", "$", "items", ",", "callable", "$", "callback", ")", "{", "return", "new", "static", "(", "array_udiff", "(", "$", "this", "->", "items", ",", "$", "this", "->", "getArrayableItems", "(", "$", "items", ")", ",", ...
Get the items in the collection that are not present in the given items. @param mixed $items @param callable $callback @return static
[ "Get", "the", "items", "in", "the", "collection", "that", "are", "not", "present", "in", "the", "given", "items", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L357-L360
train
Diff the array using the given items and returns a new array containing the values of the items in the current array.
[ 30522, 2270, 3853, 4487, 4246, 18161, 1006, 1002, 5167, 1010, 2655, 3085, 1002, 2655, 5963, 1007, 1063, 2709, 2047, 10763, 1006, 9140, 1035, 20904, 13355, 1006, 1002, 2023, 1011, 1028, 5167, 1010, 1002, 2023, 1011, 1028, 2131, 2906, 29539, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ccxt/ccxt
php/Exchange.php
Exchange.build_ohlcv
public static function build_ohlcv ($trades, $timeframe = '1m', $since = PHP_INT_MIN, $limits = PHP_INT_MAX) { if (empty ($trades) || !is_array ($trades)) { return array (); } if (!is_numeric ($since)) { $since = PHP_INT_MIN; } if (!is_numeric ($limits)) { $limits = PHP_INT_MAX; } $ms = static::parse_timeframe ($timeframe) * 1000; $ohlcvs = array (); list(/* $timestamp */, /* $open */, $high, $low, $close, $volume) = array (0, 1, 2, 3, 4, 5); for ($i = 0; $i < min (count($trades), $limits); $i++) { $trade = $trades[$i]; if ($trade['timestamp'] < $since) continue; $openingTime = floor ($trade['timestamp'] / $ms) * $ms; // shift to the edge of m/h/d (but not M) $j = count($ohlcvs); if ($j == 0 || $openingTime >= $ohlcvs[$j-1][0] + $ms) { // moved to a new timeframe -> create a new candle from opening trade $ohlcvs[] = array ( $openingTime, $trade['price'], $trade['price'], $trade['price'], $trade['price'], $trade['amount'] ); } else { // still processing the same timeframe -> update opening trade $ohlcvs[$j-1][$high] = max ($ohlcvs[$j-1][$high], $trade['price']); $ohlcvs[$j-1][$low] = min ($ohlcvs[$j-1][$low], $trade['price']); $ohlcvs[$j-1][$close] = $trade['price']; $ohlcvs[$j-1][$volume] += $trade['amount']; } } return $ohlcvs; }
php
public static function build_ohlcv ($trades, $timeframe = '1m', $since = PHP_INT_MIN, $limits = PHP_INT_MAX) { if (empty ($trades) || !is_array ($trades)) { return array (); } if (!is_numeric ($since)) { $since = PHP_INT_MIN; } if (!is_numeric ($limits)) { $limits = PHP_INT_MAX; } $ms = static::parse_timeframe ($timeframe) * 1000; $ohlcvs = array (); list(/* $timestamp */, /* $open */, $high, $low, $close, $volume) = array (0, 1, 2, 3, 4, 5); for ($i = 0; $i < min (count($trades), $limits); $i++) { $trade = $trades[$i]; if ($trade['timestamp'] < $since) continue; $openingTime = floor ($trade['timestamp'] / $ms) * $ms; // shift to the edge of m/h/d (but not M) $j = count($ohlcvs); if ($j == 0 || $openingTime >= $ohlcvs[$j-1][0] + $ms) { // moved to a new timeframe -> create a new candle from opening trade $ohlcvs[] = array ( $openingTime, $trade['price'], $trade['price'], $trade['price'], $trade['price'], $trade['amount'] ); } else { // still processing the same timeframe -> update opening trade $ohlcvs[$j-1][$high] = max ($ohlcvs[$j-1][$high], $trade['price']); $ohlcvs[$j-1][$low] = min ($ohlcvs[$j-1][$low], $trade['price']); $ohlcvs[$j-1][$close] = $trade['price']; $ohlcvs[$j-1][$volume] += $trade['amount']; } } return $ohlcvs; }
[ "public", "static", "function", "build_ohlcv", "(", "$", "trades", ",", "$", "timeframe", "=", "'1m'", ",", "$", "since", "=", "PHP_INT_MIN", ",", "$", "limits", "=", "PHP_INT_MAX", ")", "{", "if", "(", "empty", "(", "$", "trades", ")", "||", "!", "i...
given a sorted arrays of trades (recent first) and a timeframe builds an array of OHLCV candles
[ "given", "a", "sorted", "arrays", "of", "trades", "(", "recent", "first", ")", "and", "a", "timeframe", "builds", "an", "array", "of", "OHLCV", "candles" ]
0113da333a51acded0b44d9528809bbf654acfbd
https://github.com/ccxt/ccxt/blob/0113da333a51acded0b44d9528809bbf654acfbd/php/Exchange.php#L328-L367
train
Build oHLCV list
[ 30522, 2270, 10763, 3853, 3857, 1035, 2821, 15472, 2615, 1006, 1002, 14279, 1010, 1002, 2051, 15643, 1027, 1005, 1015, 2213, 1005, 1010, 1002, 2144, 1027, 25718, 1035, 20014, 1035, 8117, 1010, 1002, 6537, 1027, 25718, 1035, 20014, 1035, 409...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/MessageBag.php
MessageBag.get
public function get($key, $format = null) { // If the message exists in the message bag, we will transform it and return // the message. Otherwise, we will check if the key is implicit & collect // all the messages that match the given key and output it as an array. if (array_key_exists($key, $this->messages)) { return $this->transform( $this->messages[$key], $this->checkFormat($format), $key ); } if (Str::contains($key, '*')) { return $this->getMessagesForWildcardKey($key, $format); } return []; }
php
public function get($key, $format = null) { // If the message exists in the message bag, we will transform it and return // the message. Otherwise, we will check if the key is implicit & collect // all the messages that match the given key and output it as an array. if (array_key_exists($key, $this->messages)) { return $this->transform( $this->messages[$key], $this->checkFormat($format), $key ); } if (Str::contains($key, '*')) { return $this->getMessagesForWildcardKey($key, $format); } return []; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "format", "=", "null", ")", "{", "// If the message exists in the message bag, we will transform it and return", "// the message. Otherwise, we will check if the key is implicit & collect", "// all the messages that match the give...
Get all of the messages from the message bag for a given key. @param string $key @param string $format @return array
[ "Get", "all", "of", "the", "messages", "from", "the", "message", "bag", "for", "a", "given", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/MessageBag.php#L173-L189
train
Get all the messages for a given key
[ 30522, 2270, 3853, 2131, 1006, 1002, 3145, 1010, 1002, 4289, 1027, 19701, 1007, 1063, 1013, 1013, 2065, 1996, 4471, 6526, 1999, 1996, 4471, 4524, 1010, 2057, 2097, 10938, 2009, 1998, 2709, 1013, 1013, 1996, 4471, 1012, 4728, 1010, 2057, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Sqlite.php
Zend_Cache_Backend_Sqlite.getMetadatas
public function getMetadatas($id) { $tags = array(); $res = $this->_query("SELECT name FROM tag WHERE id='$id'"); if ($res) { $rows = @sqlite_fetch_all($res, SQLITE_ASSOC); foreach ($rows as $row) { $tags[] = $row['name']; } } $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)'); $res = $this->_query("SELECT lastModified,expire FROM cache WHERE id='$id'"); if (!$res) { return false; } $row = @sqlite_fetch_array($res, SQLITE_ASSOC); return array( 'tags' => $tags, 'mtime' => $row['lastModified'], 'expire' => $row['expire'] ); }
php
public function getMetadatas($id) { $tags = array(); $res = $this->_query("SELECT name FROM tag WHERE id='$id'"); if ($res) { $rows = @sqlite_fetch_all($res, SQLITE_ASSOC); foreach ($rows as $row) { $tags[] = $row['name']; } } $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)'); $res = $this->_query("SELECT lastModified,expire FROM cache WHERE id='$id'"); if (!$res) { return false; } $row = @sqlite_fetch_array($res, SQLITE_ASSOC); return array( 'tags' => $tags, 'mtime' => $row['lastModified'], 'expire' => $row['expire'] ); }
[ "public", "function", "getMetadatas", "(", "$", "id", ")", "{", "$", "tags", "=", "array", "(", ")", ";", "$", "res", "=", "$", "this", "->", "_query", "(", "\"SELECT name FROM tag WHERE id='$id'\"", ")", ";", "if", "(", "$", "res", ")", "{", "$", "r...
Return an array of metadatas for the given cache id The array must include these keys : - expire : the expire timestamp - tags : a string array of tags - mtime : timestamp of last modification time @param string $id cache id @return array array of metadatas (false if the cache id is not found)
[ "Return", "an", "array", "of", "metadatas", "for", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L395-L416
train
Get all the information about the cache entry
[ 30522, 2270, 3853, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1063, 1002, 22073, 1027, 9140, 1006, 1007, 1025, 1002, 24501, 1027, 1002, 2023, 1011, 1028, 1035, 23032, 1006, 1000, 7276, 2171, 2013, 6415, 2073, 8909, 1027, 1005, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php
MetadataBag.initialize
public function initialize(array &$array) { $this->meta = &$array; if (isset($array[self::CREATED])) { $this->lastUsed = $this->meta[self::UPDATED]; $timeStamp = time(); if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) { $this->meta[self::UPDATED] = $timeStamp; } } else { $this->stampCreated(); } }
php
public function initialize(array &$array) { $this->meta = &$array; if (isset($array[self::CREATED])) { $this->lastUsed = $this->meta[self::UPDATED]; $timeStamp = time(); if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) { $this->meta[self::UPDATED] = $timeStamp; } } else { $this->stampCreated(); } }
[ "public", "function", "initialize", "(", "array", "&", "$", "array", ")", "{", "$", "this", "->", "meta", "=", "&", "$", "array", ";", "if", "(", "isset", "(", "$", "array", "[", "self", "::", "CREATED", "]", ")", ")", "{", "$", "this", "->", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php#L69-L83
train
Initialize the object
[ 30522, 2270, 3853, 3988, 4697, 1006, 9140, 1004, 1002, 9140, 1007, 1063, 1002, 2023, 1011, 1028, 18804, 1027, 1004, 1002, 9140, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 9140, 1031, 2969, 1024, 1024, 2580, 1033, 1007, 1007, 1063, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Protocol/Abstract.php
Zend_Mail_Protocol_Abstract._addLog
protected function _addLog($value) { if ($this->_maximumLog >= 0 && count($this->_log) >= $this->_maximumLog) { array_shift($this->_log); } $this->_log[] = $value; }
php
protected function _addLog($value) { if ($this->_maximumLog >= 0 && count($this->_log) >= $this->_maximumLog) { array_shift($this->_log); } $this->_log[] = $value; }
[ "protected", "function", "_addLog", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "_maximumLog", ">=", "0", "&&", "count", "(", "$", "this", "->", "_log", ")", ">=", "$", "this", "->", "_maximumLog", ")", "{", "array_shift", "(", "$", ...
Add the transaction log @param string new transaction @return void
[ "Add", "the", "transaction", "log" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Abstract.php#L243-L250
train
Adds a value to the log array
[ 30522, 5123, 3853, 1035, 5587, 21197, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 4555, 21197, 1028, 1027, 1014, 1004, 1004, 4175, 1006, 1002, 2023, 1011, 1028, 1035, 8833, 1007, 1028, 1027, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter.php
Filter.execute
public function execute($toArray = true) { $conditions = array_merge( $this->conditions(), $this->scopeConditions() ); return $this->model->addConditions($conditions)->buildData($toArray); }
php
public function execute($toArray = true) { $conditions = array_merge( $this->conditions(), $this->scopeConditions() ); return $this->model->addConditions($conditions)->buildData($toArray); }
[ "public", "function", "execute", "(", "$", "toArray", "=", "true", ")", "{", "$", "conditions", "=", "array_merge", "(", "$", "this", "->", "conditions", "(", ")", ",", "$", "this", "->", "scopeConditions", "(", ")", ")", ";", "return", "$", "this", ...
Execute the filter with conditions. @param bool $toArray @return array|Collection|mixed
[ "Execute", "the", "filter", "with", "conditions", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter.php#L493-L501
train
Execute the query and return the result as an array
[ 30522, 2270, 3853, 15389, 1006, 1002, 2000, 2906, 9447, 1027, 2995, 1007, 1063, 1002, 3785, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1011, 1028, 3785, 1006, 1007, 1010, 1002, 2023, 1011, 1028, 9531, 8663, 20562, 2015, 1006, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Tools/Header.php
Header.render
public function render() { $content = call_user_func($this->grid->header(), $this->queryBuilder()); if (empty($content)) { return ''; } if ($content instanceof Renderable) { $content = $content->render(); } if ($content instanceof Htmlable) { $content = $content->toHtml(); } return <<<HTML <div class="box-header with-border clearfix"> {$content} </div> HTML; }
php
public function render() { $content = call_user_func($this->grid->header(), $this->queryBuilder()); if (empty($content)) { return ''; } if ($content instanceof Renderable) { $content = $content->render(); } if ($content instanceof Htmlable) { $content = $content->toHtml(); } return <<<HTML <div class="box-header with-border clearfix"> {$content} </div> HTML; }
[ "public", "function", "render", "(", ")", "{", "$", "content", "=", "call_user_func", "(", "$", "this", "->", "grid", "->", "header", "(", ")", ",", "$", "this", "->", "queryBuilder", "(", ")", ")", ";", "if", "(", "empty", "(", "$", "content", ")"...
{@inheritdoc}
[ "{" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/Header.php#L44-L65
train
Render the header
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 1002, 4180, 1027, 2655, 1035, 5310, 1035, 4569, 2278, 1006, 1002, 2023, 1011, 1028, 8370, 1011, 1028, 20346, 1006, 1007, 1010, 1002, 2023, 1011, 1028, 23032, 8569, 23891, 2099, 1006, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/User/FlexUser/User.php
User.join
public function join($name, $value, $separator = null) { $separator = $separator ?? '.'; $old = $this->get($name, null, $separator); if ($old !== null) { if (!\is_array($old)) { throw new \RuntimeException('Value ' . $old); } if (\is_object($value)) { $value = (array) $value; } elseif (!\is_array($value)) { throw new \RuntimeException('Value ' . $value); } $value = $this->getBlueprint()->mergeData($old, $value, $name, $separator); } $this->set($name, $value, $separator); return $this; }
php
public function join($name, $value, $separator = null) { $separator = $separator ?? '.'; $old = $this->get($name, null, $separator); if ($old !== null) { if (!\is_array($old)) { throw new \RuntimeException('Value ' . $old); } if (\is_object($value)) { $value = (array) $value; } elseif (!\is_array($value)) { throw new \RuntimeException('Value ' . $value); } $value = $this->getBlueprint()->mergeData($old, $value, $name, $separator); } $this->set($name, $value, $separator); return $this; }
[ "public", "function", "join", "(", "$", "name", ",", "$", "value", ",", "$", "separator", "=", "null", ")", "{", "$", "separator", "=", "$", "separator", "??", "'.'", ";", "$", "old", "=", "$", "this", "->", "get", "(", "$", "name", ",", "null", ...
Join nested values together by using blueprints. @param string $name Dot separated path to the requested value. @param mixed $value Value to be joined. @param string $separator Separator, defaults to '.' @return $this @throws \RuntimeException
[ "Join", "nested", "values", "together", "by", "using", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L246-L267
train
Join a value with a separator
[ 30522, 2270, 3853, 3693, 1006, 1002, 2171, 1010, 1002, 3643, 1010, 1002, 19802, 25879, 2953, 1027, 19701, 1007, 1063, 1002, 19802, 25879, 2953, 1027, 1002, 19802, 25879, 2953, 1029, 1029, 1005, 1012, 1005, 1025, 1002, 2214, 1027, 1002, 2023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/Storage/FolderStorage.php
FolderStorage.replaceRows
public function replaceRows(array $rows): array { $list = []; foreach ($rows as $key => $row) { $key = (string)$key; if (strpos($key, '@@')) { $key = $this->getNewKey(); } $path = $this->getPathFromKey($key); $file = $this->getFile($path); $list[$key] = $this->saveFile($file, $row); } return $list; }
php
public function replaceRows(array $rows): array { $list = []; foreach ($rows as $key => $row) { $key = (string)$key; if (strpos($key, '@@')) { $key = $this->getNewKey(); } $path = $this->getPathFromKey($key); $file = $this->getFile($path); $list[$key] = $this->saveFile($file, $row); } return $list; }
[ "public", "function", "replaceRows", "(", "array", "$", "rows", ")", ":", "array", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "rows", "as", "$", "key", "=>", "$", "row", ")", "{", "$", "key", "=", "(", "string", ")", "$", "key",...
{@inheritdoc} @see FlexStorageInterface::replaceRows()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/FolderStorage.php#L177-L191
train
Replace rows in the table
[ 30522, 2270, 3853, 5672, 10524, 2015, 1006, 9140, 1002, 10281, 1007, 1024, 9140, 1063, 1002, 2862, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 10281, 2004, 1002, 3145, 1027, 1028, 1002, 5216, 1007, 1063, 1002, 3145, 1027, 1006, 5164, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/TwoLevels.php
Zend_Cache_Backend_TwoLevels._getFastLifetime
private function _getFastLifetime($lifetime, $priority, $maxLifetime = null) { if ($lifetime <= 0) { // if no lifetime, we have an infinite lifetime // we need to use arbitrary lifetimes $fastLifetime = (int) (2592000 / (11 - $priority)); } else { // prevent computed infinite lifetime (0) by ceil $fastLifetime = (int) ceil($lifetime / (11 - $priority)); } if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) { return $maxLifetime; } return $fastLifetime; }
php
private function _getFastLifetime($lifetime, $priority, $maxLifetime = null) { if ($lifetime <= 0) { // if no lifetime, we have an infinite lifetime // we need to use arbitrary lifetimes $fastLifetime = (int) (2592000 / (11 - $priority)); } else { // prevent computed infinite lifetime (0) by ceil $fastLifetime = (int) ceil($lifetime / (11 - $priority)); } if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) { return $maxLifetime; } return $fastLifetime; }
[ "private", "function", "_getFastLifetime", "(", "$", "lifetime", ",", "$", "priority", ",", "$", "maxLifetime", "=", "null", ")", "{", "if", "(", "$", "lifetime", "<=", "0", ")", "{", "// if no lifetime, we have an infinite lifetime", "// we need to use arbitrary li...
Compute and return the lifetime for the fast backend @param int $lifetime original lifetime @param int $priority priority @param int $maxLifetime maximum lifetime @return int lifetime for the fast backend
[ "Compute", "and", "return", "the", "lifetime", "for", "the", "fast", "backend" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/TwoLevels.php#L481-L497
train
Get the fast lifetime
[ 30522, 2797, 3853, 1035, 2131, 24333, 15509, 7292, 1006, 1002, 6480, 1010, 1002, 9470, 1010, 1002, 4098, 15509, 7292, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 6480, 1026, 1027, 30524, 2000, 2224, 15275, 6480, 2015, 1002, 3435, 15509, 7292...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/SymfonyHttpDriver.php
SymfonyHttpDriver.isSessionStarted
public function isSessionStarted() { if (!$this->session->isStarted()) { $this->session->start(); } return $this->session->isStarted(); }
php
public function isSessionStarted() { if (!$this->session->isStarted()) { $this->session->start(); } return $this->session->isStarted(); }
[ "public", "function", "isSessionStarted", "(", ")", "{", "if", "(", "!", "$", "this", "->", "session", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "session", "->", "start", "(", ")", ";", "}", "return", "$", "this", "->", "session", "...
{@inheritDoc}
[ "{" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/SymfonyHttpDriver.php#L39-L46
train
Returns true if the session has been started
[ 30522, 2270, 3853, 26354, 7971, 8496, 7559, 3064, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 5219, 1011, 1028, 26354, 7559, 3064, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 5219, 1011, 1028, 2707, 1006, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
HttpKernelRuntime.renderFragmentStrategy
public function renderFragmentStrategy($strategy, $uri, $options = []) { return $this->handler->render($uri, $strategy, $options); }
php
public function renderFragmentStrategy($strategy, $uri, $options = []) { return $this->handler->render($uri, $strategy, $options); }
[ "public", "function", "renderFragmentStrategy", "(", "$", "strategy", ",", "$", "uri", ",", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "handler", "->", "render", "(", "$", "uri", ",", "$", "strategy", ",", "$", "options", "...
Renders a fragment. @param string $strategy A strategy name @param string|ControllerReference $uri A URI as a string or a ControllerReference instance @param array $options An array of options @return string The fragment content @see FragmentHandler::render()
[ "Renders", "a", "fragment", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php#L60-L63
train
Render fragment strategy
[ 30522, 2270, 3853, 17552, 27843, 21693, 11187, 6494, 2618, 6292, 1006, 1002, 5656, 1010, 1002, 24471, 2072, 1010, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 28213, 1011, 1028, 17552, 1006, 1002, 24471, 2072, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Data/Data.php
Data.merge
public function merge(array $data) { $this->items = $this->blueprints()->mergeData($this->items, $data); return $this; }
php
public function merge(array $data) { $this->items = $this->blueprints()->mergeData($this->items, $data); return $this; }
[ "public", "function", "merge", "(", "array", "$", "data", ")", "{", "$", "this", "->", "items", "=", "$", "this", "->", "blueprints", "(", ")", "->", "mergeData", "(", "$", "this", "->", "items", ",", "$", "data", ")", ";", "return", "$", "this", ...
Merge two configurations together. @param array $data @return $this
[ "Merge", "two", "configurations", "together", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Data.php#L166-L171
train
Merge data into the current page
[ 30522, 2270, 3853, 13590, 1006, 9140, 1002, 2951, 1007, 1063, 1002, 2023, 1011, 1028, 5167, 1027, 1002, 2023, 1011, 1028, 2630, 16550, 2015, 1006, 1007, 1011, 1028, 5314, 6790, 1006, 1002, 2023, 1011, 1028, 5167, 1010, 1002, 2951, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Events/Dispatcher.php
Dispatcher.listen
public function listen($events, $listener) { foreach ((array) $events as $event) { if (Str::contains($event, '*')) { $this->setupWildcardListen($event, $listener); } else { $this->listeners[$event][] = $this->makeListener($listener); } } }
php
public function listen($events, $listener) { foreach ((array) $events as $event) { if (Str::contains($event, '*')) { $this->setupWildcardListen($event, $listener); } else { $this->listeners[$event][] = $this->makeListener($listener); } } }
[ "public", "function", "listen", "(", "$", "events", ",", "$", "listener", ")", "{", "foreach", "(", "(", "array", ")", "$", "events", "as", "$", "event", ")", "{", "if", "(", "Str", "::", "contains", "(", "$", "event", ",", "'*'", ")", ")", "{", ...
Register an event listener with the dispatcher. @param string|array $events @param mixed $listener @return void
[ "Register", "an", "event", "listener", "with", "the", "dispatcher", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Events/Dispatcher.php#L71-L80
train
Listen to events
[ 30522, 2270, 3853, 4952, 1006, 1002, 2824, 1010, 1002, 19373, 1007, 1063, 18921, 6776, 1006, 1006, 9140, 1007, 1002, 2824, 2004, 1002, 2724, 1007, 1063, 2065, 1006, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 2724, 1010, 1005, 1008, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DomCrawler/Crawler.php
Crawler.addNodeList
public function addNodeList(\DOMNodeList $nodes) { foreach ($nodes as $node) { if ($node instanceof \DOMNode) { $this->addNode($node); } } }
php
public function addNodeList(\DOMNodeList $nodes) { foreach ($nodes as $node) { if ($node instanceof \DOMNode) { $this->addNode($node); } } }
[ "public", "function", "addNodeList", "(", "\\", "DOMNodeList", "$", "nodes", ")", "{", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "\\", "DOMNode", ")", "{", "$", "this", "->", "addNode", "(", "$",...
Adds a \DOMNodeList to the list of nodes. @param \DOMNodeList $nodes A \DOMNodeList instance
[ "Adds", "a", "\\", "DOMNodeList", "to", "the", "list", "of", "nodes", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L275-L282
train
Adds DOMNodeList to the DOM
[ 30522, 2270, 3853, 5587, 3630, 9247, 2923, 1006, 1032, 14383, 3630, 9247, 2923, 1002, 14164, 1007, 1063, 18921, 6776, 1006, 1002, 14164, 2004, 1002, 13045, 1007, 1063, 2065, 1006, 1002, 13045, 6013, 11253, 1032, 14383, 3630, 3207, 1007, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/ConstraintValidator.php
ConstraintValidator.formatValues
protected function formatValues(array $values, $format = 0) { foreach ($values as $key => $value) { $values[$key] = $this->formatValue($value, $format); } return implode(', ', $values); }
php
protected function formatValues(array $values, $format = 0) { foreach ($values as $key => $value) { $values[$key] = $this->formatValue($value, $format); } return implode(', ', $values); }
[ "protected", "function", "formatValues", "(", "array", "$", "values", ",", "$", "format", "=", "0", ")", "{", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "values", "[", "$", "key", "]", "=", "$", "this", "-...
Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. @param array $values A list of values @param int $format A bitwise combination of the format constants in this class @return string The string representation of the value list @see formatValue()
[ "Returns", "a", "string", "representation", "of", "a", "list", "of", "values", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/ConstraintValidator.php#L159-L166
train
Format values for use in the grammar
[ 30522, 5123, 3853, 4289, 10175, 15808, 1006, 9140, 1002, 5300, 1010, 1002, 4289, 1027, 1014, 1007, 1063, 18921, 6776, 1006, 1002, 5300, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 1002, 5300, 1031, 1002, 3145, 1033, 1027, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Association/Apriori.php
Apriori.items
private function items(): array { $items = []; foreach ($this->samples as $sample) { foreach ($sample as $item) { if (!in_array($item, $items, true)) { $items[] = $item; } } } return array_map(function ($entry) { return [$entry]; }, $items); }
php
private function items(): array { $items = []; foreach ($this->samples as $sample) { foreach ($sample as $item) { if (!in_array($item, $items, true)) { $items[] = $item; } } } return array_map(function ($entry) { return [$entry]; }, $items); }
[ "private", "function", "items", "(", ")", ":", "array", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "samples", "as", "$", "sample", ")", "{", "foreach", "(", "$", "sample", "as", "$", "item", ")", "{", "if", "(", "...
Calculates frequent k = 1 item sets. @return mixed[][]
[ "Calculates", "frequent", "k", "=", "1", "item", "sets", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L190-L205
train
Returns the items of the samples
[ 30522, 2797, 3853, 5167, 1006, 1007, 1024, 9140, 1063, 1002, 5167, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 8168, 2004, 1002, 7099, 1007, 1063, 18921, 6776, 1006, 1002, 7099, 2004, 1002, 8875, 1007, 1063, 2065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Widgets/Tab.php
Tab.addLink
public function addLink($title, $href, $active = false) { $this->data['tabs'][] = [ 'id' => mt_rand(), 'title' => $title, 'href' => $href, 'type' => static::TYPE_LINK, ]; if ($active) { $this->data['active'] = count($this->data['tabs']) - 1; } return $this; }
php
public function addLink($title, $href, $active = false) { $this->data['tabs'][] = [ 'id' => mt_rand(), 'title' => $title, 'href' => $href, 'type' => static::TYPE_LINK, ]; if ($active) { $this->data['active'] = count($this->data['tabs']) - 1; } return $this; }
[ "public", "function", "addLink", "(", "$", "title", ",", "$", "href", ",", "$", "active", "=", "false", ")", "{", "$", "this", "->", "data", "[", "'tabs'", "]", "[", "]", "=", "[", "'id'", "=>", "mt_rand", "(", ")", ",", "'title'", "=>", "$", "...
Add a link on tab. @param string $title @param string $href @param bool $active @return $this
[ "Add", "a", "link", "on", "tab", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L67-L81
train
Add link to list
[ 30522, 2270, 3853, 5587, 13767, 1006, 1002, 2516, 1010, 1002, 17850, 12879, 1010, 1002, 3161, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 2951, 1031, 1005, 21628, 2015, 1005, 1033, 1031, 1033, 1027, 1031, 1005, 8909, 1005, 1027, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php
AnonymousAuthenticationProvider.authenticate
public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { throw new BadCredentialsException('The Token does not contain the expected key.'); } return $token; }
php
public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { throw new BadCredentialsException('The Token does not contain the expected key.'); } return $token; }
[ "public", "function", "authenticate", "(", "TokenInterface", "$", "token", ")", "{", "if", "(", "!", "$", "this", "->", "supports", "(", "$", "token", ")", ")", "{", "throw", "new", "AuthenticationException", "(", "'The token is not supported by this authenticatio...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php#L45-L56
train
Authenticate a token
[ 30522, 2270, 3853, 14469, 3686, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6753, 1006, 1002, 19204, 1007, 1007, 1063, 5466, 2047, 27280, 10288, 24422, 1006, 1005, 1996, 19204, 2003, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.order
public function order($by, $dir = 'asc', $manual = null, $sort_flags = null) { $this->items = $this->pages->sortCollection($this, $by, $dir, $manual, $sort_flags); return $this; }
php
public function order($by, $dir = 'asc', $manual = null, $sort_flags = null) { $this->items = $this->pages->sortCollection($this, $by, $dir, $manual, $sort_flags); return $this; }
[ "public", "function", "order", "(", "$", "by", ",", "$", "dir", "=", "'asc'", ",", "$", "manual", "=", "null", ",", "$", "sort_flags", "=", "null", ")", "{", "$", "this", "->", "items", "=", "$", "this", "->", "pages", "->", "sortCollection", "(", ...
Reorder collection. @param string $by @param string $dir @param array $manual @param string $sort_flags @return $this
[ "Reorder", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L229-L234
train
Sort Page Collection
[ 30522, 2270, 3853, 2344, 1006, 1002, 2011, 1010, 1002, 16101, 1027, 1005, 2004, 2278, 1005, 1010, 1002, 6410, 1027, 19701, 1010, 1002, 4066, 1035, 9245, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 5167, 1027, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Worker.php
Worker.acceptConnection
public function acceptConnection($socket) { // Accept a connection on server socket. set_error_handler(function(){}); $new_socket = stream_socket_accept($socket, 0, $remote_address); restore_error_handler(); // Thundering herd. if (!$new_socket) { return; } // TcpConnection. $connection = new TcpConnection($new_socket, $remote_address); $this->connections[$connection->id] = $connection; $connection->worker = $this; $connection->protocol = $this->protocol; $connection->transport = $this->transport; $connection->onMessage = $this->onMessage; $connection->onClose = $this->onClose; $connection->onError = $this->onError; $connection->onBufferDrain = $this->onBufferDrain; $connection->onBufferFull = $this->onBufferFull; // Try to emit onConnect callback. if ($this->onConnect) { try { call_user_func($this->onConnect, $connection); } catch (\Exception $e) { static::log($e); exit(250); } catch (\Error $e) { static::log($e); exit(250); } } }
php
public function acceptConnection($socket) { // Accept a connection on server socket. set_error_handler(function(){}); $new_socket = stream_socket_accept($socket, 0, $remote_address); restore_error_handler(); // Thundering herd. if (!$new_socket) { return; } // TcpConnection. $connection = new TcpConnection($new_socket, $remote_address); $this->connections[$connection->id] = $connection; $connection->worker = $this; $connection->protocol = $this->protocol; $connection->transport = $this->transport; $connection->onMessage = $this->onMessage; $connection->onClose = $this->onClose; $connection->onError = $this->onError; $connection->onBufferDrain = $this->onBufferDrain; $connection->onBufferFull = $this->onBufferFull; // Try to emit onConnect callback. if ($this->onConnect) { try { call_user_func($this->onConnect, $connection); } catch (\Exception $e) { static::log($e); exit(250); } catch (\Error $e) { static::log($e); exit(250); } } }
[ "public", "function", "acceptConnection", "(", "$", "socket", ")", "{", "// Accept a connection on server socket.", "set_error_handler", "(", "function", "(", ")", "{", "}", ")", ";", "$", "new_socket", "=", "stream_socket_accept", "(", "$", "socket", ",", "0", ...
Accept a connection. @param resource $socket @return void
[ "Accept", "a", "connection", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L2397-L2433
train
Accept a connection on server socket
[ 30522, 2270, 3853, 5138, 8663, 2638, 7542, 1006, 1002, 22278, 1007, 1063, 1013, 1013, 5138, 1037, 4434, 2006, 8241, 22278, 1012, 2275, 1035, 7561, 1035, 28213, 1006, 3853, 1006, 1007, 1063, 1065, 1007, 1025, 1002, 2047, 1035, 22278, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/models/ThemeData.php
ThemeData.applyAssetVariablesToCombinerFilters
public static function applyAssetVariablesToCombinerFilters($filters) { $theme = CmsTheme::getActiveTheme(); if (!$theme){ return; } if (!$theme->hasCustomData()) { return; } $assetVars = $theme->getCustomData()->getAssetVariables(); foreach ($filters as $filter) { if (method_exists($filter, 'setPresets')) { $filter->setPresets($assetVars); } } }
php
public static function applyAssetVariablesToCombinerFilters($filters) { $theme = CmsTheme::getActiveTheme(); if (!$theme){ return; } if (!$theme->hasCustomData()) { return; } $assetVars = $theme->getCustomData()->getAssetVariables(); foreach ($filters as $filter) { if (method_exists($filter, 'setPresets')) { $filter->setPresets($assetVars); } } }
[ "public", "static", "function", "applyAssetVariablesToCombinerFilters", "(", "$", "filters", ")", "{", "$", "theme", "=", "CmsTheme", "::", "getActiveTheme", "(", ")", ";", "if", "(", "!", "$", "theme", ")", "{", "return", ";", "}", "if", "(", "!", "$", ...
Applies asset variables to the combiner filters that support it. @return void
[ "Applies", "asset", "variables", "to", "the", "combiner", "filters", "that", "support", "it", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/models/ThemeData.php#L226-L245
train
Applies asset variables to combiner filters
[ 30522, 2270, 10763, 3853, 6611, 27241, 9189, 10980, 13510, 3406, 18274, 26455, 8873, 21928, 2015, 1006, 1002, 17736, 1007, 1063, 1002, 4323, 1027, 4642, 3367, 29122, 2063, 1024, 1024, 2131, 19620, 10760, 4168, 1006, 1007, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getPackageName
public static function getPackageName($source) { $ignore_yaml_files = ['blueprints', 'languages']; foreach (glob($source . '*.yaml') as $filename) { $name = strtolower(basename($filename, '.yaml')); if (in_array($name, $ignore_yaml_files)) { continue; } return $name; } return false; }
php
public static function getPackageName($source) { $ignore_yaml_files = ['blueprints', 'languages']; foreach (glob($source . '*.yaml') as $filename) { $name = strtolower(basename($filename, '.yaml')); if (in_array($name, $ignore_yaml_files)) { continue; } return $name; } return false; }
[ "public", "static", "function", "getPackageName", "(", "$", "source", ")", "{", "$", "ignore_yaml_files", "=", "[", "'blueprints'", ",", "'languages'", "]", ";", "foreach", "(", "glob", "(", "$", "source", ".", "'*.yaml'", ")", "as", "$", "filename", ")", ...
Try to guess the package name from the source files @param string $source @return bool|string
[ "Try", "to", "guess", "the", "package", "name", "from", "the", "source", "files" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L604-L616
train
Get Package Name
[ 30522, 2270, 10763, 3853, 2131, 23947, 4270, 18442, 1006, 1002, 3120, 1007, 1063, 1002, 8568, 1035, 8038, 19968, 1035, 6764, 1027, 1031, 1005, 2630, 16550, 2015, 1005, 1010, 1005, 4155, 1005, 1033, 1025, 18921, 6776, 1006, 1043, 4135, 2497,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/FormField.php
FormField.attributes
public function attributes($items, $position = 'field') { if (!is_array($items)) { return; } $multiArray = array_filter($items, 'is_array'); if (!$multiArray) { $this->attributes[$position] = $items; return; } foreach ($items as $_position => $_items) { $this->attributes($_items, $_position); } return $this; }
php
public function attributes($items, $position = 'field') { if (!is_array($items)) { return; } $multiArray = array_filter($items, 'is_array'); if (!$multiArray) { $this->attributes[$position] = $items; return; } foreach ($items as $_position => $_items) { $this->attributes($_items, $_position); } return $this; }
[ "public", "function", "attributes", "(", "$", "items", ",", "$", "position", "=", "'field'", ")", "{", "if", "(", "!", "is_array", "(", "$", "items", ")", ")", "{", "return", ";", "}", "$", "multiArray", "=", "array_filter", "(", "$", "items", ",", ...
Sets the attributes for this field in a given position. - field: Attributes are added to the form field element (input, select, textarea, etc) - container: Attributes are added to the form field container (div.form-group) @param array $items @param string $position @return void
[ "Sets", "the", "attributes", "for", "this", "field", "in", "a", "given", "position", ".", "-", "field", ":", "Attributes", "are", "added", "to", "the", "form", "field", "element", "(", "input", "select", "textarea", "etc", ")", "-", "container", ":", "At...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormField.php#L384-L401
train
Add attributes to the list
[ 30522, 2270, 3853, 12332, 1006, 1002, 5167, 1010, 1002, 2597, 1027, 1005, 2492, 1005, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 5167, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 4800, 2906, 9447, 1027, 9140, 1035, 11307, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getMimeByLocalFile
public static function getMimeByLocalFile($filename, $default = 'application/octet-stream') { $type = false; // For local files we can detect type by the file content. if (!stream_is_local($filename) || !file_exists($filename)) { return false; } // Prefer using finfo if it exists. if (\extension_loaded('fileinfo')) { $finfo = finfo_open(FILEINFO_SYMLINK | FILEINFO_MIME_TYPE); $type = finfo_file($finfo, $filename); finfo_close($finfo); } else { // Fall back to use getimagesize() if it is available (not recommended, but better than nothing) $info = @getimagesize($filename); if ($info) { $type = $info['mime']; } } return $type ?: static::getMimeByFilename($filename, $default); }
php
public static function getMimeByLocalFile($filename, $default = 'application/octet-stream') { $type = false; // For local files we can detect type by the file content. if (!stream_is_local($filename) || !file_exists($filename)) { return false; } // Prefer using finfo if it exists. if (\extension_loaded('fileinfo')) { $finfo = finfo_open(FILEINFO_SYMLINK | FILEINFO_MIME_TYPE); $type = finfo_file($finfo, $filename); finfo_close($finfo); } else { // Fall back to use getimagesize() if it is available (not recommended, but better than nothing) $info = @getimagesize($filename); if ($info) { $type = $info['mime']; } } return $type ?: static::getMimeByFilename($filename, $default); }
[ "public", "static", "function", "getMimeByLocalFile", "(", "$", "filename", ",", "$", "default", "=", "'application/octet-stream'", ")", "{", "$", "type", "=", "false", ";", "// For local files we can detect type by the file content.", "if", "(", "!", "stream_is_local",...
Return the mimetype based on existing local file @param string $filename Path to the file @return string|bool
[ "Return", "the", "mimetype", "based", "on", "existing", "local", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L727-L750
train
Returns the MIME type of a local file.
[ 30522, 2270, 10763, 3853, 2131, 4328, 4168, 3762, 4135, 9289, 8873, 2571, 1006, 1002, 5371, 18442, 1010, 1002, 12398, 1027, 1005, 4646, 1013, 13323, 3388, 1011, 5460, 1005, 1007, 1063, 1002, 2828, 1027, 6270, 1025, 1013, 1013, 2005, 2334, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Redis/RedisManager.php
RedisManager.connection
public function connection($name = null) { $name = $name ?: 'default'; if (isset($this->connections[$name])) { return $this->connections[$name]; } return $this->connections[$name] = $this->configure( $this->resolve($name), $name ); }
php
public function connection($name = null) { $name = $name ?: 'default'; if (isset($this->connections[$name])) { return $this->connections[$name]; } return $this->connections[$name] = $this->configure( $this->resolve($name), $name ); }
[ "public", "function", "connection", "(", "$", "name", "=", "null", ")", "{", "$", "name", "=", "$", "name", "?", ":", "'default'", ";", "if", "(", "isset", "(", "$", "this", "->", "connections", "[", "$", "name", "]", ")", ")", "{", "return", "$"...
Get a Redis connection by name. @param string|null $name @return \Illuminate\Redis\Connections\Connection
[ "Get", "a", "Redis", "connection", "by", "name", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/RedisManager.php#L70-L81
train
Get the connection object
[ 30522, 2270, 3853, 4434, 1006, 1002, 2171, 1027, 19701, 1007, 1063, 1002, 2171, 1027, 1002, 2171, 1029, 1024, 1005, 12398, 1005, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 7264, 1031, 30524, 1002, 2023, 1011, 1028, 7264, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Yaml/Yaml.php
Yaml.parseFile
public static function parseFile(string $filename, int $flags = 0) { $yaml = new Parser(); return $yaml->parseFile($filename, $flags); }
php
public static function parseFile(string $filename, int $flags = 0) { $yaml = new Parser(); return $yaml->parseFile($filename, $flags); }
[ "public", "static", "function", "parseFile", "(", "string", "$", "filename", ",", "int", "$", "flags", "=", "0", ")", "{", "$", "yaml", "=", "new", "Parser", "(", ")", ";", "return", "$", "yaml", "->", "parseFile", "(", "$", "filename", ",", "$", "...
Parses a YAML file into a PHP value. Usage: $array = Yaml::parseFile('config.yml'); print_r($array); @param string $filename The path to the YAML file to be parsed @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior @return mixed The YAML converted to a PHP value @throws ParseException If the file could not be read or the YAML is not valid
[ "Parses", "a", "YAML", "file", "into", "a", "PHP", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Yaml.php#L52-L57
train
Parse YAML file into array of Grammar objects
[ 30522, 2270, 10763, 3853, 11968, 20106, 9463, 1006, 5164, 1002, 5371, 18442, 1010, 20014, 1002, 9245, 1027, 1014, 1007, 1063, 1002, 8038, 19968, 1027, 2047, 11968, 8043, 1006, 1007, 1025, 2709, 1002, 8038, 19968, 1011, 1028, 11968, 20106, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Model.php
Model.get
protected function get() { if ($this->model instanceof LengthAwarePaginator) { return $this->model; } if ($this->relation) { $this->model = $this->relation->getQuery(); } $this->setSort(); $this->setPaginate(); $this->queries->unique()->each(function ($query) { $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); }); if ($this->model instanceof Collection) { return $this->model; } if ($this->model instanceof LengthAwarePaginator) { $this->handleInvalidPage($this->model); return $this->model->getCollection(); } throw new \Exception('Grid query error'); }
php
protected function get() { if ($this->model instanceof LengthAwarePaginator) { return $this->model; } if ($this->relation) { $this->model = $this->relation->getQuery(); } $this->setSort(); $this->setPaginate(); $this->queries->unique()->each(function ($query) { $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); }); if ($this->model instanceof Collection) { return $this->model; } if ($this->model instanceof LengthAwarePaginator) { $this->handleInvalidPage($this->model); return $this->model->getCollection(); } throw new \Exception('Grid query error'); }
[ "protected", "function", "get", "(", ")", "{", "if", "(", "$", "this", "->", "model", "instanceof", "LengthAwarePaginator", ")", "{", "return", "$", "this", "->", "model", ";", "}", "if", "(", "$", "this", "->", "relation", ")", "{", "$", "this", "->...
@throws \Exception @return Collection
[ "@throws", "\\", "Exception" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L364-L392
train
Get the model
[ 30522, 5123, 3853, 2131, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2944, 6013, 11253, 3091, 10830, 2890, 4502, 20876, 4263, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2944, 1025, 1065, 2065, 1006, 1002, 2023, 1011, 1028, 7189, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Protocol/Pop3.php
Zend_Mail_Protocol_Pop3.logout
public function logout() { if (!$this->_socket) { return; } try { $this->request('QUIT'); } catch (Zend_Mail_Protocol_Exception $e) { // ignore error - we're closing the socket anyway } fclose($this->_socket); $this->_socket = null; }
php
public function logout() { if (!$this->_socket) { return; } try { $this->request('QUIT'); } catch (Zend_Mail_Protocol_Exception $e) { // ignore error - we're closing the socket anyway } fclose($this->_socket); $this->_socket = null; }
[ "public", "function", "logout", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_socket", ")", "{", "return", ";", "}", "try", "{", "$", "this", "->", "request", "(", "'QUIT'", ")", ";", "}", "catch", "(", "Zend_Mail_Protocol_Exception", "$", "e",...
End communication with POP3 server (also closes socket) @return null
[ "End", "communication", "with", "POP3", "server", "(", "also", "closes", "socket", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Pop3.php#L231-L245
train
Logout - sends QUIT to the server
[ 30522, 2270, 3853, 8154, 4904, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 22278, 1007, 1063, 2709, 1025, 1065, 3046, 1063, 1002, 2023, 1011, 1028, 5227, 1006, 1005, 8046, 1005, 1007, 1025, 1065, 4608, 1006, 16729, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/ValidatorBuilder.php
ValidatorBuilder.addYamlMappings
public function addYamlMappings(array $paths) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); } $this->yamlMappings = array_merge($this->yamlMappings, $paths); return $this; }
php
public function addYamlMappings(array $paths) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); } $this->yamlMappings = array_merge($this->yamlMappings, $paths); return $this; }
[ "public", "function", "addYamlMappings", "(", "array", "$", "paths", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "metadataFactory", ")", "{", "throw", "new", "ValidatorException", "(", "'You cannot add custom mappings after setting a custom metadata factory. ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/ValidatorBuilder.php#L147-L156
train
Add YAML mappings
[ 30522, 2270, 3853, 5587, 14852, 19145, 14853, 2015, 1006, 9140, 1002, 10425, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 27425, 21450, 1007, 1063, 5466, 2047, 9398, 8844, 10288, 24422, 1006, 1005, 2017, 3685, 558...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/AudioMedium.php
AudioMedium.controls
public function controls($display = true) { if($display) { $this->attributes['controls'] = true; } else { unset($this->attributes['controls']); } return $this; }
php
public function controls($display = true) { if($display) { $this->attributes['controls'] = true; } else { unset($this->attributes['controls']); } return $this; }
[ "public", "function", "controls", "(", "$", "display", "=", "true", ")", "{", "if", "(", "$", "display", ")", "{", "$", "this", "->", "attributes", "[", "'controls'", "]", "=", "true", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "attrib...
Allows to set or remove the HTML5 default controls @param bool $display @return $this
[ "Allows", "to", "set", "or", "remove", "the", "HTML5", "default", "controls" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AudioMedium.php#L40-L49
train
Set or hide the controls attribute
[ 30522, 2270, 3853, 7711, 1006, 1002, 4653, 1027, 2995, 1007, 1063, 2065, 1006, 1002, 4653, 1007, 1063, 1002, 2023, 1011, 1028, 12332, 1031, 1005, 7711, 1005, 1033, 1027, 2995, 1025, 1065, 2842, 1063, 4895, 13462, 1006, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/Work/Invoice/Client.php
Client.get
public function get(string $cardId, string $encryptCode) { $params = [ 'card_id' => $cardId, 'encrypt_code' => $encryptCode, ]; return $this->httpPostJson('cgi-bin/card/invoice/reimburse/getinvoiceinfo', $params); }
php
public function get(string $cardId, string $encryptCode) { $params = [ 'card_id' => $cardId, 'encrypt_code' => $encryptCode, ]; return $this->httpPostJson('cgi-bin/card/invoice/reimburse/getinvoiceinfo', $params); }
[ "public", "function", "get", "(", "string", "$", "cardId", ",", "string", "$", "encryptCode", ")", "{", "$", "params", "=", "[", "'card_id'", "=>", "$", "cardId", ",", "'encrypt_code'", "=>", "$", "encryptCode", ",", "]", ";", "return", "$", "this", "-...
@param string $cardId @param string $encryptCode @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "@param", "string", "$cardId", "@param", "string", "$encryptCode" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Work/Invoice/Client.php#L31-L39
train
Get invoice info
[ 30522, 2270, 3853, 2131, 1006, 5164, 1002, 4003, 3593, 1010, 5164, 1002, 4372, 26775, 22571, 13535, 10244, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 4003, 1035, 8909, 1005, 1027, 1028, 1002, 4003, 3593, 1010, 1005, 4372, 26775, 22571...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/OptionsResolver/OptionsResolver.php
OptionsResolver.clear
public function clear() { if ($this->locked) { throw new AccessException('Options cannot be cleared from a lazy option or normalizer.'); } $this->defined = []; $this->defaults = []; $this->nested = []; $this->required = []; $this->resolved = []; $this->lazy = []; $this->normalizers = []; $this->allowedTypes = []; $this->allowedValues = []; $this->deprecated = []; return $this; }
php
public function clear() { if ($this->locked) { throw new AccessException('Options cannot be cleared from a lazy option or normalizer.'); } $this->defined = []; $this->defaults = []; $this->nested = []; $this->required = []; $this->resolved = []; $this->lazy = []; $this->normalizers = []; $this->allowedTypes = []; $this->allowedValues = []; $this->deprecated = []; return $this; }
[ "public", "function", "clear", "(", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "AccessException", "(", "'Options cannot be cleared from a lazy option or normalizer.'", ")", ";", "}", "$", "this", "->", "defined", "=", "[", "]",...
Removes all options. @return $this @throws AccessException If called from a lazy option or normalizer
[ "Removes", "all", "options", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L736-L754
train
Clears all options from the current instance.
[ 30522, 2270, 3853, 3154, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 3229, 10288, 24422, 1006, 1005, 7047, 3685, 2022, 5985, 2013, 1037, 13971, 5724, 2030, 3671, 17629, 1012, 1005, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Profiler/Profiler.php
Profiler.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { if (false === $this->enabled) { return; } $profile = new Profile(substr(hash('sha256', uniqid(mt_rand(), true)), 0, 6)); $profile->setTime(time()); $profile->setUrl($request->getUri()); $profile->setMethod($request->getMethod()); $profile->setStatusCode($response->getStatusCode()); try { $profile->setIp($request->getClientIp()); } catch (ConflictingHeadersException $e) { $profile->setIp('Unknown'); } if ($prevToken = $response->headers->get('X-Debug-Token')) { $response->headers->set('X-Previous-Debug-Token', $prevToken); } $response->headers->set('X-Debug-Token', $profile->getToken()); foreach ($this->collectors as $collector) { $collector->collect($request, $response, $exception); // we need to clone for sub-requests $profile->addCollector(clone $collector); } return $profile; }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { if (false === $this->enabled) { return; } $profile = new Profile(substr(hash('sha256', uniqid(mt_rand(), true)), 0, 6)); $profile->setTime(time()); $profile->setUrl($request->getUri()); $profile->setMethod($request->getMethod()); $profile->setStatusCode($response->getStatusCode()); try { $profile->setIp($request->getClientIp()); } catch (ConflictingHeadersException $e) { $profile->setIp('Unknown'); } if ($prevToken = $response->headers->get('X-Debug-Token')) { $response->headers->set('X-Previous-Debug-Token', $prevToken); } $response->headers->set('X-Debug-Token', $profile->getToken()); foreach ($this->collectors as $collector) { $collector->collect($request, $response, $exception); // we need to clone for sub-requests $profile->addCollector(clone $collector); } return $profile; }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "if", "(", "false", "===", "$", "this", "->", "enabled", ")", "{", "return", ";", "}", ...
Collects data for the given Response. @return Profile|null A Profile instance or null if the profiler is disabled
[ "Collects", "data", "for", "the", "given", "Response", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Profiler/Profiler.php#L143-L174
train
Collect the profile
[ 30522, 2270, 3853, 8145, 1006, 5227, 1002, 5227, 1010, 3433, 1002, 3433, 1010, 1032, 6453, 1002, 6453, 1027, 19701, 1007, 1063, 2065, 1006, 6270, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 9124, 1007, 1063, 2709, 1025, 1065, 1002, 6337, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Widgets/Form.php
Form.method
public function method($method = 'POST') { if (strtolower($method) == 'put') { $this->hidden('_method')->default($method); return $this; } return $this->attribute('method', strtoupper($method)); }
php
public function method($method = 'POST') { if (strtolower($method) == 'put') { $this->hidden('_method')->default($method); return $this; } return $this->attribute('method', strtoupper($method)); }
[ "public", "function", "method", "(", "$", "method", "=", "'POST'", ")", "{", "if", "(", "strtolower", "(", "$", "method", ")", "==", "'put'", ")", "{", "$", "this", "->", "hidden", "(", "'_method'", ")", "->", "default", "(", "$", "method", ")", ";...
Method of the form. @param string $method @return $this
[ "Method", "of", "the", "form", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Form.php#L134-L143
train
Method to set
[ 30522, 2270, 3853, 4118, 1006, 1002, 4118, 1027, 1005, 2695, 1005, 1007, 1063, 2065, 1006, 2358, 5339, 12898, 13777, 1006, 1002, 4118, 1007, 1027, 1027, 1005, 2404, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 5023, 1006, 1005, 1035, 4118, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Columns/Dimension.php
Dimension.install
public function install() { if (empty($this->columnName) || empty($this->columnType) || empty($this->dbTableName)) { return array(); } // TODO if table does not exist, create it with a primary key, but at this point we cannot really create it // cause we need to show the query in the UI first and user needs to be able to create table manually. // we cannot return something like "create table " here as it would be returned for each table etc. // we need to do this in column updater etc! return array( $this->dbTableName => array("ADD COLUMN `$this->columnName` $this->columnType") ); }
php
public function install() { if (empty($this->columnName) || empty($this->columnType) || empty($this->dbTableName)) { return array(); } // TODO if table does not exist, create it with a primary key, but at this point we cannot really create it // cause we need to show the query in the UI first and user needs to be able to create table manually. // we cannot return something like "create table " here as it would be returned for each table etc. // we need to do this in column updater etc! return array( $this->dbTableName => array("ADD COLUMN `$this->columnName` $this->columnType") ); }
[ "public", "function", "install", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "columnName", ")", "||", "empty", "(", "$", "this", "->", "columnType", ")", "||", "empty", "(", "$", "this", "->", "dbTableName", ")", ")", "{", "return", ...
Installs the action dimension in case it is not installed yet. The installation is already implemented based on the {@link $columnName} and {@link $columnType}. If you want to perform additional actions beside adding the column to the database - for instance adding an index - you can overwrite this method. We recommend to call this parent method to get the minimum required actions and then add further custom actions since this makes sure the column will be installed correctly. We also recommend to change the default install behavior only if really needed. FYI: We do not directly execute those alter table statements here as we group them together with several other alter table statements do execute those changes in one step which results in a faster installation. The column will be added to the `log_link_visit_action` MySQL table. Example: ``` public function install() { $changes = parent::install(); $changes['log_link_visit_action'][] = "ADD INDEX index_idsite_servertime ( idsite, server_time )"; return $changes; } ``` @return array An array containing the table name as key and an array of MySQL alter table statements that should be executed on the given table. Example: ``` array( 'log_link_visit_action' => array("ADD COLUMN `$this->columnName` $this->columnType", "ADD INDEX ...") ); ``` @api
[ "Installs", "the", "action", "dimension", "in", "case", "it", "is", "not", "installed", "yet", ".", "The", "installation", "is", "already", "implemented", "based", "on", "the", "{", "@link", "$columnName", "}", "and", "{", "@link", "$columnType", "}", ".", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/Dimension.php#L261-L275
train
install method for adding column
[ 30522, 2270, 3853, 16500, 1006, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 5930, 18442, 1007, 1064, 1064, 4064, 1006, 1002, 2023, 1011, 1028, 5930, 13874, 1007, 1064, 1064, 4064, 1006, 1002, 2023, 1011, 1028, 16962, 10880, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php
ContainerAwareLoader.addFixture
public function addFixture(FixtureInterface $fixture) { if ($fixture instanceof ContainerAwareInterface) { $fixture->setContainer($this->container); } parent::addFixture($fixture); }
php
public function addFixture(FixtureInterface $fixture) { if ($fixture instanceof ContainerAwareInterface) { $fixture->setContainer($this->container); } parent::addFixture($fixture); }
[ "public", "function", "addFixture", "(", "FixtureInterface", "$", "fixture", ")", "{", "if", "(", "$", "fixture", "instanceof", "ContainerAwareInterface", ")", "{", "$", "fixture", "->", "setContainer", "(", "$", "this", "->", "container", ")", ";", "}", "pa...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php#L38-L45
train
Adds a fixture to the container
[ 30522, 2270, 3853, 5587, 8873, 18413, 5397, 1006, 15083, 18447, 2121, 12172, 1002, 15083, 1007, 1063, 2065, 1006, 1002, 15083, 6013, 11253, 11661, 10830, 2890, 18447, 2121, 12172, 1007, 1063, 1002, 15083, 1011, 1028, 2275, 8663, 18249, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/Loader/FilesystemLoader.php
FilesystemLoader.load
public function load(TemplateReferenceInterface $template) { $file = $template->get('name'); if (self::isAbsolutePath($file) && is_file($file)) { return new FileStorage($file); } $replacements = []; foreach ($template->all() as $key => $value) { $replacements['%'.$key.'%'] = $value; } $fileFailures = []; foreach ($this->templatePathPatterns as $templatePathPattern) { if (is_file($file = strtr($templatePathPattern, $replacements)) && is_readable($file)) { if (null !== $this->logger) { $this->logger->debug('Loaded template file.', ['file' => $file]); } return new FileStorage($file); } if (null !== $this->logger) { $fileFailures[] = $file; } } // only log failures if no template could be loaded at all foreach ($fileFailures as $file) { if (null !== $this->logger) { $this->logger->debug('Failed loading template file.', ['file' => $file]); } } return false; }
php
public function load(TemplateReferenceInterface $template) { $file = $template->get('name'); if (self::isAbsolutePath($file) && is_file($file)) { return new FileStorage($file); } $replacements = []; foreach ($template->all() as $key => $value) { $replacements['%'.$key.'%'] = $value; } $fileFailures = []; foreach ($this->templatePathPatterns as $templatePathPattern) { if (is_file($file = strtr($templatePathPattern, $replacements)) && is_readable($file)) { if (null !== $this->logger) { $this->logger->debug('Loaded template file.', ['file' => $file]); } return new FileStorage($file); } if (null !== $this->logger) { $fileFailures[] = $file; } } // only log failures if no template could be loaded at all foreach ($fileFailures as $file) { if (null !== $this->logger) { $this->logger->debug('Failed loading template file.', ['file' => $file]); } } return false; }
[ "public", "function", "load", "(", "TemplateReferenceInterface", "$", "template", ")", "{", "$", "file", "=", "$", "template", "->", "get", "(", "'name'", ")", ";", "if", "(", "self", "::", "isAbsolutePath", "(", "$", "file", ")", "&&", "is_file", "(", ...
Loads a template. @return Storage|bool false if the template cannot be loaded, a Storage instance otherwise
[ "Loads", "a", "template", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Loader/FilesystemLoader.php#L40-L76
train
Load a template file
[ 30522, 2270, 3853, 7170, 1006, 23561, 2890, 25523, 18447, 2121, 12172, 1002, 23561, 1007, 1063, 1002, 5371, 1027, 1002, 23561, 1011, 1028, 2131, 1006, 1005, 2171, 1005, 1007, 1025, 2065, 1006, 2969, 1024, 1024, 18061, 5910, 4747, 10421, 150...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/DynamoDbStore.php
DynamoDbStore.add
public function add($key, $value, $seconds) { try { $this->dynamo->putItem([ 'TableName' => $this->table, 'Item' => [ $this->keyAttribute => [ 'S' => $this->prefix.$key, ], $this->valueAttribute => [ $this->type($value) => $this->serialize($value), ], $this->expirationAttribute => [ 'N' => (string) $this->toTimestamp($seconds), ], ], 'ConditionExpression' => 'attribute_not_exists(#key) OR #expires_at < :now', 'ExpressionAttributeNames' => [ '#key' => $this->keyAttribute, '#expires_at' => $this->expirationAttribute, ], 'ExpressionAttributeValues' => [ ':now' => [ 'N' => (string) Carbon::now()->getTimestamp(), ], ], ]); return true; } catch (DynamoDbException $e) { if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) { return false; } throw $e; } }
php
public function add($key, $value, $seconds) { try { $this->dynamo->putItem([ 'TableName' => $this->table, 'Item' => [ $this->keyAttribute => [ 'S' => $this->prefix.$key, ], $this->valueAttribute => [ $this->type($value) => $this->serialize($value), ], $this->expirationAttribute => [ 'N' => (string) $this->toTimestamp($seconds), ], ], 'ConditionExpression' => 'attribute_not_exists(#key) OR #expires_at < :now', 'ExpressionAttributeNames' => [ '#key' => $this->keyAttribute, '#expires_at' => $this->expirationAttribute, ], 'ExpressionAttributeValues' => [ ':now' => [ 'N' => (string) Carbon::now()->getTimestamp(), ], ], ]); return true; } catch (DynamoDbException $e) { if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) { return false; } throw $e; } }
[ "public", "function", "add", "(", "$", "key", ",", "$", "value", ",", "$", "seconds", ")", "{", "try", "{", "$", "this", "->", "dynamo", "->", "putItem", "(", "[", "'TableName'", "=>", "$", "this", "->", "table", ",", "'Item'", "=>", "[", "$", "t...
Store an item in the cache if the key doesn't exist. @param string $key @param mixed $value @param int $seconds @return bool
[ "Store", "an", "item", "in", "the", "cache", "if", "the", "key", "doesn", "t", "exist", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/DynamoDbStore.php#L256-L292
train
Add an item to the cache
[ 30522, 2270, 3853, 5587, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 3823, 1007, 1063, 3046, 1063, 1002, 2023, 1011, 1028, 17205, 1011, 1028, 2404, 4221, 2213, 1006, 1031, 1005, 2795, 18442, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/TableStyle.php
TableStyle.setPadType
public function setPadType($padType) { if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); } $this->padType = $padType; return $this; }
php
public function setPadType($padType) { if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); } $this->padType = $padType; return $this; }
[ "public", "function", "setPadType", "(", "$", "padType", ")", "{", "if", "(", "!", "\\", "in_array", "(", "$", "padType", ",", "[", "STR_PAD_LEFT", ",", "STR_PAD_RIGHT", ",", "STR_PAD_BOTH", "]", ",", "true", ")", ")", "{", "throw", "new", "InvalidArgume...
Sets cell padding type. @param int $padType STR_PAD_* @return $this
[ "Sets", "cell", "padding", "type", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L414-L423
train
Set padding type
[ 30522, 2270, 3853, 2275, 15455, 13874, 1006, 1002, 11687, 13874, 1007, 1063, 2065, 1006, 999, 1032, 1999, 1035, 9140, 30524, 1035, 2157, 1010, 2358, 2099, 1035, 11687, 1035, 2119, 1033, 1010, 2995, 1007, 1007, 1063, 5466, 2047, 19528, 2906,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Widgets/Table.php
Table.render
public function render() { $vars = [ 'headers' => $this->headers, 'rows' => $this->rows, 'style' => $this->style, 'attributes' => $this->formatAttributes(), ]; return view($this->view, $vars)->render(); }
php
public function render() { $vars = [ 'headers' => $this->headers, 'rows' => $this->rows, 'style' => $this->style, 'attributes' => $this->formatAttributes(), ]; return view($this->view, $vars)->render(); }
[ "public", "function", "render", "(", ")", "{", "$", "vars", "=", "[", "'headers'", "=>", "$", "this", "->", "headers", ",", "'rows'", "=>", "$", "this", "->", "rows", ",", "'style'", "=>", "$", "this", "->", "style", ",", "'attributes'", "=>", "$", ...
Render the table. @return string
[ "Render", "the", "table", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Table.php#L101-L111
train
Render the table
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 1002, 13075, 2015, 1027, 1031, 1005, 20346, 2015, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 20346, 2015, 1010, 1005, 10281, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 10281, 1010, 1005, 2806, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Show.php
Show.getResourcePath
public function getResourcePath() { if (empty($this->resource)) { $path = request()->path(); $segments = explode('/', $path); array_pop($segments); $this->resource = implode('/', $segments); } return $this->resource; }
php
public function getResourcePath() { if (empty($this->resource)) { $path = request()->path(); $segments = explode('/', $path); array_pop($segments); $this->resource = implode('/', $segments); } return $this->resource; }
[ "public", "function", "getResourcePath", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "resource", ")", ")", "{", "$", "path", "=", "request", "(", ")", "->", "path", "(", ")", ";", "$", "segments", "=", "explode", "(", "'/'", ",", "...
Get resource path. @return string
[ "Get", "resource", "path", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L316-L328
train
Get resource path
[ 30522, 2270, 3853, 2131, 6072, 8162, 3401, 15069, 1006, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 7692, 1007, 1007, 1063, 1002, 4130, 1027, 5227, 1006, 1007, 1011, 1028, 4130, 1006, 1007, 1025, 1002, 9214, 1027, 15044, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Authenticator/TwoFactorAuthenticator.php
TwoFactorAuthenticator.createSecret
public function createSecret($secretLength = 16) { $validChars = $this->_getBase32LookupTable(); unset($validChars[32]); // modified by matomo.org return \Piwik\Common::getRandomString($secretLength, implode('', $validChars)); }
php
public function createSecret($secretLength = 16) { $validChars = $this->_getBase32LookupTable(); unset($validChars[32]); // modified by matomo.org return \Piwik\Common::getRandomString($secretLength, implode('', $validChars)); }
[ "public", "function", "createSecret", "(", "$", "secretLength", "=", "16", ")", "{", "$", "validChars", "=", "$", "this", "->", "_getBase32LookupTable", "(", ")", ";", "unset", "(", "$", "validChars", "[", "32", "]", ")", ";", "// modified by matomo.org", ...
Create new secret. 16 characters, randomly chosen from the allowed base32 characters. @param int $secretLength @return string
[ "Create", "new", "secret", ".", "16", "characters", "randomly", "chosen", "from", "the", "allowed", "base32", "characters", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Authenticator/TwoFactorAuthenticator.php#L28-L35
train
Create a secret of the given length
[ 30522, 2270, 3853, 9005, 8586, 13465, 1006, 1002, 3595, 7770, 13512, 2232, 1027, 2385, 1007, 1063, 1002, 9398, 7507, 2869, 1027, 1002, 2023, 1011, 1028, 1035, 2131, 15058, 16703, 4135, 21940, 22799, 3468, 1006, 1007, 1025, 4895, 13462, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/SessionUtils.php
SessionUtils.popSessionCookie
public static function popSessionCookie(string $sessionName, string $sessionId): ?string { $sessionCookie = null; $sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId)); $otherCookies = []; foreach (headers_list() as $h) { if (0 !== stripos($h, 'Set-Cookie:')) { continue; } if (11 === strpos($h, $sessionCookiePrefix, 11)) { $sessionCookie = $h; if (11 !== strpos($h, $sessionCookieWithId, 11)) { $otherCookies[] = $h; } } else { $otherCookies[] = $h; } } if (null === $sessionCookie) { return null; } header_remove('Set-Cookie'); foreach ($otherCookies as $h) { header($h, false); } return $sessionCookie; }
php
public static function popSessionCookie(string $sessionName, string $sessionId): ?string { $sessionCookie = null; $sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId)); $otherCookies = []; foreach (headers_list() as $h) { if (0 !== stripos($h, 'Set-Cookie:')) { continue; } if (11 === strpos($h, $sessionCookiePrefix, 11)) { $sessionCookie = $h; if (11 !== strpos($h, $sessionCookieWithId, 11)) { $otherCookies[] = $h; } } else { $otherCookies[] = $h; } } if (null === $sessionCookie) { return null; } header_remove('Set-Cookie'); foreach ($otherCookies as $h) { header($h, false); } return $sessionCookie; }
[ "public", "static", "function", "popSessionCookie", "(", "string", "$", "sessionName", ",", "string", "$", "sessionId", ")", ":", "?", "string", "{", "$", "sessionCookie", "=", "null", ";", "$", "sessionCookiePrefix", "=", "sprintf", "(", "' %s='", ",", "url...
Finds the session header amongst the headers that are to be sent, removes it, and returns it so the caller can process it further.
[ "Finds", "the", "session", "header", "amongst", "the", "headers", "that", "are", "to", "be", "sent", "removes", "it", "and", "returns", "it", "so", "the", "caller", "can", "process", "it", "further", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php#L28-L58
train
Pop session cookie
[ 30522, 2270, 10763, 3853, 16949, 7971, 3258, 3597, 23212, 2063, 1006, 5164, 1002, 5219, 18442, 1010, 5164, 1002, 5219, 3593, 1007, 1024, 1029, 5164, 1063, 1002, 5219, 3597, 23212, 2063, 1027, 19701, 1025, 1002, 5219, 3597, 23212, 13699, 289...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Select.php
Zend_Db_Select._renderLimitoffset
protected function _renderLimitoffset($sql) { $count = 0; $offset = 0; if (!empty($this->_parts[self::LIMIT_OFFSET])) { $offset = (int) $this->_parts[self::LIMIT_OFFSET]; $count = PHP_INT_MAX; } if (!empty($this->_parts[self::LIMIT_COUNT])) { $count = (int) $this->_parts[self::LIMIT_COUNT]; } /* * Add limits clause */ if ($count > 0) { $sql = trim($this->_adapter->limit($sql, $count, $offset)); } return $sql; }
php
protected function _renderLimitoffset($sql) { $count = 0; $offset = 0; if (!empty($this->_parts[self::LIMIT_OFFSET])) { $offset = (int) $this->_parts[self::LIMIT_OFFSET]; $count = PHP_INT_MAX; } if (!empty($this->_parts[self::LIMIT_COUNT])) { $count = (int) $this->_parts[self::LIMIT_COUNT]; } /* * Add limits clause */ if ($count > 0) { $sql = trim($this->_adapter->limit($sql, $count, $offset)); } return $sql; }
[ "protected", "function", "_renderLimitoffset", "(", "$", "sql", ")", "{", "$", "count", "=", "0", ";", "$", "offset", "=", "0", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "_parts", "[", "self", "::", "LIMIT_OFFSET", "]", ")", ")", "{", ...
Render LIMIT OFFSET clause @param string $sql SQL query @return string
[ "Render", "LIMIT", "OFFSET", "clause" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L1254-L1276
train
Render limit clause
[ 30522, 5123, 3853, 1035, 17552, 17960, 9956, 21807, 3388, 1006, 1002, 29296, 1007, 1063, 1002, 4175, 1027, 1014, 1025, 1002, 16396, 1027, 1014, 1025, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 1035, 3033, 1031, 2969, 1024, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.url
public function url($include_host = false) { if ($include_host) { return $this->url; } $url = str_replace($this->base, '', rtrim($this->url, '/')); return $url ?: '/'; }
php
public function url($include_host = false) { if ($include_host) { return $this->url; } $url = str_replace($this->base, '', rtrim($this->url, '/')); return $url ?: '/'; }
[ "public", "function", "url", "(", "$", "include_host", "=", "false", ")", "{", "if", "(", "$", "include_host", ")", "{", "return", "$", "this", "->", "url", ";", "}", "$", "url", "=", "str_replace", "(", "$", "this", "->", "base", ",", "''", ",", ...
Return URL. @param bool $include_host Include hostname. @return string
[ "Return", "URL", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L337-L346
train
Get the URL of the current page
[ 30522, 2270, 3853, 24471, 2140, 1006, 1002, 2421, 1035, 3677, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 2421, 1035, 3677, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 24471, 2140, 1025, 1065, 1002, 24471, 2140, 1027, 2358, 2099, 1035, 5672, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/MobileMessaging/API.php
API.getPhoneNumbers
public function getPhoneNumbers() { Piwik::checkUserIsNotAnonymous(); $rawPhoneNumbers = $this->retrievePhoneNumbers(); $phoneNumbers = array(); foreach ($rawPhoneNumbers as $phoneNumber => $verificationCode) { $phoneNumbers[$phoneNumber] = self::isActivated($verificationCode); } return $phoneNumbers; }
php
public function getPhoneNumbers() { Piwik::checkUserIsNotAnonymous(); $rawPhoneNumbers = $this->retrievePhoneNumbers(); $phoneNumbers = array(); foreach ($rawPhoneNumbers as $phoneNumber => $verificationCode) { $phoneNumbers[$phoneNumber] = self::isActivated($verificationCode); } return $phoneNumbers; }
[ "public", "function", "getPhoneNumbers", "(", ")", "{", "Piwik", "::", "checkUserIsNotAnonymous", "(", ")", ";", "$", "rawPhoneNumbers", "=", "$", "this", "->", "retrievePhoneNumbers", "(", ")", ";", "$", "phoneNumbers", "=", "array", "(", ")", ";", "foreach...
get phone number list @return array $phoneNumber => $isValidated @ignore
[ "get", "phone", "number", "list" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MobileMessaging/API.php#L300-L312
train
Returns an array of phone numbers that are activated
[ 30522, 2270, 3853, 2131, 9864, 19172, 17198, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 2483, 17048, 6761, 4890, 27711, 1006, 1007, 1025, 1002, 6315, 9864, 19172, 17198, 1027, 1002, 2023, 1011, 1028, 12850, 9864, 19172, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/API/DataTableManipulator.php
DataTableManipulator.manipulate
protected function manipulate($dataTable) { if ($dataTable instanceof DataTable\Map) { return $this->manipulateDataTableMap($dataTable); } elseif ($dataTable instanceof DataTable) { return $this->manipulateDataTable($dataTable); } else { return $dataTable; } }
php
protected function manipulate($dataTable) { if ($dataTable instanceof DataTable\Map) { return $this->manipulateDataTableMap($dataTable); } elseif ($dataTable instanceof DataTable) { return $this->manipulateDataTable($dataTable); } else { return $dataTable; } }
[ "protected", "function", "manipulate", "(", "$", "dataTable", ")", "{", "if", "(", "$", "dataTable", "instanceof", "DataTable", "\\", "Map", ")", "{", "return", "$", "this", "->", "manipulateDataTableMap", "(", "$", "dataTable", ")", ";", "}", "elseif", "(...
This method can be used by subclasses to iterate over data tables that might be data table maps. It calls back the template method self::doManipulate for each table. This way, data table arrays can be handled in a transparent fashion. @param DataTable\Map|DataTable $dataTable @throws Exception @return DataTable\Map|DataTable
[ "This", "method", "can", "be", "used", "by", "subclasses", "to", "iterate", "over", "data", "tables", "that", "might", "be", "data", "table", "maps", ".", "It", "calls", "back", "the", "template", "method", "self", "::", "doManipulate", "for", "each", "tab...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DataTableManipulator.php#L61-L70
train
Manipulate a DataTable
[ 30522, 5123, 3853, 17708, 1006, 1002, 2951, 10880, 1007, 1063, 2065, 1006, 1002, 2951, 10880, 6013, 11253, 2951, 10880, 1032, 4949, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 20063, 6790, 10880, 2863, 2361, 1006, 1002, 2951, 10880, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Classification/Ensemble/AdaBoost.php
AdaBoost.resample
protected function resample(): array { $weights = $this->weights; $std = StandardDeviation::population($weights); $mean = Mean::arithmetic($weights); $min = min($weights); $minZ = (int) round(($min - $mean) / $std); $samples = []; $targets = []; foreach ($weights as $index => $weight) { $z = (int) round(($weight - $mean) / $std) - $minZ + 1; for ($i = 0; $i < $z; ++$i) { if (random_int(0, 1) == 0) { continue; } $samples[] = $this->samples[$index]; $targets[] = $this->targets[$index]; } } return [$samples, $targets]; }
php
protected function resample(): array { $weights = $this->weights; $std = StandardDeviation::population($weights); $mean = Mean::arithmetic($weights); $min = min($weights); $minZ = (int) round(($min - $mean) / $std); $samples = []; $targets = []; foreach ($weights as $index => $weight) { $z = (int) round(($weight - $mean) / $std) - $minZ + 1; for ($i = 0; $i < $z; ++$i) { if (random_int(0, 1) == 0) { continue; } $samples[] = $this->samples[$index]; $targets[] = $this->targets[$index]; } } return [$samples, $targets]; }
[ "protected", "function", "resample", "(", ")", ":", "array", "{", "$", "weights", "=", "$", "this", "->", "weights", ";", "$", "std", "=", "StandardDeviation", "::", "population", "(", "$", "weights", ")", ";", "$", "mean", "=", "Mean", "::", "arithmet...
Resamples the dataset in accordance with the weights and returns the new dataset
[ "Resamples", "the", "dataset", "in", "accordance", "with", "the", "weights", "and", "returns", "the", "new", "dataset" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Ensemble/AdaBoost.php#L180-L203
train
Resamples the weights and returns the samples and targets
[ 30522, 5123, 3853, 24501, 16613, 2571, 1006, 1007, 1024, 9140, 1063, 1002, 15871, 1027, 1002, 2023, 1011, 1028, 15871, 1025, 1002, 2358, 2094, 1027, 3115, 24844, 18963, 1024, 1024, 2313, 1006, 1002, 15871, 1007, 1025, 1002, 2812, 1027, 2812...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Resource/GlobResource.php
GlobResource.isFresh
public function isFresh($timestamp) { $hash = $this->computeHash(); if (null === $this->hash) { $this->hash = $hash; } return $this->hash === $hash; }
php
public function isFresh($timestamp) { $hash = $this->computeHash(); if (null === $this->hash) { $this->hash = $hash; } return $this->hash === $hash; }
[ "public", "function", "isFresh", "(", "$", "timestamp", ")", "{", "$", "hash", "=", "$", "this", "->", "computeHash", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "hash", ")", "{", "$", "this", "->", "hash", "=", "$", "hash", ";", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Resource/GlobResource.php#L71-L80
train
Checks if the current hash is fresh.
[ 30522, 2270, 3853, 2003, 19699, 9953, 1006, 1002, 2335, 15464, 2361, 1007, 1063, 1002, 23325, 1027, 1002, 2023, 1011, 1028, 24134, 14949, 2232, 1006, 1007, 1025, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 23325, 1007, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Frontend/Page.php
Zend_Cache_Frontend_Page._makeId
protected function _makeId() { $tmp = $_SERVER['REQUEST_URI']; $array = explode('?', $tmp, 2); $tmp = $array[0]; foreach (array('Get', 'Post', 'Session', 'Files', 'Cookie') as $arrayName) { $tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']); if ($tmp2===false) { return false; } $tmp = $tmp . $tmp2; } return md5($tmp); }
php
protected function _makeId() { $tmp = $_SERVER['REQUEST_URI']; $array = explode('?', $tmp, 2); $tmp = $array[0]; foreach (array('Get', 'Post', 'Session', 'Files', 'Cookie') as $arrayName) { $tmp2 = $this->_makePartialId($arrayName, $this->_activeOptions['cache_with_' . strtolower($arrayName) . '_variables'], $this->_activeOptions['make_id_with_' . strtolower($arrayName) . '_variables']); if ($tmp2===false) { return false; } $tmp = $tmp . $tmp2; } return md5($tmp); }
[ "protected", "function", "_makeId", "(", ")", "{", "$", "tmp", "=", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ";", "$", "array", "=", "explode", "(", "'?'", ",", "$", "tmp", ",", "2", ")", ";", "$", "tmp", "=", "$", "array", "[", "0", "]", ";"...
Make an id depending on REQUEST_URI and superglobal arrays (depending on options) @return mixed|false a cache id (string), false if the cache should have not to be used
[ "Make", "an", "id", "depending", "on", "REQUEST_URI", "and", "superglobal", "arrays", "(", "depending", "on", "options", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/Page.php#L340-L353
train
Generate ID of current request
[ 30522, 5123, 3853, 1035, 2191, 3593, 1006, 1007, 1063, 1002, 1056, 8737, 1027, 1002, 1035, 8241, 1031, 1005, 5227, 1035, 24471, 2072, 1005, 1033, 1025, 1002, 9140, 1027, 15044, 1006, 1005, 1029, 1005, 1010, 1002, 1056, 8737, 1010, 1016, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Lists.php
Lists.evalCustomListType
protected function evalCustomListType($type, $record, $column, $value) { $plugins = PluginManager::instance()->getRegistrationMethodValues('registerListColumnTypes'); foreach ($plugins as $availableTypes) { if (!isset($availableTypes[$type])) { continue; } $callback = $availableTypes[$type]; if (is_callable($callback)) { return call_user_func_array($callback, [$value, $column, $record]); } } throw new ApplicationException(sprintf('List column type "%s" could not be found.', $type)); }
php
protected function evalCustomListType($type, $record, $column, $value) { $plugins = PluginManager::instance()->getRegistrationMethodValues('registerListColumnTypes'); foreach ($plugins as $availableTypes) { if (!isset($availableTypes[$type])) { continue; } $callback = $availableTypes[$type]; if (is_callable($callback)) { return call_user_func_array($callback, [$value, $column, $record]); } } throw new ApplicationException(sprintf('List column type "%s" could not be found.', $type)); }
[ "protected", "function", "evalCustomListType", "(", "$", "type", ",", "$", "record", ",", "$", "column", ",", "$", "value", ")", "{", "$", "plugins", "=", "PluginManager", "::", "instance", "(", ")", "->", "getRegistrationMethodValues", "(", "'registerListColu...
Process a custom list types registered by plugins.
[ "Process", "a", "custom", "list", "types", "registered", "by", "plugins", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1125-L1142
train
Evaluate custom list column type
[ 30522, 5123, 3853, 9345, 15472, 19966, 5358, 9863, 13874, 1006, 1002, 2828, 1010, 1002, 2501, 1010, 1002, 5930, 1010, 1002, 3643, 1007, 1063, 1002, 13354, 7076, 1027, 13354, 2378, 24805, 4590, 1024, 1024, 6013, 1006, 1007, 1011, 1028, 2131,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Input/Input.php
Input.bind
public function bind(InputDefinition $definition) { $this->arguments = []; $this->options = []; $this->definition = $definition; $this->parse(); }
php
public function bind(InputDefinition $definition) { $this->arguments = []; $this->options = []; $this->definition = $definition; $this->parse(); }
[ "public", "function", "bind", "(", "InputDefinition", "$", "definition", ")", "{", "$", "this", "->", "arguments", "=", "[", "]", ";", "$", "this", "->", "options", "=", "[", "]", ";", "$", "this", "->", "definition", "=", "$", "definition", ";", "$"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/Input.php#L49-L56
train
Binds the current input definition to the current context.
[ 30522, 2270, 3853, 14187, 1006, 7953, 3207, 16294, 22753, 1002, 6210, 1007, 1063, 1002, 2023, 1011, 1028, 9918, 1027, 1031, 1033, 1025, 1002, 2023, 1011, 1028, 7047, 1027, 1031, 1033, 1025, 1002, 2023, 1011, 1028, 6210, 1027, 1002, 6210, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php
AttributeMetadata.merge
public function merge(AttributeMetadataInterface $attributeMetadata) { foreach ($attributeMetadata->getGroups() as $group) { $this->addGroup($group); } // Overwrite only if not defined if (null === $this->maxDepth) { $this->maxDepth = $attributeMetadata->getMaxDepth(); } // Overwrite only if not defined if (null === $this->serializedName) { $this->serializedName = $attributeMetadata->getSerializedName(); } }
php
public function merge(AttributeMetadataInterface $attributeMetadata) { foreach ($attributeMetadata->getGroups() as $group) { $this->addGroup($group); } // Overwrite only if not defined if (null === $this->maxDepth) { $this->maxDepth = $attributeMetadata->getMaxDepth(); } // Overwrite only if not defined if (null === $this->serializedName) { $this->serializedName = $attributeMetadata->getSerializedName(); } }
[ "public", "function", "merge", "(", "AttributeMetadataInterface", "$", "attributeMetadata", ")", "{", "foreach", "(", "$", "attributeMetadata", "->", "getGroups", "(", ")", "as", "$", "group", ")", "{", "$", "this", "->", "addGroup", "(", "$", "group", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php#L119-L134
train
Merge this attribute metadata with the given one
[ 30522, 2270, 3853, 13590, 1006, 17961, 11368, 8447, 18249, 3334, 12172, 1002, 17961, 11368, 8447, 2696, 1007, 1063, 18921, 6776, 1006, 1002, 17961, 11368, 8447, 2696, 1011, 1028, 2131, 17058, 2015, 1006, 1007, 2004, 1002, 2177, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Session.php
Zend_Session.setOptions
public static function setOptions(array $userOptions = array()) { // set default options on first run only (before applying user settings) if (!self::$_defaultOptionsSet) { foreach (self::$_defaultOptions as $defaultOptionName => $defaultOptionValue) { if (isset(self::$_defaultOptions[$defaultOptionName])) { @ini_set("session.$defaultOptionName", $defaultOptionValue); } } self::$_defaultOptionsSet = true; } // set the options the user has requested to set foreach ($userOptions as $userOptionName => $userOptionValue) { $userOptionName = strtolower($userOptionName); // set the ini based values if (array_key_exists($userOptionName, self::$_defaultOptions)) { @ini_set("session.$userOptionName", $userOptionValue); } elseif (isset(self::$_localOptions[$userOptionName])) { self::${self::$_localOptions[$userOptionName]} = $userOptionValue; } else { /** @see Zend_Session_Exception */ // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("Unknown option: $userOptionName = $userOptionValue"); } } }
php
public static function setOptions(array $userOptions = array()) { // set default options on first run only (before applying user settings) if (!self::$_defaultOptionsSet) { foreach (self::$_defaultOptions as $defaultOptionName => $defaultOptionValue) { if (isset(self::$_defaultOptions[$defaultOptionName])) { @ini_set("session.$defaultOptionName", $defaultOptionValue); } } self::$_defaultOptionsSet = true; } // set the options the user has requested to set foreach ($userOptions as $userOptionName => $userOptionValue) { $userOptionName = strtolower($userOptionName); // set the ini based values if (array_key_exists($userOptionName, self::$_defaultOptions)) { @ini_set("session.$userOptionName", $userOptionValue); } elseif (isset(self::$_localOptions[$userOptionName])) { self::${self::$_localOptions[$userOptionName]} = $userOptionValue; } else { /** @see Zend_Session_Exception */ // require_once 'Zend/Session/Exception.php'; throw new Zend_Session_Exception("Unknown option: $userOptionName = $userOptionValue"); } } }
[ "public", "static", "function", "setOptions", "(", "array", "$", "userOptions", "=", "array", "(", ")", ")", "{", "// set default options on first run only (before applying user settings)", "if", "(", "!", "self", "::", "$", "_defaultOptionsSet", ")", "{", "foreach", ...
setOptions - set both the class specified @param array $userOptions - pass-by-keyword style array of <option name, option value> pairs @throws Zend_Session_Exception @return void
[ "setOptions", "-", "set", "both", "the", "class", "specified" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session.php#L199-L230
train
Set the session options
[ 30522, 2270, 10763, 3853, 2275, 7361, 9285, 1006, 9140, 1002, 5310, 7361, 9285, 1027, 9140, 1006, 1007, 1007, 1063, 1013, 1013, 2275, 12398, 7047, 2006, 2034, 2448, 2069, 1006, 2077, 11243, 5310, 10906, 1007, 2065, 1006, 999, 2969, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
SQLiteGrammar.compileUpdate
public function compileUpdate(Builder $query, $values) { $table = $this->wrapTable($query->from); $columns = collect($values)->map(function ($value, $key) use ($query) { return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value); })->implode(', '); if (isset($query->joins) || isset($query->limit)) { $selectSql = parent::compileSelect($query->select("{$query->from}.rowid")); return "update {$table} set $columns where {$this->wrap('rowid')} in ({$selectSql})"; } return trim("update {$table} set {$columns} {$this->compileWheres($query)}"); }
php
public function compileUpdate(Builder $query, $values) { $table = $this->wrapTable($query->from); $columns = collect($values)->map(function ($value, $key) use ($query) { return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value); })->implode(', '); if (isset($query->joins) || isset($query->limit)) { $selectSql = parent::compileSelect($query->select("{$query->from}.rowid")); return "update {$table} set $columns where {$this->wrap('rowid')} in ({$selectSql})"; } return trim("update {$table} set {$columns} {$this->compileWheres($query)}"); }
[ "public", "function", "compileUpdate", "(", "Builder", "$", "query", ",", "$", "values", ")", "{", "$", "table", "=", "$", "this", "->", "wrapTable", "(", "$", "query", "->", "from", ")", ";", "$", "columns", "=", "collect", "(", "$", "values", ")", ...
Compile an update statement into SQL. @param \Illuminate\Database\Query\Builder $query @param array $values @return string
[ "Compile", "an", "update", "statement", "into", "SQL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php#L188-L203
train
Compiles an update statement into SQL
[ 30522, 2270, 3853, 4012, 22090, 6279, 13701, 1006, 12508, 1002, 23032, 1010, 1002, 5300, 1007, 1063, 1002, 2795, 1027, 1002, 2023, 1011, 1028, 10236, 10880, 1006, 1002, 23032, 1011, 1028, 2013, 1007, 1025, 1002, 7753, 1027, 8145, 1006, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpCache/Store.php
Store.purge
public function purge($url) { $http = preg_replace('#^https:#', 'http:', $url); $https = preg_replace('#^http:#', 'https:', $url); $purgedHttp = $this->doPurge($http); $purgedHttps = $this->doPurge($https); return $purgedHttp || $purgedHttps; }
php
public function purge($url) { $http = preg_replace('#^https:#', 'http:', $url); $https = preg_replace('#^http:#', 'https:', $url); $purgedHttp = $this->doPurge($http); $purgedHttps = $this->doPurge($https); return $purgedHttp || $purgedHttps; }
[ "public", "function", "purge", "(", "$", "url", ")", "{", "$", "http", "=", "preg_replace", "(", "'#^https:#'", ",", "'http:'", ",", "$", "url", ")", ";", "$", "https", "=", "preg_replace", "(", "'#^http:#'", ",", "'https:'", ",", "$", "url", ")", ";...
Purges data for the given URL. This method purges both the HTTP and the HTTPS version of the cache entry. @param string $url A URL @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise
[ "Purges", "data", "for", "the", "given", "URL", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L309-L318
train
Purges the specified URL and returns true if the purge was successful.
[ 30522, 2270, 3853, 24694, 1006, 1002, 24471, 2140, 1007, 1063, 1002, 8299, 1027, 3653, 2290, 1035, 5672, 1006, 1005, 1001, 1034, 16770, 1024, 1001, 1005, 1010, 1005, 8299, 1024, 1005, 1010, 1002, 24471, 2140, 1007, 1025, 1002, 16770, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Common.php
Common.getRequestVar
public static function getRequestVar($varName, $varDefault = null, $varType = null, $requestArrayToUse = null) { if (is_null($requestArrayToUse)) { $requestArrayToUse = $_GET + $_POST; } $varDefault = self::sanitizeInputValues($varDefault); if ($varType === 'int') { // settype accepts only integer // 'int' is simply a shortcut for 'integer' $varType = 'integer'; } // there is no value $varName in the REQUEST so we try to use the default value if (empty($varName) || !isset($requestArrayToUse[$varName]) || (!is_array($requestArrayToUse[$varName]) && strlen($requestArrayToUse[$varName]) === 0 ) ) { if (is_null($varDefault)) { throw new Exception("The parameter '$varName' isn't set in the Request, and a default value wasn't provided."); } else { if (!is_null($varType) && in_array($varType, array('string', 'integer', 'array')) ) { settype($varDefault, $varType); } return $varDefault; } } // Normal case, there is a value available in REQUEST for the requested varName: // we deal w/ json differently if ($varType == 'json') { $value = $requestArrayToUse[$varName]; $value = json_decode($value, $assoc = true); return self::sanitizeInputValues($value, $alreadyStripslashed = true); } $value = self::sanitizeInputValues($requestArrayToUse[$varName]); if (isset($varType)) { $ok = false; if ($varType === 'string') { if (is_string($value) || is_int($value)) { $ok = true; } elseif (is_float($value)) { $value = Common::forceDotAsSeparatorForDecimalPoint($value); $ok = true; } } elseif ($varType === 'integer') { if ($value == (string)(int)$value) { $ok = true; } } elseif ($varType === 'float') { $valueToCompare = (string)(float)$value; $valueToCompare = Common::forceDotAsSeparatorForDecimalPoint($valueToCompare); if ($value == $valueToCompare) { $ok = true; } } elseif ($varType === 'array') { if (is_array($value)) { $ok = true; } } else { throw new Exception("\$varType specified is not known. It should be one of the following: array, int, integer, float, string"); } // The type is not correct if ($ok === false) { if ($varDefault === null) { throw new Exception("The parameter '$varName' doesn't have a correct type, and a default value wasn't provided."); } // we return the default value with the good type set else { settype($varDefault, $varType); return $varDefault; } } settype($value, $varType); } return $value; }
php
public static function getRequestVar($varName, $varDefault = null, $varType = null, $requestArrayToUse = null) { if (is_null($requestArrayToUse)) { $requestArrayToUse = $_GET + $_POST; } $varDefault = self::sanitizeInputValues($varDefault); if ($varType === 'int') { // settype accepts only integer // 'int' is simply a shortcut for 'integer' $varType = 'integer'; } // there is no value $varName in the REQUEST so we try to use the default value if (empty($varName) || !isset($requestArrayToUse[$varName]) || (!is_array($requestArrayToUse[$varName]) && strlen($requestArrayToUse[$varName]) === 0 ) ) { if (is_null($varDefault)) { throw new Exception("The parameter '$varName' isn't set in the Request, and a default value wasn't provided."); } else { if (!is_null($varType) && in_array($varType, array('string', 'integer', 'array')) ) { settype($varDefault, $varType); } return $varDefault; } } // Normal case, there is a value available in REQUEST for the requested varName: // we deal w/ json differently if ($varType == 'json') { $value = $requestArrayToUse[$varName]; $value = json_decode($value, $assoc = true); return self::sanitizeInputValues($value, $alreadyStripslashed = true); } $value = self::sanitizeInputValues($requestArrayToUse[$varName]); if (isset($varType)) { $ok = false; if ($varType === 'string') { if (is_string($value) || is_int($value)) { $ok = true; } elseif (is_float($value)) { $value = Common::forceDotAsSeparatorForDecimalPoint($value); $ok = true; } } elseif ($varType === 'integer') { if ($value == (string)(int)$value) { $ok = true; } } elseif ($varType === 'float') { $valueToCompare = (string)(float)$value; $valueToCompare = Common::forceDotAsSeparatorForDecimalPoint($valueToCompare); if ($value == $valueToCompare) { $ok = true; } } elseif ($varType === 'array') { if (is_array($value)) { $ok = true; } } else { throw new Exception("\$varType specified is not known. It should be one of the following: array, int, integer, float, string"); } // The type is not correct if ($ok === false) { if ($varDefault === null) { throw new Exception("The parameter '$varName' doesn't have a correct type, and a default value wasn't provided."); } // we return the default value with the good type set else { settype($varDefault, $varType); return $varDefault; } } settype($value, $varType); } return $value; }
[ "public", "static", "function", "getRequestVar", "(", "$", "varName", ",", "$", "varDefault", "=", "null", ",", "$", "varType", "=", "null", ",", "$", "requestArrayToUse", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "requestArrayToUse", ")", "...
Gets a sanitized request parameter by name from the `$_GET` and `$_POST` superglobals. Use this function to get request parameter values. **_NEVER use `$_GET` and `$_POST` directly._** If the variable cannot be found, and a default value was not provided, an exception is raised. _See {@link sanitizeInputValues()} to learn more about sanitization._ @param string $varName Name of the request parameter to get. By default, we look in `$_GET[$varName]` and `$_POST[$varName]` for the value. @param string|null $varDefault The value to return if the request parameter cannot be found or has an empty value. @param string|null $varType Expected type of the request variable. This parameters value must be one of the following: `'array'`, `'int'`, `'integer'`, `'string'`, `'json'`. If `'json'`, the string value will be `json_decode`-d and then sanitized. @param array|null $requestArrayToUse The array to use instead of `$_GET` and `$_POST`. @throws Exception If the request parameter doesn't exist and there is no default value, or if the request parameter exists but has an incorrect type. @return mixed The sanitized request parameter. @api
[ "Gets", "a", "sanitized", "request", "parameter", "by", "name", "from", "the", "$_GET", "and", "$_POST", "superglobals", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L467-L552
train
Returns the value of a parameter in the REQUEST
[ 30522, 2270, 10763, 3853, 2131, 2890, 15500, 10755, 1006, 1002, 13075, 18442, 1010, 1002, 13075, 3207, 7011, 11314, 1027, 19701, 1010, 1002, 13075, 13874, 1027, 19701, 1010, 1002, 5227, 2906, 9447, 24826, 3366, 1027, 19701, 1007, 1063, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Adapter/GD.php
GD.new_page
public function new_page() { $this->_page_number++; $this->_page_count++; $this->_img = imagecreatetruecolor($this->_actual_width, $this->_actual_height); $this->_bg_color = $this->_allocate_color($this->_bg_color_array); imagealphablending($this->_img, true); imagesavealpha($this->_img, true); imagefill($this->_img, 0, 0, $this->_bg_color); $this->_imgs[] = $this->_img; }
php
public function new_page() { $this->_page_number++; $this->_page_count++; $this->_img = imagecreatetruecolor($this->_actual_width, $this->_actual_height); $this->_bg_color = $this->_allocate_color($this->_bg_color_array); imagealphablending($this->_img, true); imagesavealpha($this->_img, true); imagefill($this->_img, 0, 0, $this->_bg_color); $this->_imgs[] = $this->_img; }
[ "public", "function", "new_page", "(", ")", "{", "$", "this", "->", "_page_number", "++", ";", "$", "this", "->", "_page_count", "++", ";", "$", "this", "->", "_img", "=", "imagecreatetruecolor", "(", "$", "this", "->", "_actual_width", ",", "$", "this",...
Starts a new page Subsequent drawing operations will appear on the new page.
[ "Starts", "a", "new", "page" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/GD.php#L946-L959
train
Create a new image for the current page
[ 30522, 2270, 3853, 2047, 1035, 3931, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 3931, 1035, 2193, 1009, 1009, 1025, 1002, 2023, 1011, 1028, 1035, 3931, 1035, 4175, 1009, 1009, 1025, 1002, 2023, 1011, 1028, 1035, 10047, 2290, 1027, 37...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Redis/Connections/PhpRedisConnection.php
PhpRedisConnection.brpop
public function brpop(...$arguments) { $result = $this->command('brpop', $arguments); return empty($result) ? null : $result; }
php
public function brpop(...$arguments) { $result = $this->command('brpop', $arguments); return empty($result) ? null : $result; }
[ "public", "function", "brpop", "(", "...", "$", "arguments", ")", "{", "$", "result", "=", "$", "this", "->", "command", "(", "'brpop'", ",", "$", "arguments", ")", ";", "return", "empty", "(", "$", "result", ")", "?", "null", ":", "$", "result", "...
Removes and returns the last element of the list stored at key. @param dynamic $arguments @return array|null
[ "Removes", "and", "returns", "the", "last", "element", "of", "the", "list", "stored", "at", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L178-L183
train
Remove and return the last entry from the list
[ 30522, 2270, 3853, 7987, 16340, 1006, 1012, 1012, 1012, 1002, 9918, 1007, 1063, 1002, 2765, 1027, 1002, 2023, 1011, 1028, 3094, 1006, 1005, 7987, 16340, 1005, 1010, 1002, 9918, 1007, 1025, 2709, 4064, 1006, 1002, 2765, 1007, 1029, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Descriptor.formatParameter
protected function formatParameter($value) { if (\is_bool($value) || \is_array($value) || (null === $value)) { $jsonString = json_encode($value); if (preg_match('/^(.{60})./us', $jsonString, $matches)) { return $matches[1].'...'; } return $jsonString; } return (string) $value; }
php
protected function formatParameter($value) { if (\is_bool($value) || \is_array($value) || (null === $value)) { $jsonString = json_encode($value); if (preg_match('/^(.{60})./us', $jsonString, $matches)) { return $matches[1].'...'; } return $jsonString; } return (string) $value; }
[ "protected", "function", "formatParameter", "(", "$", "value", ")", "{", "if", "(", "\\", "is_bool", "(", "$", "value", ")", "||", "\\", "is_array", "(", "$", "value", ")", "||", "(", "null", "===", "$", "value", ")", ")", "{", "$", "jsonString", "...
Formats a parameter. @param mixed $value @return string
[ "Formats", "a", "parameter", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php#L211-L224
train
Format parameter value
[ 30522, 5123, 3853, 4289, 28689, 22828, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 22017, 2140, 1006, 1002, 3643, 1007, 1064, 1064, 1032, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1064, 1064, 1006, 19701, 1027, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...