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
matomo-org/matomo
libs/Zend/Mime/Message.php
Zend_Mime_Message._disassembleMime
protected static function _disassembleMime($body, $boundary) { $start = 0; $res = array(); // find every mime part limiter and cut out the // string before it. // the part before the first boundary string is discarded: $p = strpos($body, '--'.$boundary."\n", $start); if ($p === false) { // no parts found! return array(); } // position after first boundary line $start = $p + 3 + strlen($boundary); while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) { $res[] = substr($body, $start, $p-$start); $start = $p + 3 + strlen($boundary); } // no more parts, find end boundary $p = strpos($body, '--' . $boundary . '--', $start); if ($p===false) { throw new Zend_Exception('Not a valid Mime Message: End Missing'); } // the remaining part also needs to be parsed: $res[] = substr($body, $start, $p-$start); return $res; }
php
protected static function _disassembleMime($body, $boundary) { $start = 0; $res = array(); // find every mime part limiter and cut out the // string before it. // the part before the first boundary string is discarded: $p = strpos($body, '--'.$boundary."\n", $start); if ($p === false) { // no parts found! return array(); } // position after first boundary line $start = $p + 3 + strlen($boundary); while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) { $res[] = substr($body, $start, $p-$start); $start = $p + 3 + strlen($boundary); } // no more parts, find end boundary $p = strpos($body, '--' . $boundary . '--', $start); if ($p===false) { throw new Zend_Exception('Not a valid Mime Message: End Missing'); } // the remaining part also needs to be parsed: $res[] = substr($body, $start, $p-$start); return $res; }
[ "protected", "static", "function", "_disassembleMime", "(", "$", "body", ",", "$", "boundary", ")", "{", "$", "start", "=", "0", ";", "$", "res", "=", "array", "(", ")", ";", "// find every mime part limiter and cut out the", "// string before it.", "// the part b...
Explode MIME multipart string into seperate parts Parts consist of the header and the body of each MIME part. @param string $body @param string $boundary @return array
[ "Explode", "MIME", "multipart", "string", "into", "seperate", "parts" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Message.php#L202-L232
train
Disassemble the MIME part of the message
[ 30522, 5123, 10763, 3853, 1035, 4487, 20939, 3366, 19661, 4328, 4168, 1006, 1002, 2303, 1010, 1002, 6192, 1007, 1063, 1002, 2707, 1027, 1014, 1025, 1002, 24501, 1027, 9140, 1006, 1007, 1025, 1013, 1013, 2424, 2296, 2771, 4168, 2112, 5787, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
opencart/opencart
upload/admin/controller/event/statistics.php
ControllerEventStatistics.deleteReview
public function deleteReview(&$route, &$args, &$output) { $this->load->model('report/statistics'); $this->model_report_statistics->removeValue('review', 1); }
php
public function deleteReview(&$route, &$args, &$output) { $this->load->model('report/statistics'); $this->model_report_statistics->removeValue('review', 1); }
[ "public", "function", "deleteReview", "(", "&", "$", "route", ",", "&", "$", "args", ",", "&", "$", "output", ")", "{", "$", "this", "->", "load", "->", "model", "(", "'report/statistics'", ")", ";", "$", "this", "->", "model_report_statistics", "->", ...
admin/model/catalog/review/deleteReview/after
[ "admin", "/", "model", "/", "catalog", "/", "review", "/", "deleteReview", "/", "after" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/admin/controller/event/statistics.php#L11-L15
train
Delete a review
[ 30522, 2270, 3853, 3972, 15141, 6777, 2666, 2860, 1006, 1004, 1002, 2799, 1010, 1004, 1002, 12098, 5620, 1010, 1004, 1002, 6434, 1007, 1063, 1002, 2023, 1011, 1028, 7170, 1011, 1028, 2944, 1006, 1005, 3189, 1013, 6747, 1005, 1007, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/ScheduledReports/API.php
API.getReports
public function getReports($idSite = false, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = false, $idSegment = false) { Piwik::checkUserHasSomeViewAccess(); $cacheKey = (int)$idSite . '.' . (string)$period . '.' . (int)$idReport . '.' . (int)$ifSuperUserReturnOnlySuperUserReports; if (isset(self::$cache[$cacheKey])) { return self::$cache[$cacheKey]; } $sqlWhere = ''; $bind = array(); // Super user gets all reports back, other users only their own if (!Piwik::hasUserSuperUserAccess() || $ifSuperUserReturnOnlySuperUserReports ) { $sqlWhere .= "AND login = ?"; $bind[] = Piwik::getCurrentUserLogin(); } if (!empty($period)) { $this->validateReportPeriod($period); $sqlWhere .= " AND period = ? "; $bind[] = $period; } if (!empty($idSite)) { Piwik::checkUserHasViewAccess($idSite); $sqlWhere .= " AND " . Common::prefixTable('site') . ".idsite = ?"; $bind[] = $idSite; } if (!empty($idReport)) { $sqlWhere .= " AND idreport = ?"; $bind[] = $idReport; } if (!empty($idSegment)) { $sqlWhere .= " AND idsegment = ?"; $bind[] = $idSegment; } // Joining with the site table to work around pre-1.3 where reports could still be linked to a deleted site $reports = Db::fetchAll("SELECT report.* FROM " . Common::prefixTable('report') . " AS `report` JOIN " . Common::prefixTable('site') . " USING (idsite) WHERE deleted = 0 $sqlWhere", $bind); // When a specific report was requested and not found, throw an error if ($idReport !== false && empty($reports) ) { throw new Exception("Requested report couldn't be found."); } foreach ($reports as &$report) { // decode report parameters $report['parameters'] = json_decode($report['parameters'], true); // decode report list $report['reports'] = json_decode($report['reports'], true); if (!empty($report['parameters']['additionalEmails']) && is_array($report['parameters']['additionalEmails'])) { $report['parameters']['additionalEmails'] = array_values($report['parameters']['additionalEmails']); } if (empty($report['evolution_graph_period_n'])) { $report['evolution_graph_period_n'] = ImageGraph::getDefaultGraphEvolutionLastPeriods(); } } // static cache self::$cache[$cacheKey] = $reports; return $reports; }
php
public function getReports($idSite = false, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = false, $idSegment = false) { Piwik::checkUserHasSomeViewAccess(); $cacheKey = (int)$idSite . '.' . (string)$period . '.' . (int)$idReport . '.' . (int)$ifSuperUserReturnOnlySuperUserReports; if (isset(self::$cache[$cacheKey])) { return self::$cache[$cacheKey]; } $sqlWhere = ''; $bind = array(); // Super user gets all reports back, other users only their own if (!Piwik::hasUserSuperUserAccess() || $ifSuperUserReturnOnlySuperUserReports ) { $sqlWhere .= "AND login = ?"; $bind[] = Piwik::getCurrentUserLogin(); } if (!empty($period)) { $this->validateReportPeriod($period); $sqlWhere .= " AND period = ? "; $bind[] = $period; } if (!empty($idSite)) { Piwik::checkUserHasViewAccess($idSite); $sqlWhere .= " AND " . Common::prefixTable('site') . ".idsite = ?"; $bind[] = $idSite; } if (!empty($idReport)) { $sqlWhere .= " AND idreport = ?"; $bind[] = $idReport; } if (!empty($idSegment)) { $sqlWhere .= " AND idsegment = ?"; $bind[] = $idSegment; } // Joining with the site table to work around pre-1.3 where reports could still be linked to a deleted site $reports = Db::fetchAll("SELECT report.* FROM " . Common::prefixTable('report') . " AS `report` JOIN " . Common::prefixTable('site') . " USING (idsite) WHERE deleted = 0 $sqlWhere", $bind); // When a specific report was requested and not found, throw an error if ($idReport !== false && empty($reports) ) { throw new Exception("Requested report couldn't be found."); } foreach ($reports as &$report) { // decode report parameters $report['parameters'] = json_decode($report['parameters'], true); // decode report list $report['reports'] = json_decode($report['reports'], true); if (!empty($report['parameters']['additionalEmails']) && is_array($report['parameters']['additionalEmails'])) { $report['parameters']['additionalEmails'] = array_values($report['parameters']['additionalEmails']); } if (empty($report['evolution_graph_period_n'])) { $report['evolution_graph_period_n'] = ImageGraph::getDefaultGraphEvolutionLastPeriods(); } } // static cache self::$cache[$cacheKey] = $reports; return $reports; }
[ "public", "function", "getReports", "(", "$", "idSite", "=", "false", ",", "$", "period", "=", "false", ",", "$", "idReport", "=", "false", ",", "$", "ifSuperUserReturnOnlySuperUserReports", "=", "false", ",", "$", "idSegment", "=", "false", ")", "{", "Piw...
Returns the list of reports matching the passed parameters @param bool|int $idSite If specified, will filter reports that belong to a specific idsite @param bool|string $period If specified, will filter reports that are scheduled for this period (day,week,month) @param bool|int $idReport If specified, will filter the report that has the given idReport @param bool $ifSuperUserReturnOnlySuperUserReports @param bool|int $idSegment If specified, will filter the report that has the given idSegment @throws Exception @return array
[ "Returns", "the", "list", "of", "reports", "matching", "the", "passed", "parameters" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ScheduledReports/API.php#L220-L293
train
Get all reports from the database
[ 30522, 2270, 3853, 2131, 2890, 25378, 1006, 1002, 8909, 28032, 2063, 1027, 6270, 1010, 1002, 2558, 1027, 6270, 1010, 1002, 8909, 2890, 6442, 1027, 6270, 1010, 1002, 2065, 6342, 4842, 20330, 13465, 14287, 2239, 2135, 6342, 4842, 20330, 2890,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/DaoAuthenticationProvider.php
DaoAuthenticationProvider.checkAuthentication
protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token) { $currentUser = $token->getUser(); if ($currentUser instanceof UserInterface) { if ($currentUser->getPassword() !== $user->getPassword()) { throw new BadCredentialsException('The credentials were changed from another session.'); } } else { if ('' === ($presentedPassword = $token->getCredentials())) { throw new BadCredentialsException('The presented password cannot be empty.'); } if (!$this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $presentedPassword, $user->getSalt())) { throw new BadCredentialsException('The presented password is invalid.'); } } }
php
protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token) { $currentUser = $token->getUser(); if ($currentUser instanceof UserInterface) { if ($currentUser->getPassword() !== $user->getPassword()) { throw new BadCredentialsException('The credentials were changed from another session.'); } } else { if ('' === ($presentedPassword = $token->getCredentials())) { throw new BadCredentialsException('The presented password cannot be empty.'); } if (!$this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $presentedPassword, $user->getSalt())) { throw new BadCredentialsException('The presented password is invalid.'); } } }
[ "protected", "function", "checkAuthentication", "(", "UserInterface", "$", "user", ",", "UsernamePasswordToken", "$", "token", ")", "{", "$", "currentUser", "=", "$", "token", "->", "getUser", "(", ")", ";", "if", "(", "$", "currentUser", "instanceof", "UserIn...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Provider/DaoAuthenticationProvider.php#L45-L61
train
Check if the user is authenticated
[ 30522, 5123, 3853, 4638, 4887, 10760, 16778, 10719, 1006, 5310, 18447, 2121, 12172, 1002, 5310, 1010, 5310, 18442, 15194, 18351, 18715, 2368, 1002, 19204, 1007, 1063, 1002, 2783, 20330, 1027, 1002, 19204, 1011, 1028, 2131, 20330, 1006, 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/Piwik.php
Piwik.getUnnamespacedClassName
public static function getUnnamespacedClassName($object) { $className = is_string($object) ? $object : get_class($object); $parts = explode('\\', $className); return end($parts); }
php
public static function getUnnamespacedClassName($object) { $className = is_string($object) ? $object : get_class($object); $parts = explode('\\', $className); return end($parts); }
[ "public", "static", "function", "getUnnamespacedClassName", "(", "$", "object", ")", "{", "$", "className", "=", "is_string", "(", "$", "object", ")", "?", "$", "object", ":", "get_class", "(", "$", "object", ")", ";", "$", "parts", "=", "explode", "(", ...
Returns the class name of an object without its namespace. @param mixed|string $object @return string
[ "Returns", "the", "class", "name", "of", "an", "object", "without", "its", "namespace", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L760-L765
train
Get the unnamespaced class name of an object
[ 30522, 2270, 10763, 3853, 2131, 4609, 18442, 23058, 16409, 27102, 18442, 1006, 1002, 4874, 1007, 1063, 1002, 2465, 18442, 1027, 2003, 1035, 5164, 1006, 1002, 4874, 1007, 1029, 1002, 4874, 1024, 2131, 1035, 2465, 1006, 1002, 4874, 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...
octobercms/october
modules/cms/classes/PartialStack.php
PartialStack.findComponentFromStack
protected function findComponentFromStack($name, $stack) { foreach ($stack['components'] as $componentInfo) { if ($componentInfo['name'] == $name) { return $componentInfo['obj']; } } return null; }
php
protected function findComponentFromStack($name, $stack) { foreach ($stack['components'] as $componentInfo) { if ($componentInfo['name'] == $name) { return $componentInfo['obj']; } } return null; }
[ "protected", "function", "findComponentFromStack", "(", "$", "name", ",", "$", "stack", ")", "{", "foreach", "(", "$", "stack", "[", "'components'", "]", "as", "$", "componentInfo", ")", "{", "if", "(", "$", "componentInfo", "[", "'name'", "]", "==", "$"...
Locates a component by its alias from the supplied stack.
[ "Locates", "a", "component", "by", "its", "alias", "from", "the", "supplied", "stack", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/PartialStack.php#L83-L92
train
Find a component from the stack
[ 30522, 5123, 3853, 2424, 9006, 29513, 3372, 19699, 22225, 2696, 3600, 1006, 1002, 2171, 1010, 1002, 9991, 1007, 1063, 18921, 6776, 1006, 1002, 9991, 1031, 1005, 6177, 1005, 1033, 2004, 1002, 6922, 2378, 14876, 1007, 1063, 2065, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.isOverlapping
public function isOverlapping() { return $this->lockFile && file_exists($this->lockFile) && call_user_func($this->whenOverlapping, filemtime($this->lockFile)) === false; }
php
public function isOverlapping() { return $this->lockFile && file_exists($this->lockFile) && call_user_func($this->whenOverlapping, filemtime($this->lockFile)) === false; }
[ "public", "function", "isOverlapping", "(", ")", "{", "return", "$", "this", "->", "lockFile", "&&", "file_exists", "(", "$", "this", "->", "lockFile", ")", "&&", "call_user_func", "(", "$", "this", "->", "whenOverlapping", ",", "filemtime", "(", "$", "thi...
Check if the Job is overlapping. @return bool
[ "Check", "if", "the", "Job", "is", "overlapping", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L168-L173
train
Check if the file is overlapping
[ 30522, 2270, 3853, 11163, 6299, 2721, 14853, 1006, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5843, 8873, 2571, 1004, 1004, 5371, 1035, 6526, 1006, 1002, 2023, 1011, 1028, 5843, 8873, 2571, 1007, 1004, 1004, 2655, 1035, 5310, 1035, 4569, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter/Group.php
Group.initialize
protected function initialize() { $this->id = $this->formatId($this->column); $this->group = new Collection(); $this->name = "{$this->id}-filter-group"; $this->setupDefaultPresenter(); }
php
protected function initialize() { $this->id = $this->formatId($this->column); $this->group = new Collection(); $this->name = "{$this->id}-filter-group"; $this->setupDefaultPresenter(); }
[ "protected", "function", "initialize", "(", ")", "{", "$", "this", "->", "id", "=", "$", "this", "->", "formatId", "(", "$", "this", "->", "column", ")", ";", "$", "this", "->", "group", "=", "new", "Collection", "(", ")", ";", "$", "this", "->", ...
Initialize a group filter.
[ "Initialize", "a", "group", "filter", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Group.php#L53-L60
train
Initialize the filter
[ 30522, 5123, 3853, 3988, 4697, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 8909, 1027, 1002, 2023, 1011, 1028, 4289, 3593, 1006, 1002, 2023, 1011, 1028, 5930, 1007, 1025, 1002, 2023, 1011, 1028, 2177, 1027, 2047, 3074, 1006, 1007, 1025, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Column.php
Column.bindOriginalRowModel
protected function bindOriginalRowModel(Closure $callback, $key) { $rowModel = static::$originalGridModels[$key]; return $callback->bindTo($rowModel); }
php
protected function bindOriginalRowModel(Closure $callback, $key) { $rowModel = static::$originalGridModels[$key]; return $callback->bindTo($rowModel); }
[ "protected", "function", "bindOriginalRowModel", "(", "Closure", "$", "callback", ",", "$", "key", ")", "{", "$", "rowModel", "=", "static", "::", "$", "originalGridModels", "[", "$", "key", "]", ";", "return", "$", "callback", "->", "bindTo", "(", "$", ...
Set original grid data to column. @param Closure $callback @param int $key @return Closure
[ "Set", "original", "grid", "data", "to", "column", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L453-L458
train
Bind original row model to the callback
[ 30522, 5123, 3853, 14187, 10050, 24965, 10524, 5302, 9247, 1006, 8503, 1002, 2655, 5963, 1010, 1002, 3145, 1007, 1063, 1002, 5216, 5302, 9247, 1027, 10763, 1024, 1024, 1002, 2434, 16523, 3593, 5302, 9247, 2015, 1031, 1002, 3145, 1033, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/User/FlexUser/UserCollection.php
UserCollection.load
public function load($username): UserInterface { if ($username !== '') { $key = mb_strtolower($username); $user = $this->get($key); if ($user) { return $user; } } else { $key = ''; } $directory = $this->getFlexDirectory(); /** @var User $object */ $object = $directory->createObject( [ 'username' => $username, 'state' => 'enabled' ], $key ); return $object; }
php
public function load($username): UserInterface { if ($username !== '') { $key = mb_strtolower($username); $user = $this->get($key); if ($user) { return $user; } } else { $key = ''; } $directory = $this->getFlexDirectory(); /** @var User $object */ $object = $directory->createObject( [ 'username' => $username, 'state' => 'enabled' ], $key ); return $object; }
[ "public", "function", "load", "(", "$", "username", ")", ":", "UserInterface", "{", "if", "(", "$", "username", "!==", "''", ")", "{", "$", "key", "=", "mb_strtolower", "(", "$", "username", ")", ";", "$", "user", "=", "$", "this", "->", "get", "("...
Load user account. Always creates user object. To check if user exists, use $this->exists(). @param string $username @return User
[ "Load", "user", "account", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/UserCollection.php#L27-L51
train
Load user by username
[ 30522, 2270, 3853, 7170, 1006, 1002, 5310, 18442, 1007, 1024, 5310, 18447, 2121, 12172, 1063, 2065, 1006, 1002, 5310, 18442, 999, 1027, 1027, 1005, 1005, 1007, 1063, 1002, 3145, 1027, 16914, 1035, 2358, 5339, 12898, 13777, 1006, 1002, 5310,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/GeoIp2/GeoIP2AutoUpdater.php
GeoIP2AutoUpdater.update
public function update() { try { Option::set(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp()); $locUrl = Option::get(self::LOC_URL_OPTION_NAME); if (!empty($locUrl)) { $this->downloadFile('loc', $locUrl); } $ispUrl = Option::get(self::ISP_URL_OPTION_NAME); if (!empty($ispUrl)) { $this->downloadFile('isp', $ispUrl); } } catch (Exception $ex) { // message will already be prefixed w/ 'GeoIP2AutoUpdater: ' Log::error($ex); $this->performRedundantDbChecks(); throw $ex; } $this->performRedundantDbChecks(); }
php
public function update() { try { Option::set(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp()); $locUrl = Option::get(self::LOC_URL_OPTION_NAME); if (!empty($locUrl)) { $this->downloadFile('loc', $locUrl); } $ispUrl = Option::get(self::ISP_URL_OPTION_NAME); if (!empty($ispUrl)) { $this->downloadFile('isp', $ispUrl); } } catch (Exception $ex) { // message will already be prefixed w/ 'GeoIP2AutoUpdater: ' Log::error($ex); $this->performRedundantDbChecks(); throw $ex; } $this->performRedundantDbChecks(); }
[ "public", "function", "update", "(", ")", "{", "try", "{", "Option", "::", "set", "(", "self", "::", "LAST_RUN_TIME_OPTION_NAME", ",", "Date", "::", "factory", "(", "'today'", ")", "->", "getTimestamp", "(", ")", ")", ";", "$", "locUrl", "=", "Option", ...
Attempts to download new location & ISP GeoIP databases and replace the existing ones w/ them.
[ "Attempts", "to", "download", "new", "location", "&", "ISP", "GeoIP", "databases", "and", "replace", "the", "existing", "ones", "w", "/", "them", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/GeoIP2AutoUpdater.php#L87-L109
train
Update the database
[ 30522, 2270, 3853, 10651, 1006, 1007, 1063, 3046, 1063, 5724, 1024, 1024, 2275, 1006, 2969, 1024, 1024, 2197, 1035, 2448, 1035, 2051, 1035, 5724, 1035, 2171, 1010, 3058, 1024, 1024, 4713, 1006, 1005, 2651, 1005, 1007, 1011, 1028, 2131, 72...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/CombineAssets.php
CombineAssets.getTargetPath
protected function getTargetPath($path = null) { if ($path === null) { $baseUri = substr(Request::getBaseUrl(), strlen(Request::getBasePath())); $path = $baseUri.'/combine'; } if (strpos($path, '/') === 0) { $path = substr($path, 1); } $path = str_replace('.', '-', $path).'/'; return $path; }
php
protected function getTargetPath($path = null) { if ($path === null) { $baseUri = substr(Request::getBaseUrl(), strlen(Request::getBasePath())); $path = $baseUri.'/combine'; } if (strpos($path, '/') === 0) { $path = substr($path, 1); } $path = str_replace('.', '-', $path).'/'; return $path; }
[ "protected", "function", "getTargetPath", "(", "$", "path", "=", "null", ")", "{", "if", "(", "$", "path", "===", "null", ")", "{", "$", "baseUri", "=", "substr", "(", "Request", "::", "getBaseUrl", "(", ")", ",", "strlen", "(", "Request", "::", "get...
Returns the target path for use with the combiner. The target path helps generate relative links within CSS. /combine returns combine/ /index.php/combine returns index-php/combine/ @param string|null $path @return string The new target path
[ "Returns", "the", "target", "path", "for", "use", "with", "the", "combiner", ".", "The", "target", "path", "helps", "generate", "relative", "links", "within", "CSS", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L517-L530
train
Get Target Path
[ 30522, 5123, 3853, 2131, 7559, 18150, 15069, 1006, 1002, 4130, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 4130, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2918, 9496, 1027, 4942, 3367, 2099, 1006, 5227, 1024, 1024, 2131, 15058, 3126, 30524,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Constraints/DateTimeValidator.php
DateTimeValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof DateTime) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\DateTime'); } if (null === $value || '' === $value) { return; } if ($value instanceof \DateTimeInterface) { @trigger_error(sprintf('Validating a \\DateTimeInterface with "%s" is deprecated since version 4.2. Use "%s" instead or remove the constraint if the underlying model is already type hinted to \\DateTimeInterface.', DateTime::class, Type::class), E_USER_DEPRECATED); return; } if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $value = (string) $value; \DateTime::createFromFormat($constraint->format, $value); $errors = \DateTime::getLastErrors(); if (0 < $errors['error_count']) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_FORMAT_ERROR) ->addViolation(); return; } foreach ($errors['warnings'] as $warning) { if ('The parsed date was invalid' === $warning) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_DATE_ERROR) ->addViolation(); } elseif ('The parsed time was invalid' === $warning) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_TIME_ERROR) ->addViolation(); } else { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_FORMAT_ERROR) ->addViolation(); } } }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof DateTime) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\DateTime'); } if (null === $value || '' === $value) { return; } if ($value instanceof \DateTimeInterface) { @trigger_error(sprintf('Validating a \\DateTimeInterface with "%s" is deprecated since version 4.2. Use "%s" instead or remove the constraint if the underlying model is already type hinted to \\DateTimeInterface.', DateTime::class, Type::class), E_USER_DEPRECATED); return; } if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $value = (string) $value; \DateTime::createFromFormat($constraint->format, $value); $errors = \DateTime::getLastErrors(); if (0 < $errors['error_count']) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_FORMAT_ERROR) ->addViolation(); return; } foreach ($errors['warnings'] as $warning) { if ('The parsed date was invalid' === $warning) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_DATE_ERROR) ->addViolation(); } elseif ('The parsed time was invalid' === $warning) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_TIME_ERROR) ->addViolation(); } else { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(DateTime::INVALID_FORMAT_ERROR) ->addViolation(); } } }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "DateTime", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESPACE__",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php#L27-L80
train
Validates a DateTime value with the current locale
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 3058, 7292, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 1006, 1002, 27142, 1010, 1035, 1035, 3415, 1532...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/PropertyAccess/PropertyPath.php
PropertyPath.getElement
public function getElement($index) { if (!isset($this->elements[$index])) { throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index)); } return $this->elements[$index]; }
php
public function getElement($index) { if (!isset($this->elements[$index])) { throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index)); } return $this->elements[$index]; }
[ "public", "function", "getElement", "(", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "elements", "[", "$", "index", "]", ")", ")", "{", "throw", "new", "OutOfBoundsException", "(", "sprintf", "(", "'The index %s is not within t...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyPath.php#L173-L180
train
Returns the element at the given index
[ 30522, 2270, 3853, 2131, 12260, 3672, 1006, 1002, 5950, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3787, 1031, 1002, 5950, 1033, 1007, 1007, 1063, 5466, 2047, 2041, 11253, 15494, 3366, 2595, 24422, 1006, 9043, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Helper/Optimizer/ConjugateGradient.php
ConjugateGradient.getNewTheta
protected function getNewTheta(float $alpha, array $d): array { return MP::add($this->theta, MP::muls($d, $alpha)); }
php
protected function getNewTheta(float $alpha, array $d): array { return MP::add($this->theta, MP::muls($d, $alpha)); }
[ "protected", "function", "getNewTheta", "(", "float", "$", "alpha", ",", "array", "$", "d", ")", ":", "array", "{", "return", "MP", "::", "add", "(", "$", "this", "->", "theta", ",", "MP", "::", "muls", "(", "$", "d", ",", "$", "alpha", ")", ")",...
Calculates new set of solutions with given alpha (for each θ(k)) and gradient direction. θ(k+1) = θ(k) + α.d
[ "Calculates", "new", "set", "of", "solutions", "with", "given", "alpha", "(", "for", "each", "θ", "(", "k", "))", "and", "gradient", "direction", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Helper/Optimizer/ConjugateGradient.php#L164-L167
train
Returns new theta
[ 30522, 5123, 3853, 2131, 2638, 26677, 27065, 2050, 1006, 14257, 1002, 6541, 1010, 9140, 1002, 1040, 1007, 1024, 9140, 1063, 2709, 6131, 1024, 1024, 5587, 1006, 1002, 2023, 1011, 1028, 23963, 1010, 6131, 1024, 1024, 14163, 4877, 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...
matomo-org/matomo
core/Common.php
Common.extractLanguageAndRegionCodeFromBrowserLanguage
public static function extractLanguageAndRegionCodeFromBrowserLanguage($browserLanguage, $validLanguages = array()) { $validLanguages = self::checkValidLanguagesIsSet($validLanguages); if (!preg_match_all('/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/', $browserLanguage, $matches, PREG_SET_ORDER)) { return self::LANGUAGE_CODE_INVALID; } foreach ($matches as $parts) { $langIso639 = $parts[1]; if (empty($langIso639)) { continue; } // If a region tag is found eg. "fr-ca" if (count($parts) == 3) { $regionIso3166 = $parts[2]; // eg. "-ca" if (in_array($langIso639 . $regionIso3166, $validLanguages)) { return $langIso639 . $regionIso3166; } if (in_array($langIso639, $validLanguages)) { return $langIso639 . $regionIso3166; } } // eg. "fr" or "es" if (in_array($langIso639, $validLanguages)) { return $langIso639; } } return self::LANGUAGE_CODE_INVALID; }
php
public static function extractLanguageAndRegionCodeFromBrowserLanguage($browserLanguage, $validLanguages = array()) { $validLanguages = self::checkValidLanguagesIsSet($validLanguages); if (!preg_match_all('/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/', $browserLanguage, $matches, PREG_SET_ORDER)) { return self::LANGUAGE_CODE_INVALID; } foreach ($matches as $parts) { $langIso639 = $parts[1]; if (empty($langIso639)) { continue; } // If a region tag is found eg. "fr-ca" if (count($parts) == 3) { $regionIso3166 = $parts[2]; // eg. "-ca" if (in_array($langIso639 . $regionIso3166, $validLanguages)) { return $langIso639 . $regionIso3166; } if (in_array($langIso639, $validLanguages)) { return $langIso639 . $regionIso3166; } } // eg. "fr" or "es" if (in_array($langIso639, $validLanguages)) { return $langIso639; } } return self::LANGUAGE_CODE_INVALID; }
[ "public", "static", "function", "extractLanguageAndRegionCodeFromBrowserLanguage", "(", "$", "browserLanguage", ",", "$", "validLanguages", "=", "array", "(", ")", ")", "{", "$", "validLanguages", "=", "self", "::", "checkValidLanguagesIsSet", "(", "$", "validLanguage...
Returns the language and region string, based only on the Browser 'accepted language' information. * The language tag is defined by ISO 639-1 * The region tag is defined by ISO 3166-1 @param string $browserLanguage Browser's accepted langauge header @param array $validLanguages array of valid language codes. Note that if the array includes "fr" then it will consider all regional variants of this language valid, such as "fr-ca" etc. @return string 2 letter ISO 639 code 'es' (Spanish) or if found, includes the region as well: 'es-ar'
[ "Returns", "the", "language", "and", "region", "string", "based", "only", "on", "the", "Browser", "accepted", "language", "information", ".", "*", "The", "language", "tag", "is", "defined", "by", "ISO", "639", "-", "1", "*", "The", "region", "tag", "is", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L1033-L1064
train
Extract language and region code from browser language
[ 30522, 2270, 10763, 3853, 14817, 25023, 6692, 3351, 5685, 23784, 16044, 19699, 5358, 12618, 9333, 2121, 25023, 6692, 3351, 1006, 1002, 16602, 25023, 6692, 3351, 1010, 1002, 9398, 25023, 6692, 8449, 1027, 9140, 1006, 1007, 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
plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php
MultiRowEvolution.renderPopover
public function renderPopover($controller, $view) { // add data for metric select box $view->availableMetrics = $this->metricsForSelect; $view->selectedMetric = $this->metric; $view->availableRecordsText = $this->dimension . ': ' . Piwik::translate('RowEvolution_ComparingRecords', array(count($this->availableMetrics))); return parent::renderPopover($controller, $view); }
php
public function renderPopover($controller, $view) { // add data for metric select box $view->availableMetrics = $this->metricsForSelect; $view->selectedMetric = $this->metric; $view->availableRecordsText = $this->dimension . ': ' . Piwik::translate('RowEvolution_ComparingRecords', array(count($this->availableMetrics))); return parent::renderPopover($controller, $view); }
[ "public", "function", "renderPopover", "(", "$", "controller", ",", "$", "view", ")", "{", "// add data for metric select box", "$", "view", "->", "availableMetrics", "=", "$", "this", "->", "metricsForSelect", ";", "$", "view", "->", "selectedMetric", "=", "$",...
Render the popover @param \Piwik\Plugins\CoreHome\Controller $controller @param View (the popover_rowevolution template)
[ "Render", "the", "popover" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php#L60-L70
train
This method is called by the parent class to render the popover.
[ 30522, 2270, 3853, 17552, 16340, 7840, 1006, 1002, 11486, 1010, 1002, 3193, 1007, 1063, 1013, 1013, 5587, 2951, 2005, 12046, 7276, 3482, 1002, 3193, 1011, 1028, 2800, 12589, 2015, 1027, 1002, 2023, 1011, 1028, 12046, 22747, 5668, 12260, 659...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/Common2.php
HTML_Common2.parseAttributes
protected static function parseAttributes($attrString) { $attributes = array(); if (preg_match_all( "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" . "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/", $attrString, $regs )) { for ($i = 0; $i < count($regs[1]); $i++) { $name = trim($regs[1][$i]); $check = trim($regs[0][$i]); $value = trim($regs[7][$i]); if ($name == $check) { $attributes[strtolower($name)] = strtolower($name); } else { if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) { $value = substr($value, 1, -1); } $attributes[strtolower($name)] = $value; } } } return $attributes; }
php
protected static function parseAttributes($attrString) { $attributes = array(); if (preg_match_all( "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" . "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/", $attrString, $regs )) { for ($i = 0; $i < count($regs[1]); $i++) { $name = trim($regs[1][$i]); $check = trim($regs[0][$i]); $value = trim($regs[7][$i]); if ($name == $check) { $attributes[strtolower($name)] = strtolower($name); } else { if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) { $value = substr($value, 1, -1); } $attributes[strtolower($name)] = $value; } } } return $attributes; }
[ "protected", "static", "function", "parseAttributes", "(", "$", "attrString", ")", "{", "$", "attributes", "=", "array", "(", ")", ";", "if", "(", "preg_match_all", "(", "\"/(([A-Za-z_:]|[^\\\\x00-\\\\x7F])([A-Za-z0-9_:.-]|[^\\\\x00-\\\\x7F])*)\"", ".", "\"([ \\\\n\\\\t\\...
Parses the HTML attributes given as string @param string HTML attribute string @return array An associative aray of attributes
[ "Parses", "the", "HTML", "attributes", "given", "as", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L145-L169
train
Parse attributes from string
[ 30522, 5123, 10763, 3853, 11968, 17310, 4779, 3089, 8569, 4570, 1006, 1002, 2012, 16344, 3367, 4892, 1007, 1063, 1002, 12332, 1027, 9140, 1006, 1007, 1025, 2065, 1006, 3653, 2290, 1035, 2674, 1035, 2035, 1006, 1000, 1013, 1006, 1006, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/View/Factory.php
Factory.viewInstance
protected function viewInstance($view, $path, $data) { return new View($this, $this->getEngineFromPath($path), $view, $path, $data); }
php
protected function viewInstance($view, $path, $data) { return new View($this, $this->getEngineFromPath($path), $view, $path, $data); }
[ "protected", "function", "viewInstance", "(", "$", "view", ",", "$", "path", ",", "$", "data", ")", "{", "return", "new", "View", "(", "$", "this", ",", "$", "this", "->", "getEngineFromPath", "(", "$", "path", ")", ",", "$", "view", ",", "$", "pat...
Create a new view instance from the given arguments. @param string $view @param string $path @param \Illuminate\Contracts\Support\Arrayable|array $data @return \Illuminate\Contracts\View\View
[ "Create", "a", "new", "view", "instance", "from", "the", "given", "arguments", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Factory.php#L250-L253
train
Create a view instance from a view name and a view path
[ 30522, 5123, 3853, 3193, 7076, 26897, 1006, 1002, 3193, 1010, 1002, 4130, 1010, 1002, 2951, 1007, 1063, 2709, 2047, 3193, 1006, 1002, 2023, 1010, 1002, 2023, 1011, 1028, 2131, 13159, 3170, 19699, 25377, 8988, 1006, 1002, 4130, 1007, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Http/AccessMap.php
AccessMap.getPatterns
public function getPatterns(Request $request) { foreach ($this->map as $elements) { if (null === $elements[0] || $elements[0]->matches($request)) { return [$elements[1], $elements[2]]; } } return [null, null]; }
php
public function getPatterns(Request $request) { foreach ($this->map as $elements) { if (null === $elements[0] || $elements[0]->matches($request)) { return [$elements[1], $elements[2]]; } } return [null, null]; }
[ "public", "function", "getPatterns", "(", "Request", "$", "request", ")", "{", "foreach", "(", "$", "this", "->", "map", "as", "$", "elements", ")", "{", "if", "(", "null", "===", "$", "elements", "[", "0", "]", "||", "$", "elements", "[", "0", "]"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/AccessMap.php#L40-L49
train
Get the patterns that match the request
[ 30522, 2270, 3853, 2131, 4502, 12079, 3619, 1006, 5227, 1002, 5227, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 4949, 2004, 1002, 3787, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3787, 1031, 1014, 1033, 1064, 1064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php
AbstractAdapterTrait.getItems
public function getItems(array $keys = []) { if ($this->deferred) { $this->commit(); } $ids = []; foreach ($keys as $key) { $ids[] = $this->getId($key); } try { $items = $this->doFetch($ids); } catch (\Exception $e) { CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]); $items = []; } $ids = array_combine($ids, $keys); return $this->generateItems($items, $ids); }
php
public function getItems(array $keys = []) { if ($this->deferred) { $this->commit(); } $ids = []; foreach ($keys as $key) { $ids[] = $this->getId($key); } try { $items = $this->doFetch($ids); } catch (\Exception $e) { CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]); $items = []; } $ids = array_combine($ids, $keys); return $this->generateItems($items, $ids); }
[ "public", "function", "getItems", "(", "array", "$", "keys", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "deferred", ")", "{", "$", "this", "->", "commit", "(", ")", ";", "}", "$", "ids", "=", "[", "]", ";", "foreach", "(", "$", "k...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php#L64-L83
train
Get items from cache
[ 30522, 2270, 3853, 2131, 4221, 5244, 1006, 9140, 1002, 6309, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 13366, 28849, 2094, 1007, 1063, 1002, 2023, 1011, 1028, 10797, 1006, 1007, 1025, 1065, 1002, 8909, 2015, 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
libs/Zend/Validate/Ip.php
Zend_Validate_Ip._validateIPv4
protected function _validateIPv4($value) { $ip2long = ip2long($value); if($ip2long === false) { return false; } return $value == long2ip($ip2long); }
php
protected function _validateIPv4($value) { $ip2long = ip2long($value); if($ip2long === false) { return false; } return $value == long2ip($ip2long); }
[ "protected", "function", "_validateIPv4", "(", "$", "value", ")", "{", "$", "ip2long", "=", "ip2long", "(", "$", "value", ")", ";", "if", "(", "$", "ip2long", "===", "false", ")", "{", "return", "false", ";", "}", "return", "$", "value", "==", "long2...
Validates an IPv4 address @param string $value
[ "Validates", "an", "IPv4", "address" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Ip.php#L145-L152
train
Validate IPv4 address
[ 30522, 5123, 3853, 1035, 9398, 3686, 11514, 2615, 2549, 1006, 1002, 3643, 1007, 1063, 1002, 12997, 2475, 10052, 1027, 12997, 2475, 10052, 1006, 1002, 3643, 1007, 1025, 2065, 1006, 1002, 12997, 2475, 10052, 1027, 1027, 1027, 6270, 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...
symfony/symfony
src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php
DoctrinePingConnectionMiddleware.handle
public function handle(Envelope $envelope, StackInterface $stack): Envelope { $entityManager = $this->managerRegistry->getManager($this->entityManagerName); if (!$entityManager instanceof EntityManagerInterface) { throw new \InvalidArgumentException(sprintf('The ObjectManager with name "%s" must be an instance of EntityManagerInterface', $this->entityManagerName)); } $connection = $entityManager->getConnection(); if (!$connection->ping()) { $connection->close(); $connection->connect(); } if (!$entityManager->isOpen()) { $this->managerRegistry->resetManager($this->entityManagerName); } return $stack->next()->handle($envelope, $stack); }
php
public function handle(Envelope $envelope, StackInterface $stack): Envelope { $entityManager = $this->managerRegistry->getManager($this->entityManagerName); if (!$entityManager instanceof EntityManagerInterface) { throw new \InvalidArgumentException(sprintf('The ObjectManager with name "%s" must be an instance of EntityManagerInterface', $this->entityManagerName)); } $connection = $entityManager->getConnection(); if (!$connection->ping()) { $connection->close(); $connection->connect(); } if (!$entityManager->isOpen()) { $this->managerRegistry->resetManager($this->entityManagerName); } return $stack->next()->handle($envelope, $stack); }
[ "public", "function", "handle", "(", "Envelope", "$", "envelope", ",", "StackInterface", "$", "stack", ")", ":", "Envelope", "{", "$", "entityManager", "=", "$", "this", "->", "managerRegistry", "->", "getManager", "(", "$", "this", "->", "entityManagerName", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php#L41-L61
train
Handle the next message
[ 30522, 2270, 3853, 5047, 1006, 11255, 1002, 11255, 1010, 9991, 18447, 2121, 12172, 1002, 9991, 1007, 1024, 11255, 1063, 1002, 9178, 24805, 4590, 1027, 1002, 2023, 1011, 1028, 3208, 2890, 24063, 2854, 1011, 1028, 2131, 24805, 4590, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/PluginManager.php
PluginManager.getPluginPath
public function getPluginPath($id) { $classId = $this->getIdentifier($id); if (!isset($this->pathMap[$classId])) { return null; } return File::normalizePath($this->pathMap[$classId]); }
php
public function getPluginPath($id) { $classId = $this->getIdentifier($id); if (!isset($this->pathMap[$classId])) { return null; } return File::normalizePath($this->pathMap[$classId]); }
[ "public", "function", "getPluginPath", "(", "$", "id", ")", "{", "$", "classId", "=", "$", "this", "->", "getIdentifier", "(", "$", "id", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "pathMap", "[", "$", "classId", "]", ")", ")", "{...
Returns the directory path to a plugin
[ "Returns", "the", "directory", "path", "to", "a", "plugin" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L300-L308
train
Get plugin path
[ 30522, 2270, 3853, 2131, 24759, 15916, 2378, 15069, 1006, 1002, 8909, 1007, 1063, 1002, 2465, 3593, 1027, 1002, 2023, 1011, 1028, 2131, 5178, 16778, 8873, 2121, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
PropertyAccessDecorator.createListFromLoader
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null) { if (\is_string($value)) { $value = new PropertyPath($value); } if ($value instanceof PropertyPath) { $accessor = $this->propertyAccessor; $value = function ($choice) use ($accessor, $value) { // The callable may be invoked with a non-object/array value // when such values are passed to // ChoiceListInterface::getValuesForChoices(). Handle this case // so that the call to getValue() doesn't break. if (\is_object($choice) || \is_array($choice)) { return $accessor->getValue($choice, $value); } }; } return $this->decoratedFactory->createListFromLoader($loader, $value); }
php
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null) { if (\is_string($value)) { $value = new PropertyPath($value); } if ($value instanceof PropertyPath) { $accessor = $this->propertyAccessor; $value = function ($choice) use ($accessor, $value) { // The callable may be invoked with a non-object/array value // when such values are passed to // ChoiceListInterface::getValuesForChoices(). Handle this case // so that the call to getValue() doesn't break. if (\is_object($choice) || \is_array($choice)) { return $accessor->getValue($choice, $value); } }; } return $this->decoratedFactory->createListFromLoader($loader, $value); }
[ "public", "function", "createListFromLoader", "(", "ChoiceLoaderInterface", "$", "loader", ",", "$", "value", "=", "null", ")", "{", "if", "(", "\\", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "new", "PropertyPath", "(", "$", "valu...
{@inheritdoc} @param ChoiceLoaderInterface $loader The choice loader @param callable|string|PropertyPath|null $value The callable or path for generating the choice values @return ChoiceListInterface The choice list
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php#L99-L119
train
Create a ChoiceList from a ChoiceLoaderInterface
[ 30522, 2270, 3853, 3443, 9863, 19699, 5358, 11066, 2121, 1006, 3601, 11066, 23282, 3334, 12172, 1002, 7170, 2121, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 5164, 1006, 1002, 3643, 1007, 1007, 1063, 1002, 3643,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Command/AssetsInstallCommand.php
AssetsInstallCommand.hardCopy
private function hardCopy(string $originDir, string $targetDir): string { $this->filesystem->mkdir($targetDir, 0777); // We use a custom iterator to ignore VCS files $this->filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir)); return self::METHOD_COPY; }
php
private function hardCopy(string $originDir, string $targetDir): string { $this->filesystem->mkdir($targetDir, 0777); // We use a custom iterator to ignore VCS files $this->filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir)); return self::METHOD_COPY; }
[ "private", "function", "hardCopy", "(", "string", "$", "originDir", ",", "string", "$", "targetDir", ")", ":", "string", "{", "$", "this", "->", "filesystem", "->", "mkdir", "(", "$", "targetDir", ",", "0777", ")", ";", "// We use a custom iterator to ignore V...
Copies origin to target.
[ "Copies", "origin", "to", "target", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php#L256-L263
train
Copy the files from the origin directory to the target directory
[ 30522, 2797, 3853, 2524, 3597, 7685, 1006, 5164, 1002, 4761, 4305, 2099, 1010, 5164, 1002, 4539, 4305, 2099, 1007, 1024, 5164, 1063, 1002, 2023, 1011, 1028, 6764, 27268, 6633, 1011, 1028, 12395, 4305, 2099, 1006, 1002, 4539, 4305, 2099, 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...
dompdf/dompdf
src/Frame/FrameTree.php
FrameTree._remove_node
protected function _remove_node(DOMNode $node, array &$children, $index) { $child = $children[$index]; $previousChild = $child->previousSibling; $nextChild = $child->nextSibling; $node->removeChild($child); if (isset($previousChild, $nextChild)) { if ($previousChild->nodeName === "#text" && $nextChild->nodeName === "#text") { $previousChild->nodeValue .= $nextChild->nodeValue; $this->_remove_node($node, $children, $index+1); } } array_splice($children, $index, 1); }
php
protected function _remove_node(DOMNode $node, array &$children, $index) { $child = $children[$index]; $previousChild = $child->previousSibling; $nextChild = $child->nextSibling; $node->removeChild($child); if (isset($previousChild, $nextChild)) { if ($previousChild->nodeName === "#text" && $nextChild->nodeName === "#text") { $previousChild->nodeValue .= $nextChild->nodeValue; $this->_remove_node($node, $children, $index+1); } } array_splice($children, $index, 1); }
[ "protected", "function", "_remove_node", "(", "DOMNode", "$", "node", ",", "array", "&", "$", "children", ",", "$", "index", ")", "{", "$", "child", "=", "$", "children", "[", "$", "index", "]", ";", "$", "previousChild", "=", "$", "child", "->", "pr...
Remove a child from a node Remove a child from a node. If the removed node results in two adjacent #text nodes then combine them. @param DOMNode $node the current DOMNode being considered @param array $children an array of nodes that are the children of $node @param int $index index from the $children array of the node to remove
[ "Remove", "a", "child", "from", "a", "node" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame/FrameTree.php#L204-L217
train
Remove a node from the children array
[ 30522, 5123, 3853, 1035, 6366, 1035, 13045, 1006, 14383, 3630, 3207, 1002, 13045, 1010, 9140, 1004, 1002, 2336, 1010, 1002, 5950, 1007, 1063, 1002, 2775, 1027, 1002, 2336, 1031, 1002, 5950, 1033, 1025, 1002, 3025, 19339, 1027, 1002, 2775, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Concurrency/DistributedList.php
DistributedList.setAll
public function setAll($items) { foreach ($items as $key => &$item) { if (is_array($item)) { throw new \InvalidArgumentException("Array item encountered in DistributedList::setAll() [ key = $key ]."); } else { $item = (string)$item; } } Option::set($this->optionName, serialize($items)); }
php
public function setAll($items) { foreach ($items as $key => &$item) { if (is_array($item)) { throw new \InvalidArgumentException("Array item encountered in DistributedList::setAll() [ key = $key ]."); } else { $item = (string)$item; } } Option::set($this->optionName, serialize($items)); }
[ "public", "function", "setAll", "(", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "key", "=>", "&", "$", "item", ")", "{", "if", "(", "is_array", "(", "$", "item", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", ...
Sets the contents of the list in the option table. @param string[] $items
[ "Sets", "the", "contents", "of", "the", "list", "in", "the", "option", "table", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Concurrency/DistributedList.php#L77-L88
train
Set all items in the option
[ 30522, 2270, 3853, 2275, 8095, 1006, 1002, 5167, 1007, 1063, 18921, 6776, 1006, 1002, 5167, 2004, 1002, 3145, 1027, 1028, 1004, 1002, 8875, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 8875, 1007, 1007, 1063, 5466, 2047, 1032, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
MorphTo.gatherKeysByType
protected function gatherKeysByType($type) { return collect($this->dictionary[$type])->map(function ($models) { return head($models)->{$this->foreignKey}; })->values()->unique()->all(); }
php
protected function gatherKeysByType($type) { return collect($this->dictionary[$type])->map(function ($models) { return head($models)->{$this->foreignKey}; })->values()->unique()->all(); }
[ "protected", "function", "gatherKeysByType", "(", "$", "type", ")", "{", "return", "collect", "(", "$", "this", "->", "dictionary", "[", "$", "type", "]", ")", "->", "map", "(", "function", "(", "$", "models", ")", "{", "return", "head", "(", "$", "m...
Gather all of the foreign keys for a given type. @param string $type @return array
[ "Gather", "all", "of", "the", "foreign", "keys", "for", "a", "given", "type", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php#L127-L132
train
Gather all keys by type
[ 30522, 5123, 3853, 8587, 14839, 14478, 13874, 1006, 1002, 2828, 1007, 1063, 2709, 8145, 1006, 1002, 2023, 1011, 1028, 9206, 1031, 1002, 2828, 1033, 1007, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 4275, 1007, 1063, 2709, 2132, 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...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
ServerBased.isAvailable
public function isAvailable() { // check if apache module is installed if (function_exists('apache_get_modules')) { foreach (apache_get_modules() as $name) { if (strpos($name, 'geoip') !== false) { return true; } } } $available = !empty($_SERVER[self::TEST_SERVER_VAR]) || !empty($_SERVER[self::TEST_SERVER_VAR_ALT]) || !empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6]) ; if ($available) { return true; } // if not available return message w/ extra info if (!function_exists('apache_get_modules')) { return Piwik::translate('General_Note') . ':&nbsp;' . Piwik::translate('UserCountry_AssumingNonApache'); } $message = "<strong>" . Piwik::translate('General_Note') . ':&nbsp;' . Piwik::translate('UserCountry_FoundApacheModules') . "</strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n"; foreach (apache_get_modules() as $name) { $message .= "<li>$name</li>\n"; } $message .= "</ul>"; return $message; }
php
public function isAvailable() { // check if apache module is installed if (function_exists('apache_get_modules')) { foreach (apache_get_modules() as $name) { if (strpos($name, 'geoip') !== false) { return true; } } } $available = !empty($_SERVER[self::TEST_SERVER_VAR]) || !empty($_SERVER[self::TEST_SERVER_VAR_ALT]) || !empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6]) ; if ($available) { return true; } // if not available return message w/ extra info if (!function_exists('apache_get_modules')) { return Piwik::translate('General_Note') . ':&nbsp;' . Piwik::translate('UserCountry_AssumingNonApache'); } $message = "<strong>" . Piwik::translate('General_Note') . ':&nbsp;' . Piwik::translate('UserCountry_FoundApacheModules') . "</strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n"; foreach (apache_get_modules() as $name) { $message .= "<li>$name</li>\n"; } $message .= "</ul>"; return $message; }
[ "public", "function", "isAvailable", "(", ")", "{", "// check if apache module is installed", "if", "(", "function_exists", "(", "'apache_get_modules'", ")", ")", "{", "foreach", "(", "apache_get_modules", "(", ")", "as", "$", "name", ")", "{", "if", "(", "strpo...
Checks if an HTTP server module has been installed. It checks by looking for the GEOIP_ADDR server variable. There's a special check for the Apache module, but we can't check specifically for anything else. @return bool|string
[ "Checks", "if", "an", "HTTP", "server", "module", "has", "been", "installed", ".", "It", "checks", "by", "looking", "for", "the", "GEOIP_ADDR", "server", "variable", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php#L147-L180
train
Check if the Apache module is available
[ 30522, 2270, 3853, 18061, 3567, 11733, 3468, 1006, 1007, 1063, 1013, 1013, 4638, 2065, 15895, 11336, 2003, 5361, 2065, 1006, 3853, 1035, 6526, 1006, 1005, 15895, 1035, 2131, 1035, 14184, 1005, 1007, 1007, 30524, 2358, 14536, 2891, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php
AuthorizesRequests.parseAbilityAndArguments
protected function parseAbilityAndArguments($ability, $arguments) { if (is_string($ability) && strpos($ability, '\\') === false) { return [$ability, $arguments]; } $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; return [$this->normalizeGuessedAbilityName($method), $ability]; }
php
protected function parseAbilityAndArguments($ability, $arguments) { if (is_string($ability) && strpos($ability, '\\') === false) { return [$ability, $arguments]; } $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; return [$this->normalizeGuessedAbilityName($method), $ability]; }
[ "protected", "function", "parseAbilityAndArguments", "(", "$", "ability", ",", "$", "arguments", ")", "{", "if", "(", "is_string", "(", "$", "ability", ")", "&&", "strpos", "(", "$", "ability", ",", "'\\\\'", ")", "===", "false", ")", "{", "return", "[",...
Guesses the ability's name if it wasn't provided. @param mixed $ability @param mixed|array $arguments @return array
[ "Guesses", "the", "ability", "s", "name", "if", "it", "wasn", "t", "provided", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php#L50-L59
train
Parse the given ability and arguments and return the result as array
[ 30522, 5123, 3853, 11968, 17310, 8553, 13832, 10623, 30524, 3754, 1007, 1004, 1004, 2358, 14536, 2891, 1006, 1002, 3754, 1010, 1005, 1032, 1032, 1005, 1007, 1027, 1027, 1027, 6270, 1007, 1063, 2709, 1031, 1002, 3754, 1010, 1002, 9918, 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...
octobercms/october
modules/system/classes/MediaLibrary.php
MediaLibrary.getStorageDisk
protected function getStorageDisk() { if ($this->storageDisk) { return $this->storageDisk; } return $this->storageDisk = Storage::disk( Config::get('cms.storage.media.disk', 'local') ); }
php
protected function getStorageDisk() { if ($this->storageDisk) { return $this->storageDisk; } return $this->storageDisk = Storage::disk( Config::get('cms.storage.media.disk', 'local') ); }
[ "protected", "function", "getStorageDisk", "(", ")", "{", "if", "(", "$", "this", "->", "storageDisk", ")", "{", "return", "$", "this", "->", "storageDisk", ";", "}", "return", "$", "this", "->", "storageDisk", "=", "Storage", "::", "disk", "(", "Config"...
Initializes and returns the Media Library disk. This method should always be used instead of trying to access the $storageDisk property directly as initializing the disc requires communicating with the remote storage. @return mixed Returns the storage disk object.
[ "Initializes", "and", "returns", "the", "Media", "Library", "disk", ".", "This", "method", "should", "always", "be", "used", "instead", "of", "trying", "to", "access", "the", "$storageDisk", "property", "directly", "as", "initializing", "the", "disc", "requires"...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L758-L767
train
Get Storage Disk
[ 30522, 5123, 3853, 4152, 4263, 18655, 20573, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5527, 10521, 2243, 1007, 1063, 2709, 1002, 2023, 1011, 30524, 2023, 1011, 1028, 5527, 10521, 2243, 1027, 5527, 1024, 1024, 9785, 1006, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Mime/Header/AbstractHeader.php
AbstractHeader.createPhrase
protected function createPhrase(HeaderInterface $header, string $string, string $charset, bool $shorten = false): string { // Treat token as exactly what was given $phraseStr = $string; // If it's not valid if (!preg_match('/^'.self::PHRASE_PATTERN.'$/D', $phraseStr)) { // .. but it is just ascii text, try escaping some characters // and make it a quoted-string if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) { foreach (['\\', '"'] as $char) { $phraseStr = str_replace($char, '\\'.$char, $phraseStr); } $phraseStr = '"'.$phraseStr.'"'; } else { // ... otherwise it needs encoding // Determine space remaining on line if first line if ($shorten) { $usedLength = \strlen($header->getName().': '); } else { $usedLength = 0; } $phraseStr = $this->encodeWords($header, $string, $usedLength); } } return $phraseStr; }
php
protected function createPhrase(HeaderInterface $header, string $string, string $charset, bool $shorten = false): string { // Treat token as exactly what was given $phraseStr = $string; // If it's not valid if (!preg_match('/^'.self::PHRASE_PATTERN.'$/D', $phraseStr)) { // .. but it is just ascii text, try escaping some characters // and make it a quoted-string if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) { foreach (['\\', '"'] as $char) { $phraseStr = str_replace($char, '\\'.$char, $phraseStr); } $phraseStr = '"'.$phraseStr.'"'; } else { // ... otherwise it needs encoding // Determine space remaining on line if first line if ($shorten) { $usedLength = \strlen($header->getName().': '); } else { $usedLength = 0; } $phraseStr = $this->encodeWords($header, $string, $usedLength); } } return $phraseStr; }
[ "protected", "function", "createPhrase", "(", "HeaderInterface", "$", "header", ",", "string", "$", "string", ",", "string", "$", "charset", ",", "bool", "$", "shorten", "=", "false", ")", ":", "string", "{", "// Treat token as exactly what was given", "$", "phr...
Produces a compliant, formatted RFC 2822 'phrase' based on the string given. @param string $string as displayed @param bool $shorten the first line to make remove for header name
[ "Produces", "a", "compliant", "formatted", "RFC", "2822", "phrase", "based", "on", "the", "string", "given", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Header/AbstractHeader.php#L90-L117
train
Create phrase string
[ 30522, 5123, 3853, 3443, 8458, 23797, 1006, 20346, 18447, 2121, 12172, 1002, 20346, 1010, 5164, 1002, 5164, 1010, 5164, 1002, 25869, 13462, 1010, 22017, 2140, 1002, 2460, 2368, 1027, 6270, 1007, 1024, 5164, 1063, 1013, 1013, 7438, 19204, 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/Twig/Twig.php
Twig.processPage
public function processPage(PageInterface $item, $content = null) { $content = $content ?? $item->content(); // override the twig header vars for local resolution $this->grav->fireEvent('onTwigPageVariables', new Event(['page' => $item])); $twig_vars = $this->twig_vars; $twig_vars['page'] = $item; $twig_vars['media'] = $item->media(); $twig_vars['header'] = $item->header(); $local_twig = clone $this->twig; $output = ''; try { // Process Modular Twig if ($item->modularTwig()) { $twig_vars['content'] = $content; $extension = $item->templateFormat(); $extension = $extension ? ".{$extension}.twig" : TEMPLATE_EXT; $template = $item->template() . $extension; $output = $content = $local_twig->render($template, $twig_vars); } // Process in-page Twig if ($item->shouldProcess('twig')) { $name = '@Page:' . $item->path(); $this->setTemplate($name, $content); $output = $local_twig->render($name, $twig_vars); } } catch (\Twig_Error_Loader $e) { throw new \RuntimeException($e->getRawMessage(), 404, $e); } return $output; }
php
public function processPage(PageInterface $item, $content = null) { $content = $content ?? $item->content(); // override the twig header vars for local resolution $this->grav->fireEvent('onTwigPageVariables', new Event(['page' => $item])); $twig_vars = $this->twig_vars; $twig_vars['page'] = $item; $twig_vars['media'] = $item->media(); $twig_vars['header'] = $item->header(); $local_twig = clone $this->twig; $output = ''; try { // Process Modular Twig if ($item->modularTwig()) { $twig_vars['content'] = $content; $extension = $item->templateFormat(); $extension = $extension ? ".{$extension}.twig" : TEMPLATE_EXT; $template = $item->template() . $extension; $output = $content = $local_twig->render($template, $twig_vars); } // Process in-page Twig if ($item->shouldProcess('twig')) { $name = '@Page:' . $item->path(); $this->setTemplate($name, $content); $output = $local_twig->render($name, $twig_vars); } } catch (\Twig_Error_Loader $e) { throw new \RuntimeException($e->getRawMessage(), 404, $e); } return $output; }
[ "public", "function", "processPage", "(", "PageInterface", "$", "item", ",", "$", "content", "=", "null", ")", "{", "$", "content", "=", "$", "content", "??", "$", "item", "->", "content", "(", ")", ";", "// override the twig header vars for local resolution", ...
Twig process that renders a page item. It supports two variations: 1) Handles modular pages by rendering a specific page based on its modular twig template 2) Renders individual page items for twig processing before the site rendering @param PageInterface $item The page item to render @param string $content Optional content override @return string The rendered output @throws \Twig_Error_Loader
[ "Twig", "process", "that", "renders", "a", "page", "item", ".", "It", "supports", "two", "variations", ":", "1", ")", "Handles", "modular", "pages", "by", "rendering", "a", "specific", "page", "based", "on", "its", "modular", "twig", "template", "2", ")", ...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/Twig.php#L259-L296
train
Process a page
[ 30522, 2270, 3853, 2832, 13704, 1006, 3931, 18447, 2121, 12172, 1002, 8875, 1010, 1002, 4180, 1027, 19701, 1007, 1063, 1002, 4180, 1027, 1002, 4180, 1029, 1029, 1002, 8875, 1011, 1028, 4180, 1006, 1007, 1025, 1013, 1013, 2058, 15637, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Validator.php
Validator.validateAttribute
protected function validateAttribute($attribute, $rule) { $this->currentRule = $rule; [$rule, $parameters] = ValidationRuleParser::parse($rule); if ($rule == '') { return; } // First we will get the correct keys for the given attribute in case the field is nested in // an array. Then we determine if the given rule accepts other field names as parameters. // If so, we will replace any asterisks found in the parameters with the correct keys. if (($keys = $this->getExplicitKeys($attribute)) && $this->dependsOnOtherFields($rule)) { $parameters = $this->replaceAsterisksInParameters($parameters, $keys); } $value = $this->getValue($attribute); // If the attribute is a file, we will verify that the file upload was actually successful // and if it wasn't we will add a failure for the attribute. Files may not successfully // upload if they are too large based on PHP's settings so we will bail in this case. if ($value instanceof UploadedFile && ! $value->isValid() && $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules)) ) { return $this->addFailure($attribute, 'uploaded', []); } // If we have made it this far we will make sure the attribute is validatable and if it is // we will call the validation method with the attribute. If a method returns false the // attribute is invalid and we will add a failure message for this failing attribute. $validatable = $this->isValidatable($rule, $attribute, $value); if ($rule instanceof RuleContract) { return $validatable ? $this->validateUsingCustomRule($attribute, $value, $rule) : null; } $method = "validate{$rule}"; if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { $this->addFailure($attribute, $rule, $parameters); } }
php
protected function validateAttribute($attribute, $rule) { $this->currentRule = $rule; [$rule, $parameters] = ValidationRuleParser::parse($rule); if ($rule == '') { return; } // First we will get the correct keys for the given attribute in case the field is nested in // an array. Then we determine if the given rule accepts other field names as parameters. // If so, we will replace any asterisks found in the parameters with the correct keys. if (($keys = $this->getExplicitKeys($attribute)) && $this->dependsOnOtherFields($rule)) { $parameters = $this->replaceAsterisksInParameters($parameters, $keys); } $value = $this->getValue($attribute); // If the attribute is a file, we will verify that the file upload was actually successful // and if it wasn't we will add a failure for the attribute. Files may not successfully // upload if they are too large based on PHP's settings so we will bail in this case. if ($value instanceof UploadedFile && ! $value->isValid() && $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules)) ) { return $this->addFailure($attribute, 'uploaded', []); } // If we have made it this far we will make sure the attribute is validatable and if it is // we will call the validation method with the attribute. If a method returns false the // attribute is invalid and we will add a failure message for this failing attribute. $validatable = $this->isValidatable($rule, $attribute, $value); if ($rule instanceof RuleContract) { return $validatable ? $this->validateUsingCustomRule($attribute, $value, $rule) : null; } $method = "validate{$rule}"; if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { $this->addFailure($attribute, $rule, $parameters); } }
[ "protected", "function", "validateAttribute", "(", "$", "attribute", ",", "$", "rule", ")", "{", "$", "this", "->", "currentRule", "=", "$", "rule", ";", "[", "$", "rule", ",", "$", "parameters", "]", "=", "ValidationRuleParser", "::", "parse", "(", "$",...
Validate a given attribute against a rule. @param string $attribute @param string $rule @return void
[ "Validate", "a", "given", "attribute", "against", "a", "rule", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L356-L401
train
Validate an attribute using the given rule
[ 30522, 5123, 3853, 9398, 3686, 19321, 3089, 8569, 2618, 1006, 1002, 17961, 1010, 1002, 3627, 1007, 1063, 1002, 2023, 1011, 1028, 2783, 6820, 2571, 1027, 1002, 3627, 1025, 1031, 1002, 3627, 1010, 1002, 11709, 1033, 1027, 27354, 6820, 2571, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/OA/Client.php
Client.checkinRecords
public function checkinRecords(int $startTime, int $endTime, array $userList, int $type = 3) { $params = [ 'opencheckindatatype' => $type, 'starttime' => $startTime, 'endtime' => $endTime, 'useridlist' => $userList, ]; return $this->httpPostJson('cgi-bin/checkin/getcheckindata', $params); }
php
public function checkinRecords(int $startTime, int $endTime, array $userList, int $type = 3) { $params = [ 'opencheckindatatype' => $type, 'starttime' => $startTime, 'endtime' => $endTime, 'useridlist' => $userList, ]; return $this->httpPostJson('cgi-bin/checkin/getcheckindata', $params); }
[ "public", "function", "checkinRecords", "(", "int", "$", "startTime", ",", "int", "$", "endTime", ",", "array", "$", "userList", ",", "int", "$", "type", "=", "3", ")", "{", "$", "params", "=", "[", "'opencheckindatatype'", "=>", "$", "type", ",", "'st...
Get the checkin data. @param int $startTime @param int $endTime @param array $userList @param int $type @return mixed
[ "Get", "the", "checkin", "data", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Work/OA/Client.php#L33-L43
train
Get checkin records
[ 30522, 2270, 3853, 4638, 2378, 2890, 27108, 5104, 1006, 20014, 1002, 2707, 7292, 1010, 20014, 1002, 2203, 7292, 1010, 9140, 1002, 5310, 9863, 1010, 20014, 1002, 2828, 1027, 1017, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 2330, 5403, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/NumericNode.php
NumericNode.finalizeValue
protected function finalizeValue($value) { $value = parent::finalizeValue($value); $errorMsg = null; if (isset($this->min) && $value < $this->min) { $errorMsg = sprintf('The value %s is too small for path "%s". Should be greater than or equal to %s', $value, $this->getPath(), $this->min); } if (isset($this->max) && $value > $this->max) { $errorMsg = sprintf('The value %s is too big for path "%s". Should be less than or equal to %s', $value, $this->getPath(), $this->max); } if (isset($errorMsg)) { $ex = new InvalidConfigurationException($errorMsg); $ex->setPath($this->getPath()); throw $ex; } return $value; }
php
protected function finalizeValue($value) { $value = parent::finalizeValue($value); $errorMsg = null; if (isset($this->min) && $value < $this->min) { $errorMsg = sprintf('The value %s is too small for path "%s". Should be greater than or equal to %s', $value, $this->getPath(), $this->min); } if (isset($this->max) && $value > $this->max) { $errorMsg = sprintf('The value %s is too big for path "%s". Should be less than or equal to %s', $value, $this->getPath(), $this->max); } if (isset($errorMsg)) { $ex = new InvalidConfigurationException($errorMsg); $ex->setPath($this->getPath()); throw $ex; } return $value; }
[ "protected", "function", "finalizeValue", "(", "$", "value", ")", "{", "$", "value", "=", "parent", "::", "finalizeValue", "(", "$", "value", ")", ";", "$", "errorMsg", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "min", ")", "&&", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/NumericNode.php#L36-L54
train
Finalize value.
[ 30522, 5123, 3853, 2345, 4697, 10175, 5657, 1006, 1002, 3643, 1007, 1063, 1002, 3643, 1027, 6687, 1024, 1024, 2345, 4697, 10175, 5657, 1006, 1002, 3643, 1007, 1025, 1002, 7561, 5244, 2290, 1027, 19701, 1025, 2065, 1006, 26354, 3388, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/console/OctoberEnv.php
OctoberEnv.parseConfigFile
private function parseConfigFile() { $lines = []; foreach ($this->lines() as $line) { $keys = $this->config()[$this->config]; $lines[] = $this->parseLine($line, $keys); } $this->writeToEnv("\n"); return implode('', $lines); }
php
private function parseConfigFile() { $lines = []; foreach ($this->lines() as $line) { $keys = $this->config()[$this->config]; $lines[] = $this->parseLine($line, $keys); } $this->writeToEnv("\n"); return implode('', $lines); }
[ "private", "function", "parseConfigFile", "(", ")", "{", "$", "lines", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "lines", "(", ")", "as", "$", "line", ")", "{", "$", "keys", "=", "$", "this", "->", "config", "(", ")", "[", "$", "th...
Parse config file line by line @return string
[ "Parse", "config", "file", "line", "by", "line" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/OctoberEnv.php#L90-L103
train
Parse config file and return result
[ 30522, 2797, 3853, 11968, 3366, 8663, 8873, 25708, 9463, 1006, 1007, 1063, 1002, 3210, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 3210, 1006, 1007, 2004, 1002, 2240, 1007, 1063, 1002, 6309, 1027, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php
EntryManager.move
public function move(Entry $entry, string $newParent) { $con = $this->getConnectionResource(); $rdn = $this->parseRdnFromEntry($entry); // deleteOldRdn does not matter here, since the Rdn will not be changing in the move. if (!@ldap_rename($con, $entry->getDn(), $rdn, $newParent, true)) { throw new LdapException(sprintf('Could not move entry "%s" to "%s": %s.', $entry->getDn(), $newParent, ldap_error($con))); } }
php
public function move(Entry $entry, string $newParent) { $con = $this->getConnectionResource(); $rdn = $this->parseRdnFromEntry($entry); // deleteOldRdn does not matter here, since the Rdn will not be changing in the move. if (!@ldap_rename($con, $entry->getDn(), $rdn, $newParent, true)) { throw new LdapException(sprintf('Could not move entry "%s" to "%s": %s.', $entry->getDn(), $newParent, ldap_error($con))); } }
[ "public", "function", "move", "(", "Entry", "$", "entry", ",", "string", "$", "newParent", ")", "{", "$", "con", "=", "$", "this", "->", "getConnectionResource", "(", ")", ";", "$", "rdn", "=", "$", "this", "->", "parseRdnFromEntry", "(", "$", "entry",...
Moves an entry on the Ldap server. @throws NotBoundException if the connection has not been previously bound @throws LdapException if an error is thrown during the rename operation
[ "Moves", "an", "entry", "on", "the", "Ldap", "server", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php#L119-L127
train
Moves an entry to a new parent
[ 30522, 2270, 3853, 2693, 1006, 4443, 1002, 4443, 1010, 5164, 1002, 2047, 19362, 4765, 1007, 1063, 1002, 9530, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 2638, 7542, 6072, 8162, 3401, 1006, 1007, 1025, 1002, 16428, 2078, 1027, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
BelongsToMany.performJoin
protected function performJoin($query = null) { $query = $query ?: $this->query; // We need to join to the intermediate table on the related model's primary // key column with the intermediate table's foreign key for the related // model instance. Then we can set the "where" for the parent models. $baseTable = $this->related->getTable(); $key = $baseTable.'.'.$this->relatedKey; $query->join($this->table, $key, '=', $this->getQualifiedRelatedPivotKeyName()); return $this; }
php
protected function performJoin($query = null) { $query = $query ?: $this->query; // We need to join to the intermediate table on the related model's primary // key column with the intermediate table's foreign key for the related // model instance. Then we can set the "where" for the parent models. $baseTable = $this->related->getTable(); $key = $baseTable.'.'.$this->relatedKey; $query->join($this->table, $key, '=', $this->getQualifiedRelatedPivotKeyName()); return $this; }
[ "protected", "function", "performJoin", "(", "$", "query", "=", "null", ")", "{", "$", "query", "=", "$", "query", "?", ":", "$", "this", "->", "query", ";", "// We need to join to the intermediate table on the related model's primary", "// key column with the intermedi...
Set the join clause for the relation query. @param \Illuminate\Database\Eloquent\Builder|null $query @return $this
[ "Set", "the", "join", "clause", "for", "the", "relation", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php#L199-L213
train
Perform a join to the related table
[ 30522, 5123, 3853, 4685, 5558, 2378, 1006, 1002, 23032, 1027, 19701, 1007, 1063, 1002, 23032, 1027, 30524, 1025, 1013, 1013, 2057, 2342, 2000, 3693, 2000, 1996, 7783, 2795, 2006, 1996, 3141, 2944, 1005, 1055, 3078, 1013, 1013, 3145, 5930, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/Mailable.php
Mailable.queue
public function queue(Queue $queue) { if (isset($this->delay)) { return $this->later($this->delay, $queue); } $connection = property_exists($this, 'connection') ? $this->connection : null; $queueName = property_exists($this, 'queue') ? $this->queue : null; return $queue->connection($connection)->pushOn( $queueName ?: null, new SendQueuedMailable($this) ); }
php
public function queue(Queue $queue) { if (isset($this->delay)) { return $this->later($this->delay, $queue); } $connection = property_exists($this, 'connection') ? $this->connection : null; $queueName = property_exists($this, 'queue') ? $this->queue : null; return $queue->connection($connection)->pushOn( $queueName ?: null, new SendQueuedMailable($this) ); }
[ "public", "function", "queue", "(", "Queue", "$", "queue", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "delay", ")", ")", "{", "return", "$", "this", "->", "later", "(", "$", "this", "->", "delay", ",", "$", "queue", ")", ";", "}", "$...
Queue the message for sending. @param \Illuminate\Contracts\Queue\Factory $queue @return mixed
[ "Queue", "the", "message", "for", "sending", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L169-L182
train
Push a message to the queue
[ 30522, 2270, 3853, 24240, 1006, 24240, 1002, 24240, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 8536, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2101, 1006, 1002, 2023, 1011, 1028, 8536, 1010, 1002, 24240, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/behaviors/FormController.php
FormController.formFindModelObject
public function formFindModelObject($recordId) { if (!strlen($recordId)) { throw new ApplicationException($this->getLang('not-found-message', 'backend::lang.form.missing_id')); } $model = $this->controller->formCreateModelObject(); /* * Prepare query and find model record */ $query = $model->newQuery(); $this->controller->formExtendQuery($query); $result = $query->find($recordId); if (!$result) { throw new ApplicationException($this->getLang('not-found-message', 'backend::lang.form.not_found', [ 'class' => get_class($model), 'id' => $recordId ])); } $result = $this->controller->formExtendModel($result) ?: $result; return $result; }
php
public function formFindModelObject($recordId) { if (!strlen($recordId)) { throw new ApplicationException($this->getLang('not-found-message', 'backend::lang.form.missing_id')); } $model = $this->controller->formCreateModelObject(); /* * Prepare query and find model record */ $query = $model->newQuery(); $this->controller->formExtendQuery($query); $result = $query->find($recordId); if (!$result) { throw new ApplicationException($this->getLang('not-found-message', 'backend::lang.form.not_found', [ 'class' => get_class($model), 'id' => $recordId ])); } $result = $this->controller->formExtendModel($result) ?: $result; return $result; }
[ "public", "function", "formFindModelObject", "(", "$", "recordId", ")", "{", "if", "(", "!", "strlen", "(", "$", "recordId", ")", ")", "{", "throw", "new", "ApplicationException", "(", "$", "this", "->", "getLang", "(", "'not-found-message'", ",", "'backend:...
Finds a Model record by its primary identifier, used by update actions. This logic can be changed by overriding it in the controller. @param string $recordId @return Model
[ "Finds", "a", "Model", "record", "by", "its", "primary", "identifier", "used", "by", "update", "actions", ".", "This", "logic", "can", "be", "changed", "by", "overriding", "it", "in", "the", "controller", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/FormController.php#L747-L771
train
Find model object by record id
[ 30522, 2270, 3853, 2433, 16294, 22117, 10244, 4135, 2497, 20614, 1006, 1002, 2501, 3593, 1007, 1063, 2065, 1006, 999, 2358, 20927, 2078, 1006, 1002, 2501, 3593, 1007, 1007, 1063, 5466, 2047, 4646, 10288, 24422, 1006, 1002, 2023, 1011, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php
RouterDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { if ($response instanceof RedirectResponse) { $this->data['redirect'] = true; $this->data['url'] = $response->getTargetUrl(); if ($this->controllers->contains($request)) { $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); } } unset($this->controllers[$request]); }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { if ($response instanceof RedirectResponse) { $this->data['redirect'] = true; $this->data['url'] = $response->getTargetUrl(); if ($this->controllers->contains($request)) { $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); } } unset($this->controllers[$request]); }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "if", "(", "$", "response", "instanceof", "RedirectResponse", ")", "{", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php#L37-L49
train
Collects data for the request and response
[ 30522, 2270, 3853, 8145, 1006, 5227, 1002, 5227, 1010, 3433, 1002, 3433, 1010, 1032, 6453, 1002, 6453, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 3433, 6013, 11253, 2417, 7442, 6593, 6072, 26029, 3366, 1007, 1063, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php
ExpressionVoter.vote
public function vote(TokenInterface $token, $subject, array $attributes) { $result = VoterInterface::ACCESS_ABSTAIN; $variables = null; foreach ($attributes as $attribute) { if (!$attribute instanceof Expression) { continue; } if (null === $variables) { $variables = $this->getVariables($token, $subject); } $result = VoterInterface::ACCESS_DENIED; if ($this->expressionLanguage->evaluate($attribute, $variables)) { return VoterInterface::ACCESS_GRANTED; } } return $result; }
php
public function vote(TokenInterface $token, $subject, array $attributes) { $result = VoterInterface::ACCESS_ABSTAIN; $variables = null; foreach ($attributes as $attribute) { if (!$attribute instanceof Expression) { continue; } if (null === $variables) { $variables = $this->getVariables($token, $subject); } $result = VoterInterface::ACCESS_DENIED; if ($this->expressionLanguage->evaluate($attribute, $variables)) { return VoterInterface::ACCESS_GRANTED; } } return $result; }
[ "public", "function", "vote", "(", "TokenInterface", "$", "token", ",", "$", "subject", ",", "array", "$", "attributes", ")", "{", "$", "result", "=", "VoterInterface", "::", "ACCESS_ABSTAIN", ";", "$", "variables", "=", "null", ";", "foreach", "(", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php#L74-L94
train
Vote for the subject and attributes
[ 30522, 2270, 3853, 3789, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1010, 1002, 3395, 1010, 9140, 1002, 12332, 1007, 1063, 1002, 2765, 1027, 14303, 18447, 2121, 12172, 1024, 1024, 3229, 1035, 14689, 18249, 1025, 1002, 10857, 1027, 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...
opencart/opencart
upload/catalog/controller/event/activity.php
ControllerEventActivity.editCustomer
public function editCustomer(&$route, &$args, &$output) { if ($this->config->get('config_customer_activity')) { $this->load->model('account/activity'); $activity_data = array( 'customer_id' => $this->customer->getId(), 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName() ); $this->model_account_activity->addActivity('edit', $activity_data); } }
php
public function editCustomer(&$route, &$args, &$output) { if ($this->config->get('config_customer_activity')) { $this->load->model('account/activity'); $activity_data = array( 'customer_id' => $this->customer->getId(), 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName() ); $this->model_account_activity->addActivity('edit', $activity_data); } }
[ "public", "function", "editCustomer", "(", "&", "$", "route", ",", "&", "$", "args", ",", "&", "$", "output", ")", "{", "if", "(", "$", "this", "->", "config", "->", "get", "(", "'config_customer_activity'", ")", ")", "{", "$", "this", "->", "load", ...
catalog/model/account/customer/editCustomer/after
[ "catalog", "/", "model", "/", "account", "/", "customer", "/", "editCustomer", "/", "after" ]
e7933b56ba05aafb3655c6b490c9733cd18b5c69
https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/catalog/controller/event/activity.php#L18-L29
train
Edit a customer activity
[ 30522, 2270, 3853, 10086, 7874, 20389, 2121, 1006, 1004, 1002, 2799, 1010, 1004, 1002, 12098, 5620, 1010, 1004, 1002, 6434, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 9530, 8873, 2290, 1011, 1028, 2131, 1006, 1005, 9530, 8873, 2290, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Updates/3.0.0-b4.php
Updates_3_0_0_b4.getUserDatabaseMigrations
private function getUserDatabaseMigrations($queries) { $queries[] = $this->migration->db->changeColumn($this->userTable, 'password', 'password', 'VARCHAR(255) NOT NULL'); return $queries; }
php
private function getUserDatabaseMigrations($queries) { $queries[] = $this->migration->db->changeColumn($this->userTable, 'password', 'password', 'VARCHAR(255) NOT NULL'); return $queries; }
[ "private", "function", "getUserDatabaseMigrations", "(", "$", "queries", ")", "{", "$", "queries", "[", "]", "=", "$", "this", "->", "migration", "->", "db", "->", "changeColumn", "(", "$", "this", "->", "userTable", ",", "'password'", ",", "'password'", "...
Returns database migrations for this update. @param Migration[] $queries @return Migration[]
[ "Returns", "database", "migrations", "for", "this", "update", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updates/3.0.0-b4.php#L64-L69
train
Get user database migrations
[ 30522, 2797, 3853, 2131, 20330, 2850, 2696, 15058, 4328, 29397, 2015, 1006, 1002, 10861, 5134, 1007, 1063, 1002, 10861, 5134, 1031, 1033, 1027, 1002, 2023, 1011, 1028, 9230, 1011, 1028, 16962, 1011, 1028, 2689, 25778, 2819, 2078, 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...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
ServerBased.isWorking
public function isWorking() { if (empty($_SERVER[self::TEST_SERVER_VAR]) && empty($_SERVER[self::TEST_SERVER_VAR_ALT]) && empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6]) ) { return Piwik::translate("UserCountry_CannotFindGeoIPServerVar", self::TEST_SERVER_VAR . ' $_SERVER'); } return true; // can't check for another IP }
php
public function isWorking() { if (empty($_SERVER[self::TEST_SERVER_VAR]) && empty($_SERVER[self::TEST_SERVER_VAR_ALT]) && empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6]) ) { return Piwik::translate("UserCountry_CannotFindGeoIPServerVar", self::TEST_SERVER_VAR . ' $_SERVER'); } return true; // can't check for another IP }
[ "public", "function", "isWorking", "(", ")", "{", "if", "(", "empty", "(", "$", "_SERVER", "[", "self", "::", "TEST_SERVER_VAR", "]", ")", "&&", "empty", "(", "$", "_SERVER", "[", "self", "::", "TEST_SERVER_VAR_ALT", "]", ")", "&&", "empty", "(", "$", ...
Returns true if the GEOIP_ADDR server variable is defined. @return bool
[ "Returns", "true", "if", "the", "GEOIP_ADDR", "server", "variable", "is", "defined", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php#L187-L197
train
Is this IP address working?
[ 30522, 2270, 3853, 2003, 21398, 1006, 1007, 1063, 2065, 30524, 1002, 1035, 8241, 1031, 2969, 1024, 1024, 3231, 1035, 8241, 1035, 13075, 1035, 12456, 1033, 1007, 1004, 1004, 4064, 1006, 1002, 1035, 8241, 1031, 2969, 1024, 1024, 3231, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/LanguagesManager/API.php
API.setLanguageForUser
public function setLanguageForUser($login, $languageCode) { Piwik::checkUserHasSuperUserAccessOrIsTheUser($login); Piwik::checkUserIsNotAnonymous(); if (!$this->isLanguageAvailable($languageCode)) { return false; } $this->getModel()->setLanguageForUser($login, $languageCode); return true; }
php
public function setLanguageForUser($login, $languageCode) { Piwik::checkUserHasSuperUserAccessOrIsTheUser($login); Piwik::checkUserIsNotAnonymous(); if (!$this->isLanguageAvailable($languageCode)) { return false; } $this->getModel()->setLanguageForUser($login, $languageCode); return true; }
[ "public", "function", "setLanguageForUser", "(", "$", "login", ",", "$", "languageCode", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccessOrIsTheUser", "(", "$", "login", ")", ";", "Piwik", "::", "checkUserIsNotAnonymous", "(", ")", ";", "if", "(", "!", "$...
Sets the language for the user @param string $login @param string $languageCode @return bool
[ "Sets", "the", "language", "for", "the", "user" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/API.php#L298-L310
train
Set the language for the user
[ 30522, 2270, 3853, 2275, 25023, 6692, 3351, 29278, 20330, 1006, 1002, 8833, 2378, 1010, 1002, 2653, 16044, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 21748, 2923, 5369, 20330, 1006, 1002, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/Handlers/AbstractError.php
AbstractError.renderThrowableAsText
protected function renderThrowableAsText($throwable) { $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable)); if ($code = $throwable->getCode()) { $text .= sprintf('Code: %s' . PHP_EOL, $code); } if ($message = $throwable->getMessage()) { $text .= sprintf('Message: %s' . PHP_EOL, htmlentities($message)); } if ($file = $throwable->getFile()) { $text .= sprintf('File: %s' . PHP_EOL, $file); } if ($line = $throwable->getLine()) { $text .= sprintf('Line: %s' . PHP_EOL, $line); } if ($trace = $throwable->getTraceAsString()) { $text .= sprintf('Trace: %s', $trace); } return $text; }
php
protected function renderThrowableAsText($throwable) { $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable)); if ($code = $throwable->getCode()) { $text .= sprintf('Code: %s' . PHP_EOL, $code); } if ($message = $throwable->getMessage()) { $text .= sprintf('Message: %s' . PHP_EOL, htmlentities($message)); } if ($file = $throwable->getFile()) { $text .= sprintf('File: %s' . PHP_EOL, $file); } if ($line = $throwable->getLine()) { $text .= sprintf('Line: %s' . PHP_EOL, $line); } if ($trace = $throwable->getTraceAsString()) { $text .= sprintf('Trace: %s', $trace); } return $text; }
[ "protected", "function", "renderThrowableAsText", "(", "$", "throwable", ")", "{", "$", "text", "=", "sprintf", "(", "'Type: %s'", ".", "PHP_EOL", ",", "get_class", "(", "$", "throwable", ")", ")", ";", "if", "(", "$", "code", "=", "$", "throwable", "->"...
Render error as Text. @param Exception|Throwable $throwable @return string
[ "Render", "error", "as", "Text", "." ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Handlers/AbstractError.php#L60-L85
train
Render Throwable as text
[ 30522, 5123, 3853, 17552, 2705, 10524, 3085, 14083, 10288, 2102, 1006, 1002, 5466, 3085, 1007, 1063, 1002, 3793, 1027, 9043, 2546, 1006, 1005, 2828, 1024, 1003, 1055, 1005, 1012, 25718, 1035, 1041, 4747, 1010, 2131, 1035, 2465, 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...
matomo-org/matomo
plugins/CorePluginsAdmin/Controller.php
Controller.isAllowedToTroubleshootAsSuperUser
protected function isAllowedToTroubleshootAsSuperUser() { $isAllowedToTroubleshootAsSuperUser = false; $salt = SettingsPiwik::getSalt(); if (!empty($salt)) { $saltFromRequest = Common::getRequestVar('i_am_super_user', '', 'string'); $isAllowedToTroubleshootAsSuperUser = ($salt == $saltFromRequest); } return $isAllowedToTroubleshootAsSuperUser; }
php
protected function isAllowedToTroubleshootAsSuperUser() { $isAllowedToTroubleshootAsSuperUser = false; $salt = SettingsPiwik::getSalt(); if (!empty($salt)) { $saltFromRequest = Common::getRequestVar('i_am_super_user', '', 'string'); $isAllowedToTroubleshootAsSuperUser = ($salt == $saltFromRequest); } return $isAllowedToTroubleshootAsSuperUser; }
[ "protected", "function", "isAllowedToTroubleshootAsSuperUser", "(", ")", "{", "$", "isAllowedToTroubleshootAsSuperUser", "=", "false", ";", "$", "salt", "=", "SettingsPiwik", "::", "getSalt", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "salt", ")", ")", ...
Let Super User troubleshoot in safe mode, even when Login is broken, with this special trick @return bool @throws Exception
[ "Let", "Super", "User", "troubleshoot", "in", "safe", "mode", "even", "when", "Login", "is", "broken", "with", "this", "special", "trick" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CorePluginsAdmin/Controller.php#L588-L597
train
Check if the current user is allowed to troubleshoot as a super user
[ 30522, 5123, 3853, 18061, 7174, 15557, 3406, 13181, 12083, 4244, 23416, 12054, 6279, 21608, 2121, 1006, 1007, 1063, 1002, 18061, 7174, 15557, 3406, 13181, 12083, 4244, 23416, 12054, 6279, 21608, 2121, 1027, 6270, 1025, 1002, 5474, 1027, 10906...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SitesManager/Model.php
Model.getSitesFromIds
public function getSitesFromIds($idSites, $limit = false) { if (count($idSites) === 0) { return array(); } if ($limit) { $limit = "LIMIT " . (int)$limit; } else { $limit = ''; } $idSites = array_map('intval', $idSites); $db = $this->getDb(); $sites = $db->fetchAll("SELECT * FROM " . $this->table . " WHERE idsite IN (" . implode(", ", $idSites) . ") ORDER BY idsite ASC $limit"); return $sites; }
php
public function getSitesFromIds($idSites, $limit = false) { if (count($idSites) === 0) { return array(); } if ($limit) { $limit = "LIMIT " . (int)$limit; } else { $limit = ''; } $idSites = array_map('intval', $idSites); $db = $this->getDb(); $sites = $db->fetchAll("SELECT * FROM " . $this->table . " WHERE idsite IN (" . implode(", ", $idSites) . ") ORDER BY idsite ASC $limit"); return $sites; }
[ "public", "function", "getSitesFromIds", "(", "$", "idSites", ",", "$", "limit", "=", "false", ")", "{", "if", "(", "count", "(", "$", "idSites", ")", "===", "0", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", "$", "limit", ")", "{",...
Returns the list of websites from the ID array in parameters. @param array $idSites list of website ID @param bool $limit @return array
[ "Returns", "the", "list", "of", "websites", "from", "the", "ID", "array", "in", "parameters", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L201-L221
train
Get list of all the sites from the list of websites
[ 30522, 2270, 3853, 4152, 7616, 19699, 20936, 5104, 1006, 1002, 8909, 28032, 2229, 1010, 1002, 5787, 1027, 6270, 1007, 1063, 2065, 1006, 4175, 1006, 1002, 8909, 28032, 2229, 1007, 1027, 1027, 1027, 1014, 1007, 1063, 2709, 9140, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Filter.php
Filter.makeFilterScope
protected function makeFilterScope($name, $config) { $label = $config['label'] ?? null; $scopeType = $config['type'] ?? null; $scope = new FilterScope($name, $label); $scope->displayAs($scopeType, $config); /* * Set scope value */ $scope->value = $this->getScopeValue($scope, @$config['default']); return $scope; }
php
protected function makeFilterScope($name, $config) { $label = $config['label'] ?? null; $scopeType = $config['type'] ?? null; $scope = new FilterScope($name, $label); $scope->displayAs($scopeType, $config); /* * Set scope value */ $scope->value = $this->getScopeValue($scope, @$config['default']); return $scope; }
[ "protected", "function", "makeFilterScope", "(", "$", "name", ",", "$", "config", ")", "{", "$", "label", "=", "$", "config", "[", "'label'", "]", "??", "null", ";", "$", "scopeType", "=", "$", "config", "[", "'type'", "]", "??", "null", ";", "$", ...
Creates a filter scope object from name and configuration.
[ "Creates", "a", "filter", "scope", "object", "from", "name", "and", "configuration", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L635-L649
train
Create a filter scope
[ 30522, 5123, 3853, 2191, 8873, 21928, 26127, 1006, 1002, 2171, 1010, 1002, 9530, 8873, 2290, 1007, 1063, 1002, 3830, 1027, 1002, 9530, 8873, 2290, 1031, 1005, 3830, 1005, 1033, 1029, 1029, 19701, 1025, 1002, 9531, 13874, 1027, 1002, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SitesManager/API.php
API.getSitesIdFromSiteUrl
public function getSitesIdFromSiteUrl($url) { $url = $this->removeTrailingSlash($url); $normalisedUrls = $this->getNormalizedUrls($url); if (Piwik::hasUserSuperUserAccess()) { $ids = $this->getModel()->getAllSitesIdFromSiteUrl($normalisedUrls); } else { $login = Piwik::getCurrentUserLogin(); $ids = $this->getModel()->getSitesIdFromSiteUrlHavingAccess($login, $normalisedUrls); } return $ids; }
php
public function getSitesIdFromSiteUrl($url) { $url = $this->removeTrailingSlash($url); $normalisedUrls = $this->getNormalizedUrls($url); if (Piwik::hasUserSuperUserAccess()) { $ids = $this->getModel()->getAllSitesIdFromSiteUrl($normalisedUrls); } else { $login = Piwik::getCurrentUserLogin(); $ids = $this->getModel()->getSitesIdFromSiteUrlHavingAccess($login, $normalisedUrls); } return $ids; }
[ "public", "function", "getSitesIdFromSiteUrl", "(", "$", "url", ")", "{", "$", "url", "=", "$", "this", "->", "removeTrailingSlash", "(", "$", "url", ")", ";", "$", "normalisedUrls", "=", "$", "this", "->", "getNormalizedUrls", "(", "$", "url", ")", ";",...
Returns the list of websites ID associated with a URL. @param string $url @return array list of websites ID
[ "Returns", "the", "list", "of", "websites", "ID", "associated", "with", "a", "URL", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L515-L528
train
Returns the list of websites id from a given URL.
[ 30522, 2270, 3853, 4152, 7616, 3593, 19699, 22225, 4221, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1063, 1002, 24471, 2140, 1027, 1002, 2023, 1011, 1028, 6366, 6494, 16281, 14540, 11823, 1006, 1002, 24471, 2140, 1007, 1025, 1002, 3671, 508...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Adapter/Oracle.php
Zend_Db_Adapter_Oracle._connect
protected function _connect() { if (is_resource($this->_connection)) { // connection already exists return; } if (!extension_loaded('oci8')) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but the extension is not loaded'); } $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); $connectionFuncName = ($this->_config['persistent'] == true) ? 'oci_pconnect' : 'oci_connect'; $this->_connection = @$connectionFuncName( $this->_config['username'], $this->_config['password'], $this->_config['dbname'], $this->_config['charset']); // check the connection if (!$this->_connection) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception(oci_error()); } }
php
protected function _connect() { if (is_resource($this->_connection)) { // connection already exists return; } if (!extension_loaded('oci8')) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but the extension is not loaded'); } $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); $connectionFuncName = ($this->_config['persistent'] == true) ? 'oci_pconnect' : 'oci_connect'; $this->_connection = @$connectionFuncName( $this->_config['username'], $this->_config['password'], $this->_config['dbname'], $this->_config['charset']); // check the connection if (!$this->_connection) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception(oci_error()); } }
[ "protected", "function", "_connect", "(", ")", "{", "if", "(", "is_resource", "(", "$", "this", "->", "_connection", ")", ")", "{", "// connection already exists", "return", ";", "}", "if", "(", "!", "extension_loaded", "(", "'oci8'", ")", ")", "{", "/**\n...
Creates a connection resource. @return void @throws Zend_Db_Adapter_Oracle_Exception
[ "Creates", "a", "connection", "resource", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Oracle.php#L107-L140
train
Connect to the database using the OCI8 extension
[ 30522, 5123, 3853, 1035, 7532, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 7692, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 1007, 1007, 1063, 1013, 1013, 4434, 2525, 6526, 2709, 1025, 1065, 2065, 1006, 999, 5331, 1035, 8209, 1006, 1005, 1051...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Assets/Pipeline.php
Pipeline.renderCss
public function renderCss($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); } // Store Attributes $this->attributes = array_merge(['type' => 'text/css', 'rel' => 'stylesheet'], $attributes); // Compute uid based on assets and timestamp $json_assets = json_encode($assets); $uid = md5($json_assets . $this->css_minify . $this->css_rewrite . $group); $file = $uid . '.css'; $relative_path = "{$this->base_url}{$this->assets_url}/{$file}"; $buffer = null; if (file_exists($this->assets_dir . $file)) { $buffer = file_get_contents($this->assets_dir . $file) . "\n"; } else { //if nothing found get out of here! if (empty($assets)) { return false; } // Concatenate files $buffer = $this->gatherLinks($assets, self::CSS_ASSET); // Minify if required if ($this->shouldMinify('css')) { $minifier = new \MatthiasMullie\Minify\CSS(); $minifier->add($buffer); $buffer = $minifier->minify(); } // Write file if (trim($buffer) !== '') { file_put_contents($this->assets_dir . $file, $buffer); } } if ($inline_group) { $output = "<style>\n" . $buffer . "\n</style>\n"; } else { $this->asset = $relative_path; $output = '<link href="' . $relative_path . $this->renderQueryString() . '"' . $this->renderAttributes() . ">\n"; } return $output; }
php
public function renderCss($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); } // Store Attributes $this->attributes = array_merge(['type' => 'text/css', 'rel' => 'stylesheet'], $attributes); // Compute uid based on assets and timestamp $json_assets = json_encode($assets); $uid = md5($json_assets . $this->css_minify . $this->css_rewrite . $group); $file = $uid . '.css'; $relative_path = "{$this->base_url}{$this->assets_url}/{$file}"; $buffer = null; if (file_exists($this->assets_dir . $file)) { $buffer = file_get_contents($this->assets_dir . $file) . "\n"; } else { //if nothing found get out of here! if (empty($assets)) { return false; } // Concatenate files $buffer = $this->gatherLinks($assets, self::CSS_ASSET); // Minify if required if ($this->shouldMinify('css')) { $minifier = new \MatthiasMullie\Minify\CSS(); $minifier->add($buffer); $buffer = $minifier->minify(); } // Write file if (trim($buffer) !== '') { file_put_contents($this->assets_dir . $file, $buffer); } } if ($inline_group) { $output = "<style>\n" . $buffer . "\n</style>\n"; } else { $this->asset = $relative_path; $output = '<link href="' . $relative_path . $this->renderQueryString() . '"' . $this->renderAttributes() . ">\n"; } return $output; }
[ "public", "function", "renderCss", "(", "$", "assets", ",", "$", "group", ",", "$", "attributes", "=", "[", "]", ")", "{", "// temporary list of assets to pipeline", "$", "inline_group", "=", "false", ";", "if", "(", "array_key_exists", "(", "'loading'", ",", ...
Minify and concatenate CSS @param array $assets @param string $group @param array $attributes @return bool|string URL or generated content if available, else false
[ "Minify", "and", "concatenate", "CSS" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Pipeline.php#L94-L147
train
Render css assets
[ 30522, 2270, 3853, 17552, 6169, 2015, 1006, 1002, 7045, 1010, 1002, 2177, 1010, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 1013, 1013, 5741, 2862, 1997, 7045, 2000, 13117, 1002, 23881, 1035, 2177, 1027, 6270, 1025, 2065, 1006, 9140, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/console/OctoberUtil.php
OctoberUtil.handle
public function handle() { $command = implode(' ', (array) $this->argument('name')); $method = 'util'.studly_case($command); $methods = preg_grep('/^util/', get_class_methods(get_called_class())); $list = array_map(function ($item) { return "october:".snake_case($item, " "); }, $methods); if (!$this->argument('name')) { $message = 'There are no commands defined in the "util" namespace.'; if (1 == count($list)) { $message .= "\n\nDid you mean this?\n "; } else { $message .= "\n\nDid you mean one of these?\n "; } $message .= implode("\n ", $list); throw new \InvalidArgumentException($message); } if (!method_exists($this, $method)) { $this->error(sprintf('Utility command "%s" does not exist!', $command)); return; } $this->$method(); }
php
public function handle() { $command = implode(' ', (array) $this->argument('name')); $method = 'util'.studly_case($command); $methods = preg_grep('/^util/', get_class_methods(get_called_class())); $list = array_map(function ($item) { return "october:".snake_case($item, " "); }, $methods); if (!$this->argument('name')) { $message = 'There are no commands defined in the "util" namespace.'; if (1 == count($list)) { $message .= "\n\nDid you mean this?\n "; } else { $message .= "\n\nDid you mean one of these?\n "; } $message .= implode("\n ", $list); throw new \InvalidArgumentException($message); } if (!method_exists($this, $method)) { $this->error(sprintf('Utility command "%s" does not exist!', $command)); return; } $this->$method(); }
[ "public", "function", "handle", "(", ")", "{", "$", "command", "=", "implode", "(", "' '", ",", "(", "array", ")", "$", "this", "->", "argument", "(", "'name'", ")", ")", ";", "$", "method", "=", "'util'", ".", "studly_case", "(", "$", "command", "...
Execute the console command.
[ "Execute", "the", "console", "command", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/OctoberUtil.php#L54-L82
train
Handle the current request
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 3094, 1027, 17727, 4135, 3207, 1006, 1005, 1005, 1010, 1006, 9140, 1007, 1002, 2023, 1011, 1028, 6685, 1006, 1005, 2171, 1005, 1007, 1007, 1025, 1002, 4118, 1027, 1005, 21183, 4014, 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...
matomo-org/matomo
core/DataTable/Row.php
Row.addMetadata
public function addMetadata($name, $value) { if (isset($this->metadata[$name])) { throw new Exception("Metadata $name already in the array!"); } $this->setMetadata($name, $value); }
php
public function addMetadata($name, $value) { if (isset($this->metadata[$name])) { throw new Exception("Metadata $name already in the array!"); } $this->setMetadata($name, $value); }
[ "public", "function", "addMetadata", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "metadata", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "Exception", "(", "\"Metadata $name already in the array!\"", ...
Add a new metadata to the row. If the metadata already exists, throws an exception. @param string $name name of the metadata to add. @param mixed $value value of the metadata to set. @throws Exception if the metadata already exists.
[ "Add", "a", "new", "metadata", "to", "the", "row", ".", "If", "the", "metadata", "already", "exists", "throws", "an", "exception", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Row.php#L427-L433
train
Add metadata to the array
[ 30522, 2270, 3853, 5587, 11368, 8447, 2696, 1006, 1002, 2171, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 27425, 1031, 1002, 2171, 1033, 1007, 1007, 1063, 30524, 1000, 27425, 1002, 2171, 2525, 1999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Form/DataTransformer/CollectionToArrayTransformer.php
CollectionToArrayTransformer.transform
public function transform($collection) { if (null === $collection) { return []; } // For cases when the collection getter returns $collection->toArray() // in order to prevent modifications of the returned collection if (\is_array($collection)) { return $collection; } if (!$collection instanceof Collection) { throw new TransformationFailedException('Expected a Doctrine\Common\Collections\Collection object.'); } return $collection->toArray(); }
php
public function transform($collection) { if (null === $collection) { return []; } // For cases when the collection getter returns $collection->toArray() // in order to prevent modifications of the returned collection if (\is_array($collection)) { return $collection; } if (!$collection instanceof Collection) { throw new TransformationFailedException('Expected a Doctrine\Common\Collections\Collection object.'); } return $collection->toArray(); }
[ "public", "function", "transform", "(", "$", "collection", ")", "{", "if", "(", "null", "===", "$", "collection", ")", "{", "return", "[", "]", ";", "}", "// For cases when the collection getter returns $collection->toArray()", "// in order to prevent modifications of the...
Transforms a collection into an array. @return mixed An array of entities @throws TransformationFailedException
[ "Transforms", "a", "collection", "into", "an", "array", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php#L31-L48
train
Transforms a Collection object into an array
[ 30522, 2270, 3853, 10938, 1006, 1002, 3074, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3074, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 1013, 1013, 2005, 3572, 2043, 1996, 3074, 2131, 3334, 5651, 1002, 3074, 1011, 1028, 2000, 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/Ldap/Adapter/ExtLdap/Adapter.php
Adapter.createQuery
public function createQuery($dn, $query, array $options = []) { return new Query($this->getConnection(), $dn, $query, $options); }
php
public function createQuery($dn, $query, array $options = []) { return new Query($this->getConnection(), $dn, $query, $options); }
[ "public", "function", "createQuery", "(", "$", "dn", ",", "$", "query", ",", "array", "$", "options", "=", "[", "]", ")", "{", "return", "new", "Query", "(", "$", "this", "->", "getConnection", "(", ")", ",", "$", "dn", ",", "$", "query", ",", "$...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php#L62-L65
train
Create a new Query object
[ 30522, 2270, 30524, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Provider/Client.php
Client.getRegisterUri
public function getRegisterUri(string $registerCode = '') { $registerCode || $registerCode = $this->getRegisterCode()['register_code']; $params = ['register_code' => $registerCode]; return 'https://open.work.weixin.qq.com/3rdservice/wework/register?'.http_build_query($params); }
php
public function getRegisterUri(string $registerCode = '') { $registerCode || $registerCode = $this->getRegisterCode()['register_code']; $params = ['register_code' => $registerCode]; return 'https://open.work.weixin.qq.com/3rdservice/wework/register?'.http_build_query($params); }
[ "public", "function", "getRegisterUri", "(", "string", "$", "registerCode", "=", "''", ")", "{", "$", "registerCode", "||", "$", "registerCode", "=", "$", "this", "->", "getRegisterCode", "(", ")", "[", "'register_code'", "]", ";", "$", "params", "=", "[",...
获取注册定制化URL. @param string $registerCode @return string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "获取注册定制化URL", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenWork/Provider/Client.php#L85-L91
train
Get URI for register code
[ 30522, 2270, 3853, 2131, 2890, 24063, 2121, 9496, 1006, 5164, 1002, 4236, 16044, 1027, 1005, 1005, 1007, 1063, 1002, 4236, 16044, 1064, 1064, 1002, 4236, 16044, 1027, 1002, 2023, 1011, 1028, 2131, 2890, 24063, 2121, 16044, 1006, 1007, 1031,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
MySqlGrammar.modifyCharset
protected function modifyCharset(Blueprint $blueprint, Fluent $column) { if (! is_null($column->charset)) { return ' character set '.$column->charset; } }
php
protected function modifyCharset(Blueprint $blueprint, Fluent $column) { if (! is_null($column->charset)) { return ' character set '.$column->charset; } }
[ "protected", "function", "modifyCharset", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "column", ")", "{", "if", "(", "!", "is_null", "(", "$", "column", "->", "charset", ")", ")", "{", "return", "' character set '", ".", "$", "column", "->", ...
Get the SQL for a character set column modifier. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $column @return string|null
[ "Get", "the", "SQL", "for", "a", "character", "set", "column", "modifier", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L912-L917
train
Protected modify charset
[ 30522, 5123, 3853, 19933, 7507, 22573, 2102, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 5930, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 5930, 1011, 1028, 25869, 13462, 1007, 1007, 1063, 2709, 1005, 2839, 2275...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Session.php
Session.invalidate
public function invalidate($lifetime = null) { $this->storage->clear(); return $this->migrate(true, $lifetime); }
php
public function invalidate($lifetime = null) { $this->storage->clear(); return $this->migrate(true, $lifetime); }
[ "public", "function", "invalidate", "(", "$", "lifetime", "=", "null", ")", "{", "$", "this", "->", "storage", "->", "clear", "(", ")", ";", "return", "$", "this", "->", "migrate", "(", "true", ",", "$", "lifetime", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Session.php#L176-L181
train
Invalidate all cache entries
[ 30522, 2270, 3853, 19528, 3686, 1006, 1002, 6480, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 5527, 1011, 1028, 3154, 1006, 1007, 1025, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Page.php
Page.maxCount
public function maxCount($var = null) { //user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED); if ($var !== null) { $this->max_count = (int)$var; } if (empty($this->max_count)) { /** @var Config $config */ $config = Grav::instance()['config']; $this->max_count = (int)$config->get('system.pages.list.count'); } return $this->max_count; }
php
public function maxCount($var = null) { //user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED); if ($var !== null) { $this->max_count = (int)$var; } if (empty($this->max_count)) { /** @var Config $config */ $config = Grav::instance()['config']; $this->max_count = (int)$config->get('system.pages.list.count'); } return $this->max_count; }
[ "public", "function", "maxCount", "(", "$", "var", "=", "null", ")", "{", "//user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "max_count", "=", "(",...
Gets and sets the maxCount field which describes how many sub-pages should be displayed if the sub_pages header property is set for this page object. @param int $var the maximum number of sub-pages @return int the maximum number of sub-pages @deprecated 1.6
[ "Gets", "and", "sets", "the", "maxCount", "field", "which", "describes", "how", "many", "sub", "-", "pages", "should", "be", "displayed", "if", "the", "sub_pages", "header", "property", "is", "set", "for", "this", "page", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2271-L2285
train
Get max count of pages
[ 30522, 2270, 3853, 4098, 3597, 16671, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 1013, 1013, 5310, 1035, 7561, 1006, 1035, 1035, 2465, 1035, 1035, 1012, 1005, 1024, 1024, 1005, 1012, 1035, 1035, 3853, 1035, 1035, 1012, 1005, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
CachePoolDeleteCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $pool = $input->getArgument('pool'); $key = $input->getArgument('key'); $cachePool = $this->poolClearer->getPool($pool); if (!$cachePool->hasItem($key)) { $io->note(sprintf('Cache item "%s" does not exist in cache pool "%s".', $key, $pool)); return; } if (!$cachePool->deleteItem($key)) { throw new \Exception(sprintf('Cache item "%s" could not be deleted.', $key)); } $io->success(sprintf('Cache item "%s" was successfully deleted.', $key)); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $pool = $input->getArgument('pool'); $key = $input->getArgument('key'); $cachePool = $this->poolClearer->getPool($pool); if (!$cachePool->hasItem($key)) { $io->note(sprintf('Cache item "%s" does not exist in cache pool "%s".', $key, $pool)); return; } if (!$cachePool->deleteItem($key)) { throw new \Exception(sprintf('Cache item "%s" could not be deleted.', $key)); } $io->success(sprintf('Cache item "%s" was successfully deleted.', $key)); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "pool", "=", "$", "input", "->", "get...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php#L62-L80
train
Delete a cache item
[ 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, 7953, 1010, 1002, 6434, 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...
matomo-org/matomo
core/DataAccess/LogAggregator.php
LogAggregator.queryVisitsByDimension
public function queryVisitsByDimension(array $dimensions = array(), $where = false, array $additionalSelects = array(), $metrics = false, $rankingQuery = false) { $tableName = self::LOG_VISIT_TABLE; $availableMetrics = $this->getVisitsMetricFields(); $select = $this->getSelectStatement($dimensions, $tableName, $additionalSelects, $availableMetrics, $metrics); $from = array($tableName); $where = $this->getWhereStatement($tableName, self::VISIT_DATETIME_FIELD, $where); $groupBy = $this->getGroupByStatement($dimensions, $tableName); $orderBy = false; if ($rankingQuery) { $orderBy = '`' . Metrics::INDEX_NB_VISITS . '` DESC'; } $query = $this->generateQuery($select, $from, $where, $groupBy, $orderBy); if ($rankingQuery) { unset($availableMetrics[Metrics::INDEX_MAX_ACTIONS]); $sumColumns = array_keys($availableMetrics); if ($metrics) { $sumColumns = array_intersect($sumColumns, $metrics); } $rankingQuery->addColumn($sumColumns, 'sum'); if ($this->isMetricRequested(Metrics::INDEX_MAX_ACTIONS, $metrics)) { $rankingQuery->addColumn(Metrics::INDEX_MAX_ACTIONS, 'max'); } return $rankingQuery->execute($query['sql'], $query['bind']); } return $this->getDb()->query($query['sql'], $query['bind']); }
php
public function queryVisitsByDimension(array $dimensions = array(), $where = false, array $additionalSelects = array(), $metrics = false, $rankingQuery = false) { $tableName = self::LOG_VISIT_TABLE; $availableMetrics = $this->getVisitsMetricFields(); $select = $this->getSelectStatement($dimensions, $tableName, $additionalSelects, $availableMetrics, $metrics); $from = array($tableName); $where = $this->getWhereStatement($tableName, self::VISIT_DATETIME_FIELD, $where); $groupBy = $this->getGroupByStatement($dimensions, $tableName); $orderBy = false; if ($rankingQuery) { $orderBy = '`' . Metrics::INDEX_NB_VISITS . '` DESC'; } $query = $this->generateQuery($select, $from, $where, $groupBy, $orderBy); if ($rankingQuery) { unset($availableMetrics[Metrics::INDEX_MAX_ACTIONS]); $sumColumns = array_keys($availableMetrics); if ($metrics) { $sumColumns = array_intersect($sumColumns, $metrics); } $rankingQuery->addColumn($sumColumns, 'sum'); if ($this->isMetricRequested(Metrics::INDEX_MAX_ACTIONS, $metrics)) { $rankingQuery->addColumn(Metrics::INDEX_MAX_ACTIONS, 'max'); } return $rankingQuery->execute($query['sql'], $query['bind']); } return $this->getDb()->query($query['sql'], $query['bind']); }
[ "public", "function", "queryVisitsByDimension", "(", "array", "$", "dimensions", "=", "array", "(", ")", ",", "$", "where", "=", "false", ",", "array", "$", "additionalSelects", "=", "array", "(", ")", ",", "$", "metrics", "=", "false", ",", "$", "rankin...
Executes and returns a query aggregating visit logs, optionally grouping by some dimension. Returns a DB statement that can be used to iterate over the result **Result Set** The following columns are in each row of the result set: - **{@link Piwik\Metrics::INDEX_NB_UNIQ_VISITORS}**: The total number of unique visitors in this group of aggregated visits. - **{@link Piwik\Metrics::INDEX_NB_VISITS}**: The total number of visits aggregated. - **{@link Piwik\Metrics::INDEX_NB_ACTIONS}**: The total number of actions performed in this group of aggregated visits. - **{@link Piwik\Metrics::INDEX_MAX_ACTIONS}**: The maximum actions perfomred in one visit for this group of visits. - **{@link Piwik\Metrics::INDEX_SUM_VISIT_LENGTH}**: The total amount of time spent on the site for this group of visits. - **{@link Piwik\Metrics::INDEX_BOUNCE_COUNT}**: The total number of bounced visits in this group of visits. - **{@link Piwik\Metrics::INDEX_NB_VISITS_CONVERTED}**: The total number of visits for which at least one conversion occurred, for this group of visits. Additional data can be selected by setting the `$additionalSelects` parameter. _Note: The metrics returned by this query can be customized by the `$metrics` parameter._ @param array|string $dimensions `SELECT` fields (or just one field) that will be grouped by, eg, `'referrer_name'` or `array('referrer_name', 'referrer_keyword')`. The metrics retrieved from the query will be specific to combinations of these fields. So if `array('referrer_name', 'referrer_keyword')` is supplied, the query will aggregate visits for each referrer/keyword combination. @param bool|string $where Additional condition for the `WHERE` clause. Can be used to filter the set of visits that are considered for aggregation. @param array $additionalSelects Additional `SELECT` fields that are not included in the group by clause. These can be aggregate expressions, eg, `SUM(somecol)`. @param bool|array $metrics The set of metrics to calculate and return. If false, the query will select all of them. The following values can be used: - {@link Piwik\Metrics::INDEX_NB_UNIQ_VISITORS} - {@link Piwik\Metrics::INDEX_NB_VISITS} - {@link Piwik\Metrics::INDEX_NB_ACTIONS} - {@link Piwik\Metrics::INDEX_MAX_ACTIONS} - {@link Piwik\Metrics::INDEX_SUM_VISIT_LENGTH} - {@link Piwik\Metrics::INDEX_BOUNCE_COUNT} - {@link Piwik\Metrics::INDEX_NB_VISITS_CONVERTED} @param bool|\Piwik\RankingQuery $rankingQuery A pre-configured ranking query instance that will be used to limit the result. If set, the return value is the array returned by {@link Piwik\RankingQuery::execute()}. @return mixed A Zend_Db_Statement if `$rankingQuery` isn't supplied, otherwise the result of {@link Piwik\RankingQuery::execute()}. Read {@link queryVisitsByDimension() this} to see what aggregate data is calculated by the query. @api
[ "Executes", "and", "returns", "a", "query", "aggregating", "visit", "logs", "optionally", "grouping", "by", "some", "dimension", ".", "Returns", "a", "DB", "statement", "that", "can", "be", "used", "to", "iterate", "over", "the", "result" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/LogAggregator.php#L326-L361
train
Queries visits by dimension
[ 30522, 2270, 3853, 23032, 11365, 12762, 3762, 22172, 6132, 3258, 1006, 9140, 1002, 9646, 1027, 9140, 1006, 1007, 1010, 1002, 2073, 1027, 6270, 1010, 9140, 1002, 3176, 11246, 22471, 2015, 1027, 9140, 1006, 1007, 1010, 30524, 1002, 2800, 1258...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Http/Concerns/InteractsWithFlashData.php
InteractsWithFlashData.flashExcept
public function flashExcept($keys) { $this->session()->flashInput( $this->except(is_array($keys) ? $keys : func_get_args()) ); }
php
public function flashExcept($keys) { $this->session()->flashInput( $this->except(is_array($keys) ? $keys : func_get_args()) ); }
[ "public", "function", "flashExcept", "(", "$", "keys", ")", "{", "$", "this", "->", "session", "(", ")", "->", "flashInput", "(", "$", "this", "->", "except", "(", "is_array", "(", "$", "keys", ")", "?", "$", "keys", ":", "func_get_args", "(", ")", ...
Flash only some of the input to the session. @param array|mixed $keys @return void
[ "Flash", "only", "some", "of", "the", "input", "to", "the", "session", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Concerns/InteractsWithFlashData.php#L48-L53
train
Flash the input except the given keys.
[ 30522, 2270, 3853, 5956, 10288, 3401, 13876, 1006, 1002, 6309, 1007, 1063, 1002, 2023, 1011, 1028, 5219, 1006, 1007, 1011, 1028, 5956, 2378, 18780, 1006, 1002, 2023, 1011, 1028, 3272, 1006, 2003, 1035, 9140, 1006, 1002, 6309, 1007, 1029, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/WriteCacheFileTrait.php
WriteCacheFileTrait.writeCacheFile
protected function writeCacheFile($file, $content) { if (empty($file)) { return; } if (!isset(self::$umask)) { self::$umask = Grav::instance()['config']->get('system.twig.umask_fix', false); } if (self::$umask) { $dir = dirname($file); if (!is_dir($dir)) { $old = umask(0002); Folder::create($dir); umask($old); } parent::writeCacheFile($file, $content); chmod($file, 0775); } else { parent::writeCacheFile($file, $content); } }
php
protected function writeCacheFile($file, $content) { if (empty($file)) { return; } if (!isset(self::$umask)) { self::$umask = Grav::instance()['config']->get('system.twig.umask_fix', false); } if (self::$umask) { $dir = dirname($file); if (!is_dir($dir)) { $old = umask(0002); Folder::create($dir); umask($old); } parent::writeCacheFile($file, $content); chmod($file, 0775); } else { parent::writeCacheFile($file, $content); } }
[ "protected", "function", "writeCacheFile", "(", "$", "file", ",", "$", "content", ")", "{", "if", "(", "empty", "(", "$", "file", ")", ")", "{", "return", ";", "}", "if", "(", "!", "isset", "(", "self", "::", "$", "umask", ")", ")", "{", "self", ...
This exists so template cache files use the same group between apache and cli @param string $file @param string $content
[ "This", "exists", "so", "template", "cache", "files", "use", "the", "same", "group", "between", "apache", "and", "cli" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/WriteCacheFileTrait.php#L26-L48
train
Write cache file
[ 30522, 5123, 3853, 4339, 3540, 5403, 8873, 2571, 1006, 1002, 5371, 1010, 1002, 4180, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 5371, 1007, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 999, 26354, 3388, 1006, 2969, 1024, 1024, 1002, 8529, 198...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Console/ResourceGenerator.php
ResourceGenerator.getModel
protected function getModel($model) { if ($model instanceof Model) { return $model; } if (!class_exists($model) || !is_string($model) || !is_subclass_of($model, Model::class)) { throw new \InvalidArgumentException("Invalid model [$model] !"); } return new $model(); }
php
protected function getModel($model) { if ($model instanceof Model) { return $model; } if (!class_exists($model) || !is_string($model) || !is_subclass_of($model, Model::class)) { throw new \InvalidArgumentException("Invalid model [$model] !"); } return new $model(); }
[ "protected", "function", "getModel", "(", "$", "model", ")", "{", "if", "(", "$", "model", "instanceof", "Model", ")", "{", "return", "$", "model", ";", "}", "if", "(", "!", "class_exists", "(", "$", "model", ")", "||", "!", "is_string", "(", "$", ...
@param mixed $model @return mixed
[ "@param", "mixed", "$model" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ResourceGenerator.php#L63-L74
train
Get Model Object
[ 30522, 5123, 3853, 2131, 5302, 9247, 1006, 1002, 2944, 1007, 1063, 2065, 1006, 1002, 2944, 6013, 11253, 2944, 1007, 1063, 2709, 1002, 2944, 1025, 1065, 2065, 1006, 999, 2465, 1035, 6526, 1006, 1002, 2944, 1007, 1064, 1064, 999, 2003, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.applyHttpAttributes
protected function applyHttpAttributes($http, $postData) { $postData['protocol_version'] = '1.1'; $postData['client'] = 'october'; $postData['server'] = base64_encode(serialize([ 'php' => PHP_VERSION, 'url' => Url::to('/'), 'since' => PluginVersion::orderBy('created_at')->value('created_at') ])); if ($projectId = Parameter::get('system::project.id')) { $postData['project'] = $projectId; } if (Config::get('cms.edgeUpdates', false)) { $postData['edge'] = 1; } if ($this->key && $this->secret) { $postData['nonce'] = $this->createNonce(); $http->header('Rest-Key', $this->key); $http->header('Rest-Sign', $this->createSignature($postData, $this->secret)); } if ($credentials = Config::get('cms.updateAuth')) { $http->auth($credentials); } $http->noRedirect(); $http->data($postData); }
php
protected function applyHttpAttributes($http, $postData) { $postData['protocol_version'] = '1.1'; $postData['client'] = 'october'; $postData['server'] = base64_encode(serialize([ 'php' => PHP_VERSION, 'url' => Url::to('/'), 'since' => PluginVersion::orderBy('created_at')->value('created_at') ])); if ($projectId = Parameter::get('system::project.id')) { $postData['project'] = $projectId; } if (Config::get('cms.edgeUpdates', false)) { $postData['edge'] = 1; } if ($this->key && $this->secret) { $postData['nonce'] = $this->createNonce(); $http->header('Rest-Key', $this->key); $http->header('Rest-Sign', $this->createSignature($postData, $this->secret)); } if ($credentials = Config::get('cms.updateAuth')) { $http->auth($credentials); } $http->noRedirect(); $http->data($postData); }
[ "protected", "function", "applyHttpAttributes", "(", "$", "http", ",", "$", "postData", ")", "{", "$", "postData", "[", "'protocol_version'", "]", "=", "'1.1'", ";", "$", "postData", "[", "'client'", "]", "=", "'october'", ";", "$", "postData", "[", "'serv...
Modifies the Network HTTP object with common attributes. @param Http $http Network object @param array $postData Post data @return void
[ "Modifies", "the", "Network", "HTTP", "object", "with", "common", "attributes", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L920-L951
train
Apply HTTP attributes to the response
[ 30522, 5123, 3853, 6611, 11039, 25856, 19321, 3089, 8569, 4570, 1006, 1002, 8299, 1010, 1002, 2695, 2850, 2696, 1007, 1063, 1002, 2695, 2850, 2696, 1031, 1005, 8778, 1035, 2544, 1005, 1033, 1027, 1005, 1015, 1012, 1015, 1005, 1025, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/helpers/File.php
File.validateExtension
public static function validateExtension($fileName, $allowedExtensions, $allowEmpty = true) { $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); if (empty($extension)) { return $allowEmpty; } return in_array($extension, $allowedExtensions); }
php
public static function validateExtension($fileName, $allowedExtensions, $allowEmpty = true) { $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); if (empty($extension)) { return $allowEmpty; } return in_array($extension, $allowedExtensions); }
[ "public", "static", "function", "validateExtension", "(", "$", "fileName", ",", "$", "allowedExtensions", ",", "$", "allowEmpty", "=", "true", ")", "{", "$", "extension", "=", "strtolower", "(", "pathinfo", "(", "$", "fileName", ",", "PATHINFO_EXTENSION", ")",...
Validates whether a file has an allowed extension. @param string $fileName Specifies a path to validate @param array $allowedExtensions A list of allowed file extensions @param boolean $allowEmpty Determines whether the file extension could be empty. @return boolean Returns true if the file extension is valid. Otherwise returns false.
[ "Validates", "whether", "a", "file", "has", "an", "allowed", "extension", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/helpers/File.php#L30-L38
train
Validate file extension
[ 30522, 2270, 10763, 3853, 9398, 3686, 10288, 29048, 1006, 1002, 5371, 18442, 1010, 1002, 3039, 10288, 29048, 2015, 1010, 1002, 3499, 6633, 13876, 2100, 1027, 2995, 1007, 1063, 1002, 5331, 1027, 2358, 5339, 12898, 13777, 1006, 4130, 2378, 14...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
PropertyNormalizer.supports
private function supports(string $class): bool { $class = new \ReflectionClass($class); // We look for at least one non-static property do { foreach ($class->getProperties() as $property) { if (!$property->isStatic()) { return true; } } } while ($class = $class->getParentClass()); return false; }
php
private function supports(string $class): bool { $class = new \ReflectionClass($class); // We look for at least one non-static property do { foreach ($class->getProperties() as $property) { if (!$property->isStatic()) { return true; } } } while ($class = $class->getParentClass()); return false; }
[ "private", "function", "supports", "(", "string", "$", "class", ")", ":", "bool", "{", "$", "class", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "// We look for at least one non-static property", "do", "{", "foreach", "(", "$", "class", ...
Checks if the given class has any non-static property.
[ "Checks", "if", "the", "given", "class", "has", "any", "non", "-", "static", "property", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php#L60-L74
train
Checks if a class supports static properties
[ 30522, 2797, 3853, 6753, 1006, 5164, 1002, 2465, 1007, 1024, 22017, 2140, 1063, 1002, 2465, 1027, 2047, 1032, 9185, 26266, 1006, 1002, 2465, 1007, 1025, 1013, 1013, 2057, 2298, 2005, 2012, 2560, 2028, 2512, 1011, 10763, 3200, 2079, 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
core/DataTable/Renderer/Html.php
Html.buildTableStructure
protected function buildTableStructure($table, $columnToAdd = null, $valueToAdd = null) { $i = $this->i; $someMetadata = false; $someIdSubTable = false; /* * table = array * ROW1 = col1 | col2 | col3 | metadata | idSubTable * ROW2 = col1 | col2 (no value but appears) | col3 | metadata | idSubTable */ if (!($table instanceof DataTable)) { throw new Exception("HTML Renderer does not work with this combination of parameters"); } foreach ($table->getRows() as $row) { if (isset($columnToAdd) && isset($valueToAdd)) { $this->allColumns[$columnToAdd] = true; $this->tableStructure[$i][$columnToAdd] = $valueToAdd; } foreach ($row->getColumns() as $column => $value) { $this->allColumns[$column] = true; $this->tableStructure[$i][$column] = $value; } $metadata = array(); foreach ($row->getMetadata() as $name => $value) { if (is_string($value)) { $value = "'$value'"; } else if (is_array($value)) { $value = var_export($value, true); } $metadata[] = "'$name' => $value"; } if (count($metadata) != 0) { $someMetadata = true; $metadata = implode("<br />", $metadata); $this->tableStructure[$i]['_metadata'] = $metadata; } $idSubtable = $row->getIdSubDataTable(); if (!is_null($idSubtable)) { $someIdSubTable = true; $this->tableStructure[$i]['_idSubtable'] = $idSubtable; } $i++; } $this->i = $i; $this->allColumns['_metadata'] = $someMetadata; $this->allColumns['_idSubtable'] = $someIdSubTable; }
php
protected function buildTableStructure($table, $columnToAdd = null, $valueToAdd = null) { $i = $this->i; $someMetadata = false; $someIdSubTable = false; /* * table = array * ROW1 = col1 | col2 | col3 | metadata | idSubTable * ROW2 = col1 | col2 (no value but appears) | col3 | metadata | idSubTable */ if (!($table instanceof DataTable)) { throw new Exception("HTML Renderer does not work with this combination of parameters"); } foreach ($table->getRows() as $row) { if (isset($columnToAdd) && isset($valueToAdd)) { $this->allColumns[$columnToAdd] = true; $this->tableStructure[$i][$columnToAdd] = $valueToAdd; } foreach ($row->getColumns() as $column => $value) { $this->allColumns[$column] = true; $this->tableStructure[$i][$column] = $value; } $metadata = array(); foreach ($row->getMetadata() as $name => $value) { if (is_string($value)) { $value = "'$value'"; } else if (is_array($value)) { $value = var_export($value, true); } $metadata[] = "'$name' => $value"; } if (count($metadata) != 0) { $someMetadata = true; $metadata = implode("<br />", $metadata); $this->tableStructure[$i]['_metadata'] = $metadata; } $idSubtable = $row->getIdSubDataTable(); if (!is_null($idSubtable)) { $someIdSubTable = true; $this->tableStructure[$i]['_idSubtable'] = $idSubtable; } $i++; } $this->i = $i; $this->allColumns['_metadata'] = $someMetadata; $this->allColumns['_idSubtable'] = $someIdSubTable; }
[ "protected", "function", "buildTableStructure", "(", "$", "table", ",", "$", "columnToAdd", "=", "null", ",", "$", "valueToAdd", "=", "null", ")", "{", "$", "i", "=", "$", "this", "->", "i", ";", "$", "someMetadata", "=", "false", ";", "$", "someIdSubT...
Adds the given data table to the table structure array @param DataTable $table @param null|string $columnToAdd @param null|string $valueToAdd @throws Exception
[ "Adds", "the", "given", "data", "table", "to", "the", "table", "structure", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Html.php#L91-L144
train
Build the table structure
[ 30522, 5123, 3853, 3857, 10880, 3367, 6820, 14890, 1006, 1002, 2795, 1010, 1002, 5930, 3406, 4215, 2094, 1027, 19701, 30524, 1002, 2070, 11368, 8447, 2696, 1027, 6270, 1025, 1002, 2070, 9821, 12083, 10880, 1027, 6270, 1025, 1013, 1008, 1008...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MarkupManager.php
MarkupManager.isWildCallable
protected function isWildCallable($callable, $replaceWith = false) { $isWild = false; if (is_string($callable) && strpos($callable, '*') !== false) { $isWild = $replaceWith ? str_replace('*', $replaceWith, $callable) : true; } if (is_array($callable)) { if (is_string($callable[0]) && strpos($callable[0], '*') !== false) { if ($replaceWith) { $isWild = $callable; $isWild[0] = str_replace('*', $replaceWith, $callable[0]); } else { $isWild = true; } } if (!empty($callable[1]) && strpos($callable[1], '*') !== false) { if ($replaceWith) { $isWild = $isWild ?: $callable; $isWild[1] = str_replace('*', $replaceWith, $callable[1]); } else { $isWild = true; } } } return $isWild; }
php
protected function isWildCallable($callable, $replaceWith = false) { $isWild = false; if (is_string($callable) && strpos($callable, '*') !== false) { $isWild = $replaceWith ? str_replace('*', $replaceWith, $callable) : true; } if (is_array($callable)) { if (is_string($callable[0]) && strpos($callable[0], '*') !== false) { if ($replaceWith) { $isWild = $callable; $isWild[0] = str_replace('*', $replaceWith, $callable[0]); } else { $isWild = true; } } if (!empty($callable[1]) && strpos($callable[1], '*') !== false) { if ($replaceWith) { $isWild = $isWild ?: $callable; $isWild[1] = str_replace('*', $replaceWith, $callable[1]); } else { $isWild = true; } } } return $isWild; }
[ "protected", "function", "isWildCallable", "(", "$", "callable", ",", "$", "replaceWith", "=", "false", ")", "{", "$", "isWild", "=", "false", ";", "if", "(", "is_string", "(", "$", "callable", ")", "&&", "strpos", "(", "$", "callable", ",", "'*'", ")"...
Tests if a callable type contains a wildcard, also acts as a utility to replace the wildcard with a string. @param callable $callable @param string|bool $replaceWith @return mixed
[ "Tests", "if", "a", "callable", "type", "contains", "a", "wildcard", "also", "acts", "as", "a", "utility", "to", "replace", "the", "wildcard", "with", "a", "string", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MarkupManager.php#L316-L347
train
Is the callable wild?
[ 30522, 5123, 3853, 2003, 29602, 16409, 25425, 3468, 1006, 1002, 2655, 3085, 1010, 1002, 5672, 24415, 1027, 6270, 1007, 1063, 1002, 2003, 29602, 2094, 1027, 6270, 1025, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 2655, 3085, 1007, 1004, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/database/migrations/2017_10_01_000021_Db_System_Sessions_Update.php
DbSystemSessionsUpdate.up
public function up() { Schema::table('sessions', function (Blueprint $table) { $table->unsignedInteger('user_id')->nullable(); $table->string('ip_address', 45)->nullable(); $table->text('user_agent')->nullable(); }); }
php
public function up() { Schema::table('sessions', function (Blueprint $table) { $table->unsignedInteger('user_id')->nullable(); $table->string('ip_address', 45)->nullable(); $table->text('user_agent')->nullable(); }); }
[ "public", "function", "up", "(", ")", "{", "Schema", "::", "table", "(", "'sessions'", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "$", "table", "->", "unsignedInteger", "(", "'user_id'", ")", "->", "nullable", "(", ")", ";", "$", "table...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/database/migrations/2017_10_01_000021_Db_System_Sessions_Update.php#L13-L20
train
Upgrades the database to the database.
[ 30522, 2270, 3853, 2039, 1006, 1007, 1063, 8040, 28433, 1024, 1024, 2795, 1006, 1005, 6521, 1005, 1010, 3853, 1006, 2630, 16550, 1002, 2795, 1007, 1063, 1002, 2795, 1011, 1028, 27121, 18447, 26320, 1006, 1005, 5310, 1035, 8909, 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
libs/Zend/Mime/Part.php
Zend_Mime_Part.getHeaders
public function getHeaders($EOL = Zend_Mime::LINEEND) { $res = ''; foreach ($this->getHeadersArray($EOL) as $header) { $res .= $header[0] . ': ' . $header[1] . $EOL; } return $res; }
php
public function getHeaders($EOL = Zend_Mime::LINEEND) { $res = ''; foreach ($this->getHeadersArray($EOL) as $header) { $res .= $header[0] . ': ' . $header[1] . $EOL; } return $res; }
[ "public", "function", "getHeaders", "(", "$", "EOL", "=", "Zend_Mime", "::", "LINEEND", ")", "{", "$", "res", "=", "''", ";", "foreach", "(", "$", "this", "->", "getHeadersArray", "(", "$", "EOL", ")", "as", "$", "header", ")", "{", "$", "res", ".=...
Return the headers for this part as a string @return String
[ "Return", "the", "headers", "for", "this", "part", "as", "a", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Part.php#L221-L229
train
Get the headers of the message
[ 30522, 2270, 3853, 2131, 4974, 2545, 1006, 1002, 1041, 4747, 1027, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 2240, 10497, 1007, 1063, 1002, 24501, 1027, 1005, 1005, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 4974, 2545, 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...
octobercms/october
modules/cms/classes/Controller.php
Controller.runAjaxHandler
protected function runAjaxHandler($handler) { /** * @event cms.ajax.beforeRunHandler * Provides an opportunity to modify an AJAX request * * The parameter provided is `$handler` (the requested AJAX handler to be run) * * Example usage (forwards AJAX handlers to a backend widget): * * Event::listen('cms.ajax.beforeRunHandler', function((\Cms\Classes\Controller) $controller, (string) $handler) { * if (strpos($handler, '::')) { * list($componentAlias, $handlerName) = explode('::', $handler); * if ($componentAlias === $this->getBackendWidgetAlias()) { * return $this->backendControllerProxy->runAjaxHandler($handler); * } * } * }); * * Or * * $this->controller->bindEvent('ajax.beforeRunHandler', function ((string) $handler) { * if (strpos($handler, '::')) { * list($componentAlias, $handlerName) = explode('::', $handler); * if ($componentAlias === $this->getBackendWidgetAlias()) { * return $this->backendControllerProxy->runAjaxHandler($handler); * } * } * }); * */ if ($event = $this->fireSystemEvent('cms.ajax.beforeRunHandler', [$handler])) { return $event; } /* * Process Component handler */ if (strpos($handler, '::')) { list($componentName, $handlerName) = explode('::', $handler); $componentObj = $this->findComponentByName($componentName); if ($componentObj && $componentObj->methodExists($handlerName)) { $this->componentContext = $componentObj; $result = $componentObj->runAjaxHandler($handlerName); return $result ?: true; } } /* * Process code section handler */ else { if (method_exists($this->pageObj, $handler)) { $result = $this->pageObj->$handler(); return $result ?: true; } if (!$this->layout->isFallBack() && method_exists($this->layoutObj, $handler)) { $result = $this->layoutObj->$handler(); return $result ?: true; } /* * Cycle each component to locate a usable handler */ if (($componentObj = $this->findComponentByHandler($handler)) !== null) { $this->componentContext = $componentObj; $result = $componentObj->runAjaxHandler($handler); return $result ?: true; } } /* * Generic handler that does nothing */ if ($handler == 'onAjax') { return true; } return false; }
php
protected function runAjaxHandler($handler) { /** * @event cms.ajax.beforeRunHandler * Provides an opportunity to modify an AJAX request * * The parameter provided is `$handler` (the requested AJAX handler to be run) * * Example usage (forwards AJAX handlers to a backend widget): * * Event::listen('cms.ajax.beforeRunHandler', function((\Cms\Classes\Controller) $controller, (string) $handler) { * if (strpos($handler, '::')) { * list($componentAlias, $handlerName) = explode('::', $handler); * if ($componentAlias === $this->getBackendWidgetAlias()) { * return $this->backendControllerProxy->runAjaxHandler($handler); * } * } * }); * * Or * * $this->controller->bindEvent('ajax.beforeRunHandler', function ((string) $handler) { * if (strpos($handler, '::')) { * list($componentAlias, $handlerName) = explode('::', $handler); * if ($componentAlias === $this->getBackendWidgetAlias()) { * return $this->backendControllerProxy->runAjaxHandler($handler); * } * } * }); * */ if ($event = $this->fireSystemEvent('cms.ajax.beforeRunHandler', [$handler])) { return $event; } /* * Process Component handler */ if (strpos($handler, '::')) { list($componentName, $handlerName) = explode('::', $handler); $componentObj = $this->findComponentByName($componentName); if ($componentObj && $componentObj->methodExists($handlerName)) { $this->componentContext = $componentObj; $result = $componentObj->runAjaxHandler($handlerName); return $result ?: true; } } /* * Process code section handler */ else { if (method_exists($this->pageObj, $handler)) { $result = $this->pageObj->$handler(); return $result ?: true; } if (!$this->layout->isFallBack() && method_exists($this->layoutObj, $handler)) { $result = $this->layoutObj->$handler(); return $result ?: true; } /* * Cycle each component to locate a usable handler */ if (($componentObj = $this->findComponentByHandler($handler)) !== null) { $this->componentContext = $componentObj; $result = $componentObj->runAjaxHandler($handler); return $result ?: true; } } /* * Generic handler that does nothing */ if ($handler == 'onAjax') { return true; } return false; }
[ "protected", "function", "runAjaxHandler", "(", "$", "handler", ")", "{", "/**\n * @event cms.ajax.beforeRunHandler\n * Provides an opportunity to modify an AJAX request\n *\n * The parameter provided is `$handler` (the requested AJAX handler to be run)\n *\n ...
Tries to find and run an AJAX handler in the page, layout, components and plugins. The method stops as soon as the handler is found. @param string $handler name of the ajax handler @return boolean Returns true if the handler was found. Returns false otherwise.
[ "Tries", "to", "find", "and", "run", "an", "AJAX", "handler", "in", "the", "page", "layout", "components", "and", "plugins", ".", "The", "method", "stops", "as", "soon", "as", "the", "handler", "is", "found", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L805-L886
train
Runs an AJAX handler
[ 30522, 5123, 3853, 2448, 22734, 2595, 11774, 3917, 1006, 1002, 28213, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2724, 4642, 2015, 1012, 18176, 1012, 2077, 15532, 11774, 3917, 1008, 3640, 2019, 4495, 2000, 19933, 2019, 18176, 5227, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/VisitExcluded.php
VisitExcluded.isUserAgentExcluded
protected function isUserAgentExcluded() { $excludedAgents = $this->getAttributes('excluded_user_agents', 'global_excluded_user_agents'); if (!empty($excludedAgents)) { foreach ($excludedAgents as $excludedUserAgent) { // if the excluded user agent string part is in this visit's user agent, this visit should be excluded if (stripos($this->userAgent, $excludedUserAgent) !== false) { return true; } } } return false; }
php
protected function isUserAgentExcluded() { $excludedAgents = $this->getAttributes('excluded_user_agents', 'global_excluded_user_agents'); if (!empty($excludedAgents)) { foreach ($excludedAgents as $excludedUserAgent) { // if the excluded user agent string part is in this visit's user agent, this visit should be excluded if (stripos($this->userAgent, $excludedUserAgent) !== false) { return true; } } } return false; }
[ "protected", "function", "isUserAgentExcluded", "(", ")", "{", "$", "excludedAgents", "=", "$", "this", "->", "getAttributes", "(", "'excluded_user_agents'", ",", "'global_excluded_user_agents'", ")", ";", "if", "(", "!", "empty", "(", "$", "excludedAgents", ")", ...
Returns true if the specified user agent should be excluded for the current site or not. Visits whose user agent string contains one of the excluded_user_agents strings for the site being tracked (or one of the global strings) will be excluded. @internal param string $this ->userAgent The user agent string. @return bool
[ "Returns", "true", "if", "the", "specified", "user", "agent", "should", "be", "excluded", "for", "the", "current", "site", "or", "not", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/VisitExcluded.php#L342-L356
train
Returns true if the user agent string part of the visit should be excluded
[ 30522, 5123, 3853, 2003, 20330, 4270, 10111, 2595, 20464, 13936, 1006, 1007, 1063, 1002, 12421, 4270, 7666, 1027, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 4570, 1006, 1005, 12421, 1035, 5310, 1035, 6074, 1005, 1010, 1005, 3795, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/API/ResponseBuilder.php
ResponseBuilder.getResponse
public function getResponse($value = null, $apiModule = false, $apiMethod = false) { $this->apiModule = $apiModule; $this->apiMethod = $apiMethod; $this->sendHeaderIfEnabled(); // when null or void is returned from the api call, we handle it as a successful operation if (!isset($value)) { if (ob_get_contents()) { return null; } return $this->apiRenderer->renderSuccess('ok'); } // If the returned value is an object DataTable we // apply the set of generic filters if asked in the URL // and we render the DataTable according to the format specified in the URL if ($value instanceof DataTableInterface) { return $this->handleDataTable($value); } // Case an array is returned from the API call, we convert it to the requested format // - if calling from inside the application (format = original) // => the data stays unchanged (ie. a standard php array or whatever data structure) // - if any other format is requested, we have to convert this data structure (which we assume // to be an array) to a DataTable in order to apply the requested DataTable_Renderer (for example XML) if (is_array($value)) { return $this->handleArray($value); } if (is_object($value)) { return $this->apiRenderer->renderObject($value); } if (is_resource($value)) { return $this->apiRenderer->renderResource($value); } return $this->apiRenderer->renderScalar($value); }
php
public function getResponse($value = null, $apiModule = false, $apiMethod = false) { $this->apiModule = $apiModule; $this->apiMethod = $apiMethod; $this->sendHeaderIfEnabled(); // when null or void is returned from the api call, we handle it as a successful operation if (!isset($value)) { if (ob_get_contents()) { return null; } return $this->apiRenderer->renderSuccess('ok'); } // If the returned value is an object DataTable we // apply the set of generic filters if asked in the URL // and we render the DataTable according to the format specified in the URL if ($value instanceof DataTableInterface) { return $this->handleDataTable($value); } // Case an array is returned from the API call, we convert it to the requested format // - if calling from inside the application (format = original) // => the data stays unchanged (ie. a standard php array or whatever data structure) // - if any other format is requested, we have to convert this data structure (which we assume // to be an array) to a DataTable in order to apply the requested DataTable_Renderer (for example XML) if (is_array($value)) { return $this->handleArray($value); } if (is_object($value)) { return $this->apiRenderer->renderObject($value); } if (is_resource($value)) { return $this->apiRenderer->renderResource($value); } return $this->apiRenderer->renderScalar($value); }
[ "public", "function", "getResponse", "(", "$", "value", "=", "null", ",", "$", "apiModule", "=", "false", ",", "$", "apiMethod", "=", "false", ")", "{", "$", "this", "->", "apiModule", "=", "$", "apiModule", ";", "$", "this", "->", "apiMethod", "=", ...
This method processes the data resulting from the API call. - If the data resulted from the API call is a DataTable then - we apply the standard filters if the parameters have been found in the URL. For example to offset,limit the Table you can add the following parameters to any API call that returns a DataTable: filter_limit=10&filter_offset=20 - we apply the filters that have been previously queued on the DataTable @see DataTable::queueFilter() - we apply the renderer that generate the DataTable in a given format (XML, PHP, HTML, JSON, etc.) the format can be changed using the 'format' parameter in the request. Example: format=xml - If there is nothing returned (void) we display a standard success message - If there is a PHP array returned, we try to convert it to a dataTable It is then possible to convert this datatable to any requested format (xml/etc) - If a bool is returned we convert to a string (true is displayed as 'true' false as 'false') - If an integer / float is returned, we simply return it @param mixed $value The initial returned value, before post process. If set to null, success response is returned. @param bool|string $apiModule The API module that was called @param bool|string $apiMethod The API method that was called @return mixed Usually a string, but can still be a PHP data structure if the format requested is 'original'
[ "This", "method", "processes", "the", "data", "resulting", "from", "the", "API", "call", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/ResponseBuilder.php#L83-L124
train
Return the response
[ 30522, 2270, 3853, 2131, 6072, 26029, 3366, 1006, 1002, 3643, 1027, 19701, 1010, 1002, 17928, 5302, 8566, 2571, 1027, 6270, 1010, 1002, 17928, 11368, 6806, 2094, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 17928, 5302, 8566, 2571, 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/DataTable/Map.php
Map.deleteColumns
public function deleteColumns($columns, $deleteRecursiveInSubtables = false) { foreach ($this->getDataTables() as $table) { $table->deleteColumns($columns); } }
php
public function deleteColumns($columns, $deleteRecursiveInSubtables = false) { foreach ($this->getDataTables() as $table) { $table->deleteColumns($columns); } }
[ "public", "function", "deleteColumns", "(", "$", "columns", ",", "$", "deleteRecursiveInSubtables", "=", "false", ")", "{", "foreach", "(", "$", "this", "->", "getDataTables", "(", ")", "as", "$", "table", ")", "{", "$", "table", "->", "deleteColumns", "("...
Deletes the specified columns in each contained {@link DataTable}. See {@link DataTable::deleteColumns()}. @param array $columns The columns to delete. @param bool $deleteRecursiveInSubtables This param is currently not used.
[ "Deletes", "the", "specified", "columns", "in", "each", "contained", "{", "@link", "DataTable", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Map.php#L292-L297
train
Delete columns from all tables in this table
[ 30522, 2270, 3853, 3972, 12870, 25778, 2819, 3619, 1006, 1002, 7753, 1010, 1002, 3972, 15141, 8586, 9236, 3512, 7076, 12083, 10880, 2015, 1027, 6270, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 2850, 29336, 3085, 2015, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Protocols/Ws.php
Ws.decode
public static function decode($bytes, $connection) { $data_length = ord($bytes[1]); if ($data_length === 126) { $decoded_data = substr($bytes, 4); } else if ($data_length === 127) { $decoded_data = substr($bytes, 10); } else { $decoded_data = substr($bytes, 2); } if ($connection->websocketCurrentFrameLength) { $connection->websocketDataBuffer .= $decoded_data; return $connection->websocketDataBuffer; } else { if ($connection->websocketDataBuffer !== '') { $decoded_data = $connection->websocketDataBuffer . $decoded_data; $connection->websocketDataBuffer = ''; } return $decoded_data; } }
php
public static function decode($bytes, $connection) { $data_length = ord($bytes[1]); if ($data_length === 126) { $decoded_data = substr($bytes, 4); } else if ($data_length === 127) { $decoded_data = substr($bytes, 10); } else { $decoded_data = substr($bytes, 2); } if ($connection->websocketCurrentFrameLength) { $connection->websocketDataBuffer .= $decoded_data; return $connection->websocketDataBuffer; } else { if ($connection->websocketDataBuffer !== '') { $decoded_data = $connection->websocketDataBuffer . $decoded_data; $connection->websocketDataBuffer = ''; } return $decoded_data; } }
[ "public", "static", "function", "decode", "(", "$", "bytes", ",", "$", "connection", ")", "{", "$", "data_length", "=", "ord", "(", "$", "bytes", "[", "1", "]", ")", ";", "if", "(", "$", "data_length", "===", "126", ")", "{", "$", "decoded_data", "...
Websocket decode. @param string $buffer @param ConnectionInterface $connection @return string
[ "Websocket", "decode", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Ws.php#L303-L324
train
Decodes the bytes from the WebSocket
[ 30522, 2270, 10763, 3853, 21933, 3207, 1006, 1002, 27507, 1010, 1002, 4434, 1007, 1063, 1002, 2951, 1035, 3091, 1027, 2030, 2094, 1006, 1002, 27507, 1031, 1015, 1033, 1007, 1025, 2065, 1006, 1002, 2951, 1035, 3091, 1027, 1027, 1027, 14010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.touch
public function touch($id, $extraLifetime) { if ($this->_options['compression']) { $flag = MEMCACHE_COMPRESSED; } else { $flag = 0; } $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]; $newLifetime = $lifetime - (time() - $mtime) + $extraLifetime; if ($newLifetime <=0) { return false; } // #ZF-5702 : we try replace() first becase set() seems to be slower if (!($result = $this->_memcache->replace($id, array($data, time(), $newLifetime), $flag, $newLifetime))) { $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $flag, $newLifetime); } return $result; } return false; }
php
public function touch($id, $extraLifetime) { if ($this->_options['compression']) { $flag = MEMCACHE_COMPRESSED; } else { $flag = 0; } $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]; $newLifetime = $lifetime - (time() - $mtime) + $extraLifetime; if ($newLifetime <=0) { return false; } // #ZF-5702 : we try replace() first becase set() seems to be slower if (!($result = $this->_memcache->replace($id, array($data, time(), $newLifetime), $flag, $newLifetime))) { $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $flag, $newLifetime); } return $result; } return false; }
[ "public", "function", "touch", "(", "$", "id", ",", "$", "extraLifetime", ")", "{", "if", "(", "$", "this", "->", "_options", "[", "'compression'", "]", ")", "{", "$", "flag", "=", "MEMCACHE_COMPRESSED", ";", "}", "else", "{", "$", "flag", "=", "0", ...
Give (if possible) an extra lifetime to the given cache id @param string $id cache id @param int $extraLifetime @return boolean true if ok
[ "Give", "(", "if", "possible", ")", "an", "extra", "lifetime", "to", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Memcached.php#L448-L476
train
touches a cache record
[ 30522, 2270, 3853, 3543, 1006, 1002, 8909, 1010, 1002, 4469, 15509, 7292, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 7047, 1031, 1005, 13379, 1005, 1033, 1007, 1063, 1002, 5210, 1027, 2033, 12458, 15395, 1035, 16620, 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...
octobercms/october
modules/backend/classes/NavigationManager.php
NavigationManager.isMainMenuItemActive
public function isMainMenuItemActive($item) { return $this->contextOwner == $item->owner && $this->contextMainMenuItemCode == $item->code; }
php
public function isMainMenuItemActive($item) { return $this->contextOwner == $item->owner && $this->contextMainMenuItemCode == $item->code; }
[ "public", "function", "isMainMenuItemActive", "(", "$", "item", ")", "{", "return", "$", "this", "->", "contextOwner", "==", "$", "item", "->", "owner", "&&", "$", "this", "->", "contextMainMenuItemCode", "==", "$", "item", "->", "code", ";", "}" ]
Determines if a main menu item is active. @param mixed $item Specifies the item object. @return boolean Returns true if the menu item is active.
[ "Determines", "if", "a", "main", "menu", "item", "is", "active", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L410-L413
train
Checks if the main menu item is active
[ 30522, 2270, 3853, 2003, 24238, 3549, 14663, 14545, 15277, 1006, 1002, 8875, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 6123, 12384, 2121, 1027, 1027, 1002, 8875, 1011, 1028, 3954, 1004, 1004, 1002, 2023, 1011, 1028, 6123, 24238, 3549, 14663...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/MockArraySessionStorage.php
MockArraySessionStorage.start
public function start() { if ($this->started) { return true; } if (empty($this->id)) { $this->id = $this->generateId(); } $this->loadSession(); return true; }
php
public function start() { if ($this->started) { return true; } if (empty($this->id)) { $this->id = $this->generateId(); } $this->loadSession(); return true; }
[ "public", "function", "start", "(", ")", "{", "if", "(", "$", "this", "->", "started", ")", "{", "return", "true", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "id", ")", ")", "{", "$", "this", "->", "id", "=", "$", "this", "->", "ge...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php#L79-L92
train
Start the session
[ 30522, 2270, 3853, 2707, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2318, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 8909, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 8909, 1027, 1002, 202...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spatie/laravel-permission
src/Traits/HasPermissions.php
HasPermissions.convertToPermissionModels
protected function convertToPermissionModels($permissions): array { if ($permissions instanceof Collection) { $permissions = $permissions->all(); } $permissions = is_array($permissions) ? $permissions : [$permissions]; return array_map(function ($permission) { if ($permission instanceof Permission) { return $permission; } return $this->getPermissionClass()->findByName($permission, $this->getDefaultGuardName()); }, $permissions); }
php
protected function convertToPermissionModels($permissions): array { if ($permissions instanceof Collection) { $permissions = $permissions->all(); } $permissions = is_array($permissions) ? $permissions : [$permissions]; return array_map(function ($permission) { if ($permission instanceof Permission) { return $permission; } return $this->getPermissionClass()->findByName($permission, $this->getDefaultGuardName()); }, $permissions); }
[ "protected", "function", "convertToPermissionModels", "(", "$", "permissions", ")", ":", "array", "{", "if", "(", "$", "permissions", "instanceof", "Collection", ")", "{", "$", "permissions", "=", "$", "permissions", "->", "all", "(", ")", ";", "}", "$", "...
@param string|array|\Spatie\Permission\Contracts\Permission|\Illuminate\Support\Collection $permissions @return array
[ "@param", "string|array|", "\\", "Spatie", "\\", "Permission", "\\", "Contracts", "\\", "Permission|", "\\", "Illuminate", "\\", "Support", "\\", "Collection", "$permissions" ]
81dbe9d372d70c255b66a2727a235076509f8d45
https://github.com/spatie/laravel-permission/blob/81dbe9d372d70c255b66a2727a235076509f8d45/src/Traits/HasPermissions.php#L93-L108
train
Converts permission objects to permission models
[ 30522, 5123, 3853, 10463, 14399, 2121, 25481, 5302, 9247, 2015, 1006, 1002, 6656, 2015, 1007, 1024, 9140, 1063, 2065, 30524, 2015, 1027, 2003, 1035, 9140, 1006, 1002, 6656, 2015, 1007, 1029, 1002, 6656, 2015, 1024, 1031, 1002, 6656, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Helpers.php
Helpers.encodeURI
public static function encodeURI($uri) { $unescaped = array( '%2D'=>'-','%5F'=>'_','%2E'=>'.','%21'=>'!', '%7E'=>'~', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')' ); $reserved = array( '%3B'=>';','%2C'=>',','%2F'=>'/','%3F'=>'?','%3A'=>':', '%40'=>'@','%26'=>'&','%3D'=>'=','%2B'=>'+','%24'=>'$' ); $score = array( '%23'=>'#' ); return strtr(rawurlencode(rawurldecode($uri)), array_merge($reserved,$unescaped,$score)); }
php
public static function encodeURI($uri) { $unescaped = array( '%2D'=>'-','%5F'=>'_','%2E'=>'.','%21'=>'!', '%7E'=>'~', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')' ); $reserved = array( '%3B'=>';','%2C'=>',','%2F'=>'/','%3F'=>'?','%3A'=>':', '%40'=>'@','%26'=>'&','%3D'=>'=','%2B'=>'+','%24'=>'$' ); $score = array( '%23'=>'#' ); return strtr(rawurlencode(rawurldecode($uri)), array_merge($reserved,$unescaped,$score)); }
[ "public", "static", "function", "encodeURI", "(", "$", "uri", ")", "{", "$", "unescaped", "=", "array", "(", "'%2D'", "=>", "'-'", ",", "'%5F'", "=>", "'_'", ",", "'%2E'", "=>", "'.'", ",", "'%21'", "=>", "'!'", ",", "'%7E'", "=>", "'~'", ",", "'%2...
Encodes a Uniform Resource Identifier (URI) by replacing non-alphanumeric characters with a percent (%) sign followed by two hex digits, excepting characters in the URI reserved character set. Assumes that the URI is a complete URI, so does not encode reserved characters that have special meaning in the URI. Simulates the encodeURI function available in JavaScript https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURI Source: http://stackoverflow.com/q/4929584/264628 @param string $uri The URI to encode @return string The original URL with special characters encoded
[ "Encodes", "a", "Uniform", "Resource", "Identifier", "(", "URI", ")", "by", "replacing", "non", "-", "alphanumeric", "characters", "with", "a", "percent", "(", "%", ")", "sign", "followed", "by", "two", "hex", "digits", "excepting", "characters", "in", "the"...
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Helpers.php#L228-L241
train
Encodes the URI to its string representation
[ 30522, 2270, 10763, 3853, 4372, 16044, 9496, 1006, 1002, 24471, 2072, 1007, 1063, 1002, 16655, 15782, 5669, 1027, 9140, 1006, 1005, 1003, 14134, 1005, 1027, 1028, 1005, 1011, 1005, 1010, 1005, 1003, 1019, 2546, 1005, 1027, 1028, 1005, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/CronArchive.php
CronArchive.logSection
private function logSection($title = "") { $this->logger->info("---------------------------"); if (!empty($title)) { $this->logger->info($title); } }
php
private function logSection($title = "") { $this->logger->info("---------------------------"); if (!empty($title)) { $this->logger->info($title); } }
[ "private", "function", "logSection", "(", "$", "title", "=", "\"\"", ")", "{", "$", "this", "->", "logger", "->", "info", "(", "\"---------------------------\"", ")", ";", "if", "(", "!", "empty", "(", "$", "title", ")", ")", "{", "$", "this", "->", ...
Logs a section in the output @param string $title
[ "Logs", "a", "section", "in", "the", "output" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive.php#L1057-L1063
train
Log section of the page
[ 30522, 2797, 3853, 15664, 18491, 1006, 1002, 2516, 1027, 1000, 1000, 1007, 1063, 1002, 2023, 1011, 1028, 8833, 4590, 1011, 1028, 18558, 1006, 1000, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Renderer/Csv.php
Csv.renderDataTableMap
protected function renderDataTableMap($table, &$allColumns = array()) { $str = ''; foreach ($table->getDataTables() as $currentLinePrefix => $dataTable) { $returned = explode("\n", $this->renderTable($dataTable, $allColumns)); // get rid of the columns names $returned = array_slice($returned, 1); // case empty datatable we don't print anything in the CSV export // when in xml we would output <result date="2008-01-15" /> if (!empty($returned)) { foreach ($returned as &$row) { $row = $currentLinePrefix . $this->separator . $row; } $str .= "\n" . implode("\n", $returned); } } // prepend table key to column list $allColumns = array_merge(array($table->getKeyName() => true), $allColumns); // add header to output string $str = $this->getHeaderLine(array_keys($allColumns)) . $str; return $str; }
php
protected function renderDataTableMap($table, &$allColumns = array()) { $str = ''; foreach ($table->getDataTables() as $currentLinePrefix => $dataTable) { $returned = explode("\n", $this->renderTable($dataTable, $allColumns)); // get rid of the columns names $returned = array_slice($returned, 1); // case empty datatable we don't print anything in the CSV export // when in xml we would output <result date="2008-01-15" /> if (!empty($returned)) { foreach ($returned as &$row) { $row = $currentLinePrefix . $this->separator . $row; } $str .= "\n" . implode("\n", $returned); } } // prepend table key to column list $allColumns = array_merge(array($table->getKeyName() => true), $allColumns); // add header to output string $str = $this->getHeaderLine(array_keys($allColumns)) . $str; return $str; }
[ "protected", "function", "renderDataTableMap", "(", "$", "table", ",", "&", "$", "allColumns", "=", "array", "(", ")", ")", "{", "$", "str", "=", "''", ";", "foreach", "(", "$", "table", "->", "getDataTables", "(", ")", "as", "$", "currentLinePrefix", ...
Computes the output of the given data table array @param DataTable\Map $table @param array $allColumns @return string
[ "Computes", "the", "output", "of", "the", "given", "data", "table", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Csv.php#L141-L167
train
Render the data table
[ 30522, 5123, 3853, 17552, 2850, 29336, 3085, 2863, 2361, 1006, 1002, 2795, 1010, 1004, 1002, 2035, 25778, 2819, 3619, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 2358, 2099, 1027, 1005, 1005, 1025, 18921, 6776, 1006, 1002, 2795, 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...
octobercms/october
modules/backend/widgets/Form.php
Form.getField
public function getField($field) { if (isset($this->allFields[$field])) { return $this->allFields[$field]; } return null; }
php
public function getField($field) { if (isset($this->allFields[$field])) { return $this->allFields[$field]; } return null; }
[ "public", "function", "getField", "(", "$", "field", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "allFields", "[", "$", "field", "]", ")", ")", "{", "return", "$", "this", "->", "allFields", "[", "$", "field", "]", ";", "}", "return", "...
Get a specified field object @param string $field @return mixed
[ "Get", "a", "specified", "field", "object" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L1007-L1014
train
Get Field by Field Name
[ 30522, 2270, 3853, 2131, 3790, 1006, 1002, 2492, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2035, 15155, 1031, 1002, 2492, 1033, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2035, 15155, 1031, 1002, 2492, 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...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
HasManyThrough.chunkById
public function chunkById($count, callable $callback, $column = null, $alias = null) { $column = $column ?? $this->getRelated()->getQualifiedKeyName(); $alias = $alias ?? $this->getRelated()->getKeyName(); return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias); }
php
public function chunkById($count, callable $callback, $column = null, $alias = null) { $column = $column ?? $this->getRelated()->getQualifiedKeyName(); $alias = $alias ?? $this->getRelated()->getKeyName(); return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias); }
[ "public", "function", "chunkById", "(", "$", "count", ",", "callable", "$", "callback", ",", "$", "column", "=", "null", ",", "$", "alias", "=", "null", ")", "{", "$", "column", "=", "$", "column", "??", "$", "this", "->", "getRelated", "(", ")", "...
Chunk the results of a query by comparing numeric IDs. @param int $count @param callable $callback @param string|null $column @param string|null $alias @return bool
[ "Chunk", "the", "results", "of", "a", "query", "by", "comparing", "numeric", "IDs", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php#L441-L448
train
Returns a query builder to fetch a chunk of objects by id.
[ 30522, 2270, 3853, 20000, 3762, 3593, 1006, 1002, 4175, 1010, 2655, 3085, 1002, 2655, 5963, 1010, 1002, 5930, 1027, 19701, 1010, 1002, 14593, 1027, 19701, 1007, 1063, 1002, 5930, 1027, 1002, 5930, 1029, 1029, 1002, 2023, 1011, 1028, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
FormDataCollector.getCasters
protected function getCasters() { return parent::getCasters() + [ \Exception::class => function (\Exception $e, array $a, Stub $s) { foreach (["\0Exception\0previous", "\0Exception\0trace"] as $k) { if (isset($a[$k])) { unset($a[$k]); ++$s->cut; } } return $a; }, FormInterface::class => function (FormInterface $f, array $a) { return [ Caster::PREFIX_VIRTUAL.'name' => $f->getName(), Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(\get_class($f->getConfig()->getType()->getInnerType())), ]; }, FormView::class => [StubCaster::class, 'cutInternals'], ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) { return [ Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(), Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(), Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(), ]; }, ]; }
php
protected function getCasters() { return parent::getCasters() + [ \Exception::class => function (\Exception $e, array $a, Stub $s) { foreach (["\0Exception\0previous", "\0Exception\0trace"] as $k) { if (isset($a[$k])) { unset($a[$k]); ++$s->cut; } } return $a; }, FormInterface::class => function (FormInterface $f, array $a) { return [ Caster::PREFIX_VIRTUAL.'name' => $f->getName(), Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(\get_class($f->getConfig()->getType()->getInnerType())), ]; }, FormView::class => [StubCaster::class, 'cutInternals'], ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) { return [ Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(), Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(), Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(), ]; }, ]; }
[ "protected", "function", "getCasters", "(", ")", "{", "return", "parent", "::", "getCasters", "(", ")", "+", "[", "\\", "Exception", "::", "class", "=>", "function", "(", "\\", "Exception", "$", "e", ",", "array", "$", "a", ",", "Stub", "$", "s", ")"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php#L253-L281
train
Returns all casters
[ 30522, 5123, 3853, 2131, 25490, 2015, 1006, 1007, 1063, 2709, 6687, 1024, 1024, 2131, 25490, 2015, 1006, 1007, 1009, 1031, 1032, 6453, 1024, 1024, 2465, 1027, 1028, 3853, 1006, 1032, 6453, 1002, 1041, 1010, 9140, 1002, 1037, 1010, 24646, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Plugin/ReportsProvider.php
ReportsProvider.factory
public static function factory($module, $action) { $listApiToReport = self::getMapOfModuleActionsToReport(); $api = $module . '.' . ucfirst($action); if (!array_key_exists($api, $listApiToReport)) { return null; } $klassName = $listApiToReport[$api]; return new $klassName; }
php
public static function factory($module, $action) { $listApiToReport = self::getMapOfModuleActionsToReport(); $api = $module . '.' . ucfirst($action); if (!array_key_exists($api, $listApiToReport)) { return null; } $klassName = $listApiToReport[$api]; return new $klassName; }
[ "public", "static", "function", "factory", "(", "$", "module", ",", "$", "action", ")", "{", "$", "listApiToReport", "=", "self", "::", "getMapOfModuleActionsToReport", "(", ")", ";", "$", "api", "=", "$", "module", ".", "'.'", ".", "ucfirst", "(", "$", ...
Get an instance of a specific report belonging to the given module and having the given action. @param string $module @param string $action @return null|\Piwik\Plugin\Report @api
[ "Get", "an", "instance", "of", "a", "specific", "report", "belonging", "to", "the", "given", "module", "and", "having", "the", "given", "action", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/ReportsProvider.php#L34-L46
train
Factory method to create a new instance of the class that implements the module and action
[ 30522, 2270, 10763, 3853, 4713, 1006, 1002, 11336, 1010, 1002, 2895, 1007, 1063, 1002, 2862, 9331, 15660, 13699, 11589, 1027, 2969, 1024, 1024, 2131, 2863, 6873, 16715, 7716, 9307, 18908, 8496, 19277, 6442, 1006, 1007, 1025, 1002, 17928, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Columns/MetricsList.php
MetricsList.get
public static function get() { $cache = Cache::getTransientCache(); $cacheKey = CacheId::siteAware('MetricsList'); if ($cache->contains($cacheKey)) { return $cache->fetch($cacheKey); } $list = new static; /** * Triggered to add new metrics that cannot be picked up automatically by the platform. * This is useful if the plugin allows a user to create metrics dynamically. For example * CustomDimensions or CustomVariables. * * **Example** * * public function addMetric(&$list) * { * $list->addMetric(new MyCustomMetric()); * } * * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way. */ Piwik::postEvent('Metric.addMetrics', array($list)); $dimensions = Dimension::getAllDimensions(); foreach ($dimensions as $dimension) { $factory = new DimensionMetricFactory($dimension); $dimension->configureMetrics($list, $factory); } $computedFactory = new ComputedMetricFactory($list); /** * Triggered to add new metrics that cannot be picked up automatically by the platform. * This is useful if the plugin allows a user to create metrics dynamically. For example * CustomDimensions or CustomVariables. * * **Example** * * public function addMetric(&$list) * { * $list->addMetric(new MyCustomMetric()); * } * * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way. */ Piwik::postEvent('Metric.addComputedMetrics', array($list, $computedFactory)); /** * Triggered to filter metrics. * * **Example** * * public function removeMetrics(Piwik\Columns\MetricsList $list) * { * $list->remove($category='General_Visits'); // remove all metrics having this category * } * * @param MetricsList $list An instance of the MetricsList. You can change the list of metrics this way. */ Piwik::postEvent('Metric.filterMetrics', array($list)); $availableMetrics = array(); foreach ($list->getMetrics() as $metric) { $availableMetrics[] = $metric->getName(); } foreach ($list->metrics as $index => $metric) { if ($metric instanceof ProcessedMetric) { $depMetrics = $metric->getDependentMetrics(); if (is_array($depMetrics)) { foreach ($depMetrics as $depMetric) { if (!in_array($depMetric, $availableMetrics, $strict = true)) { unset($list->metrics[$index]); // not resolvable metric } } } } } $cache->save($cacheKey, $list); return $list; }
php
public static function get() { $cache = Cache::getTransientCache(); $cacheKey = CacheId::siteAware('MetricsList'); if ($cache->contains($cacheKey)) { return $cache->fetch($cacheKey); } $list = new static; /** * Triggered to add new metrics that cannot be picked up automatically by the platform. * This is useful if the plugin allows a user to create metrics dynamically. For example * CustomDimensions or CustomVariables. * * **Example** * * public function addMetric(&$list) * { * $list->addMetric(new MyCustomMetric()); * } * * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way. */ Piwik::postEvent('Metric.addMetrics', array($list)); $dimensions = Dimension::getAllDimensions(); foreach ($dimensions as $dimension) { $factory = new DimensionMetricFactory($dimension); $dimension->configureMetrics($list, $factory); } $computedFactory = new ComputedMetricFactory($list); /** * Triggered to add new metrics that cannot be picked up automatically by the platform. * This is useful if the plugin allows a user to create metrics dynamically. For example * CustomDimensions or CustomVariables. * * **Example** * * public function addMetric(&$list) * { * $list->addMetric(new MyCustomMetric()); * } * * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way. */ Piwik::postEvent('Metric.addComputedMetrics', array($list, $computedFactory)); /** * Triggered to filter metrics. * * **Example** * * public function removeMetrics(Piwik\Columns\MetricsList $list) * { * $list->remove($category='General_Visits'); // remove all metrics having this category * } * * @param MetricsList $list An instance of the MetricsList. You can change the list of metrics this way. */ Piwik::postEvent('Metric.filterMetrics', array($list)); $availableMetrics = array(); foreach ($list->getMetrics() as $metric) { $availableMetrics[] = $metric->getName(); } foreach ($list->metrics as $index => $metric) { if ($metric instanceof ProcessedMetric) { $depMetrics = $metric->getDependentMetrics(); if (is_array($depMetrics)) { foreach ($depMetrics as $depMetric) { if (!in_array($depMetric, $availableMetrics, $strict = true)) { unset($list->metrics[$index]); // not resolvable metric } } } } } $cache->save($cacheKey, $list); return $list; }
[ "public", "static", "function", "get", "(", ")", "{", "$", "cache", "=", "Cache", "::", "getTransientCache", "(", ")", ";", "$", "cacheKey", "=", "CacheId", "::", "siteAware", "(", "'MetricsList'", ")", ";", "if", "(", "$", "cache", "->", "contains", "...
Get all metrics defined in the Piwik platform. @ignore @return static
[ "Get", "all", "metrics", "defined", "in", "the", "Piwik", "platform", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/MetricsList.php#L103-L189
train
Returns the list of all metrics that can be added to the list
[ 30522, 2270, 10763, 3853, 2131, 1006, 1007, 1063, 1002, 17053, 1027, 17053, 1024, 1024, 2131, 6494, 3619, 11638, 3540, 5403, 1006, 1007, 1025, 1002, 17053, 14839, 1027, 17053, 3593, 1024, 1024, 2609, 10830, 2890, 1006, 1005, 12046, 14540, 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/Validator/Context/ExecutionContext.php
ExecutionContext.buildViolation
public function buildViolation($message, array $parameters = []) { return new ConstraintViolationBuilder( $this->violations, $this->constraint, $message, $parameters, $this->root, $this->propertyPath, $this->value, $this->translator, $this->translationDomain ); }
php
public function buildViolation($message, array $parameters = []) { return new ConstraintViolationBuilder( $this->violations, $this->constraint, $message, $parameters, $this->root, $this->propertyPath, $this->value, $this->translator, $this->translationDomain ); }
[ "public", "function", "buildViolation", "(", "$", "message", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "return", "new", "ConstraintViolationBuilder", "(", "$", "this", "->", "violations", ",", "$", "this", "->", "constraint", ",", "$", "mes...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Context/ExecutionContext.php#L204-L217
train
Returns ConstraintViolationBuilder which will create a ConstraintViolation object for the given constraint and parameters.
[ 30522, 2270, 3853, 3857, 25500, 13490, 1006, 1002, 4471, 1010, 9140, 1002, 11709, 1027, 1031, 1033, 1007, 1063, 2709, 2047, 27142, 25500, 13490, 8569, 23891, 2099, 1006, 1002, 2023, 1011, 1028, 13302, 1010, 1002, 2023, 1011, 30524, 1028, 54...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Notifications/Channels/MailChannel.php
MailChannel.send
public function send($notifiable, Notification $notification) { $message = $notification->toMail($notifiable); if (! $notifiable->routeNotificationFor('mail', $notification) && ! $message instanceof Mailable) { return; } if ($message instanceof Mailable) { return $message->send($this->mailer); } $this->mailer->send( $this->buildView($message), array_merge($message->data(), $this->additionalMessageData($notification)), $this->messageBuilder($notifiable, $notification, $message) ); }
php
public function send($notifiable, Notification $notification) { $message = $notification->toMail($notifiable); if (! $notifiable->routeNotificationFor('mail', $notification) && ! $message instanceof Mailable) { return; } if ($message instanceof Mailable) { return $message->send($this->mailer); } $this->mailer->send( $this->buildView($message), array_merge($message->data(), $this->additionalMessageData($notification)), $this->messageBuilder($notifiable, $notification, $message) ); }
[ "public", "function", "send", "(", "$", "notifiable", ",", "Notification", "$", "notification", ")", "{", "$", "message", "=", "$", "notification", "->", "toMail", "(", "$", "notifiable", ")", ";", "if", "(", "!", "$", "notifiable", "->", "routeNotificatio...
Send the given notification. @param mixed $notifiable @param \Illuminate\Notifications\Notification $notification @return void
[ "Send", "the", "given", "notification", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/MailChannel.php#L49-L67
train
Send a Notification to the mail
[ 30522, 2270, 3853, 4604, 1006, 1002, 2025, 10128, 19210, 1010, 26828, 1002, 26828, 1007, 1063, 1002, 4471, 1027, 1002, 26828, 1011, 1028, 3419, 12502, 1006, 1002, 2025, 10128, 19210, 1007, 1025, 2065, 1006, 999, 1002, 2025, 10128, 19210, 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/Scheduler/Scheduler.php
Scheduler.saveJobStates
private function saveJobStates() { $now = time(); $new_states = []; foreach ($this->jobs_run as $job) { if ($job->isSuccessful()) { $new_states[$job->getId()] = ['state' => 'success', 'last-run' => $now]; $this->pushExecutedJob($job); } else { $new_states[$job->getId()] = ['state' => 'failure', 'last-run' => $now, 'error' => $job->getOutput()]; $this->pushFailedJob($job); } } $saved_states = $this->getJobStates(); $saved_states->save(array_merge($saved_states->content(), $new_states)); }
php
private function saveJobStates() { $now = time(); $new_states = []; foreach ($this->jobs_run as $job) { if ($job->isSuccessful()) { $new_states[$job->getId()] = ['state' => 'success', 'last-run' => $now]; $this->pushExecutedJob($job); } else { $new_states[$job->getId()] = ['state' => 'failure', 'last-run' => $now, 'error' => $job->getOutput()]; $this->pushFailedJob($job); } } $saved_states = $this->getJobStates(); $saved_states->save(array_merge($saved_states->content(), $new_states)); }
[ "private", "function", "saveJobStates", "(", ")", "{", "$", "now", "=", "time", "(", ")", ";", "$", "new_states", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "jobs_run", "as", "$", "job", ")", "{", "if", "(", "$", "job", "->", "isSucce...
Save job states to statys file
[ "Save", "job", "states", "to", "statys", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Scheduler.php#L276-L293
train
Save Job States
[ 30522, 2797, 3853, 3828, 5558, 5910, 12259, 2015, 1006, 1007, 1063, 1002, 2085, 1027, 2051, 1006, 1007, 1025, 1002, 2047, 1035, 2163, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 5841, 1035, 2448, 2004, 1002, 3105, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Pages.php
Pages.root
public function root() { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; return $this->instances[rtrim($locator->findResource('page://'), DS)]; }
php
public function root() { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; return $this->instances[rtrim($locator->findResource('page://'), DS)]; }
[ "public", "function", "root", "(", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", "this", "->", "grav", "[", "'locator'", "]", ";", "return", "$", "this", "->", "instances", "[", "rtrim", "(", "$", "locator", "->", "findRe...
Get root page. @return PageInterface
[ "Get", "root", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Pages.php#L567-L573
train
Get root page
[ 30522, 2270, 3853, 7117, 1006, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 6375, 6072, 8162, 29109, 24755, 4263, 1002, 8840, 11266, 2953, 1008, 1013, 1002, 8840, 11266, 2953, 1027, 1002, 2023, 1011, 1028, 24665, 11431, 1031, 1005, 8840, 1126...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.setKeysForSaveQuery
protected function setKeysForSaveQuery(Builder $query) { $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); return $query; }
php
protected function setKeysForSaveQuery(Builder $query) { $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); return $query; }
[ "protected", "function", "setKeysForSaveQuery", "(", "Builder", "$", "query", ")", "{", "$", "query", "->", "where", "(", "$", "this", "->", "getKeyName", "(", ")", ",", "'='", ",", "$", "this", "->", "getKeyForSaveQuery", "(", ")", ")", ";", "return", ...
Set the keys for a save update query. @param \Illuminate\Database\Eloquent\Builder $query @return \Illuminate\Database\Eloquent\Builder
[ "Set", "the", "keys", "for", "a", "save", "update", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L757-L762
train
Set the keys for save query
[ 30522, 5123, 3853, 2275, 14839, 22747, 5668, 10696, 4226, 2854, 1006, 12508, 1002, 23032, 1007, 1063, 1002, 23032, 1011, 1028, 2073, 1006, 1002, 2023, 1011, 1028, 2131, 14839, 18442, 1006, 1007, 1010, 1005, 1027, 1005, 1010, 1002, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Log/LogManager.php
LogManager.createErrorlogDriver
protected function createErrorlogDriver(array $config) { return new Monolog($this->parseChannel($config), [ $this->prepareHandler(new ErrorLogHandler( $config['type'] ?? ErrorLogHandler::OPERATING_SYSTEM, $this->level($config) )), ]); }
php
protected function createErrorlogDriver(array $config) { return new Monolog($this->parseChannel($config), [ $this->prepareHandler(new ErrorLogHandler( $config['type'] ?? ErrorLogHandler::OPERATING_SYSTEM, $this->level($config) )), ]); }
[ "protected", "function", "createErrorlogDriver", "(", "array", "$", "config", ")", "{", "return", "new", "Monolog", "(", "$", "this", "->", "parseChannel", "(", "$", "config", ")", ",", "[", "$", "this", "->", "prepareHandler", "(", "new", "ErrorLogHandler",...
Create an instance of the "error log" log driver. @param array $config @return \Psr\Log\LoggerInterface
[ "Create", "an", "instance", "of", "the", "error", "log", "log", "driver", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/LogManager.php#L307-L314
train
Create an instance of the error log driver
[ 30522, 5123, 3853, 3443, 2121, 29165, 21197, 23663, 2099, 1006, 9140, 1002, 9530, 8873, 2290, 1007, 1063, 2709, 2047, 18847, 21197, 1006, 1002, 2023, 1011, 1028, 11968, 3366, 26058, 1006, 1002, 9530, 8873, 2290, 1007, 1010, 1031, 1002, 2023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php
TreeBuilder.root
public function root($name, $type = 'array', NodeBuilder $builder = null) { @trigger_error(sprintf('The "%s()" method called for the "%s" configuration is deprecated since Symfony 4.3, pass the root name to the constructor instead.', __METHOD__, $name), E_USER_DEPRECATED); $builder = $builder ?: new NodeBuilder(); return $this->root = $builder->node($name, $type)->setParent($this); }
php
public function root($name, $type = 'array', NodeBuilder $builder = null) { @trigger_error(sprintf('The "%s()" method called for the "%s" configuration is deprecated since Symfony 4.3, pass the root name to the constructor instead.', __METHOD__, $name), E_USER_DEPRECATED); $builder = $builder ?: new NodeBuilder(); return $this->root = $builder->node($name, $type)->setParent($this); }
[ "public", "function", "root", "(", "$", "name", ",", "$", "type", "=", "'array'", ",", "NodeBuilder", "$", "builder", "=", "null", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The \"%s()\" method called for the \"%s\" configuration is deprecated since Symfon...
Creates the root node. @param string $name The name of the root node @param string $type The type of the root node @param NodeBuilder $builder A custom node builder instance @return ArrayNodeDefinition|NodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array') @throws \RuntimeException When the node type is not supported @deprecated since Symfony 4.3, pass the root name to the constructor instead
[ "Creates", "the", "root", "node", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php#L50-L57
train
This method sets the root node of the tree
[ 30522, 2270, 3853, 7117, 1006, 1002, 2171, 1010, 1002, 2828, 1027, 1005, 9140, 1005, 1010, 13045, 8569, 23891, 2099, 1002, 12508, 1027, 19701, 1007, 1063, 1030, 9495, 1035, 7561, 1006, 9043, 2546, 1006, 1005, 1996, 1000, 1003, 1055, 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...
dompdf/dompdf
src/Cellmap.php
Cellmap.get_spanned_cells
public function get_spanned_cells(Frame $frame) { $key = $frame->get_id(); if (isset($this->_frames[$key])) { return $this->_frames[$key]; } return null; }
php
public function get_spanned_cells(Frame $frame) { $key = $frame->get_id(); if (isset($this->_frames[$key])) { return $this->_frames[$key]; } return null; }
[ "public", "function", "get_spanned_cells", "(", "Frame", "$", "frame", ")", "{", "$", "key", "=", "$", "frame", "->", "get_id", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "_frames", "[", "$", "key", "]", ")", ")", "{", "return", "...
@param Frame $frame @return null|Frame
[ "@param", "Frame", "$frame" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Cellmap.php#L314-L323
train
Get the spanned cells for a Frame
[ 30522, 2270, 3853, 2131, 1035, 18212, 1035, 4442, 1006, 4853, 1002, 4853, 1007, 1063, 1002, 3145, 1027, 1002, 4853, 1011, 1028, 2131, 1035, 8909, 1006, 1007, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 1035, 11048, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...