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/Cache/Backend/Memcached.php | Zend_Cache_Backend_Memcached.load | public function load($id, $doNotTestCacheValidity = false)
{
$tmp = $this->_memcache->get($id);
if (is_array($tmp) && isset($tmp[0])) {
return $tmp[0];
}
return false;
} | php | public function load($id, $doNotTestCacheValidity = false)
{
$tmp = $this->_memcache->get($id);
if (is_array($tmp) && isset($tmp[0])) {
return $tmp[0];
}
return false;
} | [
"public",
"function",
"load",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
"=",
"false",
")",
"{",
"$",
"tmp",
"=",
"$",
"this",
"->",
"_memcache",
"->",
"get",
"(",
"$",
"id",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"tmp",
")",
"&&",
"... | Test if a cache is available for the given id and (if yes) return it (false else)
@param string $id Cache id
@param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
@return string|false cached datas | [
"Test",
"if",
"a",
"cache",
"is",
"available",
"for",
"the",
"given",
"id",
"and",
"(",
"if",
"yes",
")",
"return",
"it",
"(",
"false",
"else",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Memcached.php#L178-L185 | train | Load a language from the cache | [
30522,
2270,
3853,
7170,
1006,
1002,
8909,
1010,
1002,
2123,
28495,
3367,
3540,
16179,
11475,
25469,
1027,
6270,
1007,
1063,
1002,
1056,
8737,
1027,
1002,
2023,
1011,
1028,
1035,
2033,
12458,
15395,
1011,
1028,
2131,
1006,
1002,
8909,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/UrlValidator.php | UrlValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Url) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
$value = (string) $value;
if ('' === $value) {
return;
}
if (null !== $constraint->normalizer) {
$value = ($constraint->normalizer)($value);
}
$pattern = $constraint->relativeProtocol ? str_replace('(%s):', '(?:(%s):)?', static::PATTERN) : static::PATTERN;
$pattern = sprintf($pattern, implode('|', $constraint->protocols));
if (!preg_match($pattern, $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Url::INVALID_URL_ERROR)
->addViolation();
return;
}
if ($constraint->checkDNS) {
if (!\in_array($constraint->checkDNS, [
Url::CHECK_DNS_TYPE_ANY,
Url::CHECK_DNS_TYPE_A,
Url::CHECK_DNS_TYPE_A6,
Url::CHECK_DNS_TYPE_AAAA,
Url::CHECK_DNS_TYPE_CNAME,
Url::CHECK_DNS_TYPE_MX,
Url::CHECK_DNS_TYPE_NAPTR,
Url::CHECK_DNS_TYPE_NS,
Url::CHECK_DNS_TYPE_PTR,
Url::CHECK_DNS_TYPE_SOA,
Url::CHECK_DNS_TYPE_SRV,
Url::CHECK_DNS_TYPE_TXT,
], true)) {
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), ['checkDNS']);
}
$host = parse_url($value, PHP_URL_HOST);
if (!\is_string($host) || !checkdnsrr($host, $constraint->checkDNS)) {
$this->context->buildViolation($constraint->dnsMessage)
->setParameter('{{ value }}', $this->formatValue($host))
->setCode(Url::INVALID_URL_ERROR)
->addViolation();
}
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Url) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
$value = (string) $value;
if ('' === $value) {
return;
}
if (null !== $constraint->normalizer) {
$value = ($constraint->normalizer)($value);
}
$pattern = $constraint->relativeProtocol ? str_replace('(%s):', '(?:(%s):)?', static::PATTERN) : static::PATTERN;
$pattern = sprintf($pattern, implode('|', $constraint->protocols));
if (!preg_match($pattern, $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Url::INVALID_URL_ERROR)
->addViolation();
return;
}
if ($constraint->checkDNS) {
if (!\in_array($constraint->checkDNS, [
Url::CHECK_DNS_TYPE_ANY,
Url::CHECK_DNS_TYPE_A,
Url::CHECK_DNS_TYPE_A6,
Url::CHECK_DNS_TYPE_AAAA,
Url::CHECK_DNS_TYPE_CNAME,
Url::CHECK_DNS_TYPE_MX,
Url::CHECK_DNS_TYPE_NAPTR,
Url::CHECK_DNS_TYPE_NS,
Url::CHECK_DNS_TYPE_PTR,
Url::CHECK_DNS_TYPE_SOA,
Url::CHECK_DNS_TYPE_SRV,
Url::CHECK_DNS_TYPE_TXT,
], true)) {
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), ['checkDNS']);
}
$host = parse_url($value, PHP_URL_HOST);
if (!\is_string($host) || !checkdnsrr($host, $constraint->checkDNS)) {
$this->context->buildViolation($constraint->dnsMessage)
->setParameter('{{ value }}', $this->formatValue($host))
->setCode(Url::INVALID_URL_ERROR)
->addViolation();
}
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Url",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
".... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/UrlValidator.php#L46-L108 | train | Validates the value of the Url constraint | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
24471,
2140,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
153... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Encoder/ChainDecoder.php | ChainDecoder.supportsDecoding | public function supportsDecoding($format, array $context = [])
{
try {
$this->getDecoder($format, $context);
} catch (RuntimeException $e) {
return false;
}
return true;
} | php | public function supportsDecoding($format, array $context = [])
{
try {
$this->getDecoder($format, $context);
} catch (RuntimeException $e) {
return false;
}
return true;
} | [
"public",
"function",
"supportsDecoding",
"(",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"getDecoder",
"(",
"$",
"format",
",",
"$",
"context",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php#L46-L55 | train | Returns true if the decoder can decode the given format and context | [
30522,
2270,
3853,
6753,
3207,
3597,
4667,
1006,
1002,
4289,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
3046,
1063,
1002,
2023,
1011,
1028,
2131,
3207,
16044,
2099,
1006,
1002,
4289,
1010,
1002,
6123,
1007,
1025,
1065,
4608,
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 | plugins/Live/API.php | API.getLastVisitsDetails | public function getLastVisitsDetails($idSite, $period = false, $date = false, $segment = false, $countVisitorsToFetch = false, $minTimestamp = false, $flat = false, $doNotFetchActions = false, $enhanced = false)
{
Piwik::checkUserHasViewAccess($idSite);
$idSite = Site::getIdSitesFromIdSitesString($idSite);
if (is_array($idSite) && count($idSite) === 1) {
$idSite = array_shift($idSite);
}
Piwik::checkUserHasViewAccess($idSite);
if ($countVisitorsToFetch !== false) {
$filterLimit = (int) $countVisitorsToFetch;
$filterOffset = 0;
} else {
$filterLimit = Common::getRequestVar('filter_limit', 10, 'int');
$filterOffset = Common::getRequestVar('filter_offset', 0, 'int');
}
$filterSortOrder = Common::getRequestVar('filter_sort_order', false, 'string');
$dataTable = $this->loadLastVisitsDetailsFromDatabase($idSite, $period, $date, $segment, $filterOffset, $filterLimit, $minTimestamp, $filterSortOrder, $visitorId = false);
$this->addFilterToCleanVisitors($dataTable, $idSite, $flat, $doNotFetchActions);
$filterSortColumn = Common::getRequestVar('filter_sort_column', false, 'string');
if ($filterSortColumn) {
$this->logger->warning('Sorting the API method "Live.getLastVisitDetails" by column is currently not supported. To avoid this warning remove the URL parameter "filter_sort_column" from your API request.');
}
// Usually one would Sort a DataTable and then apply a Limit. In this case we apply a Limit first in SQL
// for fast offset usage see https://github.com/piwik/piwik/issues/7458. Sorting afterwards would lead to a
// wrong sorting result as it would only sort the limited results. Therefore we do not support a Sort for this
// API
$dataTable->disableFilter('Sort');
$dataTable->disableFilter('Limit'); // limit is already applied here
return $dataTable;
} | php | public function getLastVisitsDetails($idSite, $period = false, $date = false, $segment = false, $countVisitorsToFetch = false, $minTimestamp = false, $flat = false, $doNotFetchActions = false, $enhanced = false)
{
Piwik::checkUserHasViewAccess($idSite);
$idSite = Site::getIdSitesFromIdSitesString($idSite);
if (is_array($idSite) && count($idSite) === 1) {
$idSite = array_shift($idSite);
}
Piwik::checkUserHasViewAccess($idSite);
if ($countVisitorsToFetch !== false) {
$filterLimit = (int) $countVisitorsToFetch;
$filterOffset = 0;
} else {
$filterLimit = Common::getRequestVar('filter_limit', 10, 'int');
$filterOffset = Common::getRequestVar('filter_offset', 0, 'int');
}
$filterSortOrder = Common::getRequestVar('filter_sort_order', false, 'string');
$dataTable = $this->loadLastVisitsDetailsFromDatabase($idSite, $period, $date, $segment, $filterOffset, $filterLimit, $minTimestamp, $filterSortOrder, $visitorId = false);
$this->addFilterToCleanVisitors($dataTable, $idSite, $flat, $doNotFetchActions);
$filterSortColumn = Common::getRequestVar('filter_sort_column', false, 'string');
if ($filterSortColumn) {
$this->logger->warning('Sorting the API method "Live.getLastVisitDetails" by column is currently not supported. To avoid this warning remove the URL parameter "filter_sort_column" from your API request.');
}
// Usually one would Sort a DataTable and then apply a Limit. In this case we apply a Limit first in SQL
// for fast offset usage see https://github.com/piwik/piwik/issues/7458. Sorting afterwards would lead to a
// wrong sorting result as it would only sort the limited results. Therefore we do not support a Sort for this
// API
$dataTable->disableFilter('Sort');
$dataTable->disableFilter('Limit'); // limit is already applied here
return $dataTable;
} | [
"public",
"function",
"getLastVisitsDetails",
"(",
"$",
"idSite",
",",
"$",
"period",
"=",
"false",
",",
"$",
"date",
"=",
"false",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"countVisitorsToFetch",
"=",
"false",
",",
"$",
"minTimestamp",
"=",
"false",
... | Returns the last visits tracked in the specified website
You can define any number of filters: none, one, many or all parameters can be defined
@param int $idSite Site ID
@param bool|string $period Period to restrict to when looking at the logs
@param bool|string $date Date to restrict to
@param bool|int $segment (optional) Number of visits rows to return
@param bool|int $countVisitorsToFetch DEPRECATED (optional) Only return the last X visits. Please use the API paramaeter 'filter_offset' and 'filter_limit' instead.
@param bool|int $minTimestamp (optional) Minimum timestamp to restrict the query to (useful when paginating or refreshing visits)
@param bool $flat
@param bool $doNotFetchActions
@param bool $enhanced for plugins that want to expose additional information
@return DataTable | [
"Returns",
"the",
"last",
"visits",
"tracked",
"in",
"the",
"specified",
"website",
"You",
"can",
"define",
"any",
"number",
"of",
"filters",
":",
"none",
"one",
"many",
"or",
"all",
"parameters",
"can",
"be",
"defined"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/API.php#L163-L199 | train | Returns the last visits details for a specific site | [
30522,
2270,
3853,
2131,
8523,
9189,
17417,
3215,
3207,
22081,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1027,
6270,
1010,
1002,
3058,
1027,
6270,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
4175,
11365,
27287,
3406,
7959,
10649,
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/Widget/WidgetConfig.php | WidgetConfig.getUniqueId | public function getUniqueId()
{
$parameters = $this->getParameters();
unset($parameters['module']);
unset($parameters['action']);
return WidgetsList::getWidgetUniqueId($this->getModule(), $this->getAction(), $parameters);
} | php | public function getUniqueId()
{
$parameters = $this->getParameters();
unset($parameters['module']);
unset($parameters['action']);
return WidgetsList::getWidgetUniqueId($this->getModule(), $this->getAction(), $parameters);
} | [
"public",
"function",
"getUniqueId",
"(",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"unset",
"(",
"$",
"parameters",
"[",
"'module'",
"]",
")",
";",
"unset",
"(",
"$",
"parameters",
"[",
"'action'",
"]",
")",
... | Returns the unique id of an widget based on module, action and the set parameters.
@return string | [
"Returns",
"the",
"unique",
"id",
"of",
"an",
"widget",
"based",
"on",
"module",
"action",
"and",
"the",
"set",
"parameters",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Widget/WidgetConfig.php#L270-L277 | train | Returns the unique id of the widget | [
30522,
2270,
3853,
2131,
19496,
4226,
3593,
1006,
1007,
1063,
1002,
11709,
1027,
1002,
2023,
1011,
1028,
2131,
28689,
22828,
2015,
1006,
1007,
1025,
4895,
13462,
1006,
1002,
11709,
1031,
1005,
11336,
1005,
1033,
1007,
1025,
4895,
13462,
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... |
symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.eq | public function eq($position)
{
if (isset($this->nodes[$position])) {
return $this->createSubCrawler($this->nodes[$position]);
}
return $this->createSubCrawler(null);
} | php | public function eq($position)
{
if (isset($this->nodes[$position])) {
return $this->createSubCrawler($this->nodes[$position]);
}
return $this->createSubCrawler(null);
} | [
"public",
"function",
"eq",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
"position",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createSubCrawler",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
... | Returns a node given its position in the node list.
@param int $position The position
@return self | [
"Returns",
"a",
"node",
"given",
"its",
"position",
"in",
"the",
"node",
"list",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L330-L337 | train | Return the node at the position in the nodes array | [
30522,
2270,
3853,
1041,
4160,
1006,
1002,
2597,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
14164,
1031,
1002,
2597,
1033,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
9005,
12083,
26775,
10376,
3917,
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... |
walkor/Workerman | Worker.php | Worker.getAllWorkerPids | protected static function getAllWorkerPids()
{
$pid_array = array();
foreach (static::$_pidMap as $worker_pid_array) {
foreach ($worker_pid_array as $worker_pid) {
$pid_array[$worker_pid] = $worker_pid;
}
}
return $pid_array;
} | php | protected static function getAllWorkerPids()
{
$pid_array = array();
foreach (static::$_pidMap as $worker_pid_array) {
foreach ($worker_pid_array as $worker_pid) {
$pid_array[$worker_pid] = $worker_pid;
}
}
return $pid_array;
} | [
"protected",
"static",
"function",
"getAllWorkerPids",
"(",
")",
"{",
"$",
"pid_array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"static",
"::",
"$",
"_pidMap",
"as",
"$",
"worker_pid_array",
")",
"{",
"foreach",
"(",
"$",
"worker_pid_array",
"as",
"$"... | Get all pids of worker processes.
@return array | [
"Get",
"all",
"pids",
"of",
"worker",
"processes",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1273-L1282 | train | Get all worker pids | [
30522,
5123,
10763,
3853,
2131,
8095,
6198,
2121,
23267,
2015,
1006,
1007,
1063,
1002,
14255,
2094,
1035,
9140,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
10763,
1024,
1024,
1002,
1035,
14255,
22117,
9331,
2004,
1002,
7309,
1035,
1425... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/RouteUrlGenerator.php | RouteUrlGenerator.replaceRootParameters | protected function replaceRootParameters($route, $domain, &$parameters)
{
$scheme = $this->getRouteScheme($route);
return $this->replaceRouteParameters(
$this->url->formatRoot($scheme, $domain), $parameters
);
} | php | protected function replaceRootParameters($route, $domain, &$parameters)
{
$scheme = $this->getRouteScheme($route);
return $this->replaceRouteParameters(
$this->url->formatRoot($scheme, $domain), $parameters
);
} | [
"protected",
"function",
"replaceRootParameters",
"(",
"$",
"route",
",",
"$",
"domain",
",",
"&",
"$",
"parameters",
")",
"{",
"$",
"scheme",
"=",
"$",
"this",
"->",
"getRouteScheme",
"(",
"$",
"route",
")",
";",
"return",
"$",
"this",
"->",
"replaceRou... | Replace the parameters on the root path.
@param \Illuminate\Routing\Route $route
@param string $domain
@param array $parameters
@return string | [
"Replace",
"the",
"parameters",
"on",
"the",
"root",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteUrlGenerator.php#L179-L186 | train | Replace root parameters of route | [
30522,
5123,
3853,
5672,
3217,
4140,
28689,
22828,
2015,
1006,
1002,
2799,
1010,
1002,
5884,
1010,
1004,
1002,
11709,
1007,
1063,
1002,
5679,
1027,
1002,
2023,
1011,
1028,
2131,
22494,
4570,
5403,
4168,
1006,
1002,
2799,
1007,
1025,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Goals/API.php | API.getMetrics | public function getMetrics($idSite, $period, $date, $segment = false, $idGoal = false, $columns = array(), $showAllGoalSpecificMetrics = false)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Archive::build($idSite, $period, $date, $segment);
$showAllGoalSpecificMetrics = $showAllGoalSpecificMetrics && $idGoal === false;
// Mapping string idGoal to internal ID
$idGoal = self::convertSpecialGoalIds($idGoal);
$isEcommerceGoal = $idGoal === GoalManager::IDGOAL_ORDER || $idGoal === GoalManager::IDGOAL_CART;
$allMetrics = Goals::getGoalColumns($idGoal);
if ($showAllGoalSpecificMetrics) {
foreach ($this->getGoals($idSite) as $aGoal) {
foreach (Goals::getGoalColumns($aGoal['idgoal']) as $goalColumn) {
$allMetrics[] = Goals::makeGoalColumn($aGoal['idgoal'], $goalColumn);
}
}
$allMetrics[] = 'nb_visits';
}
$columnsToShow = Piwik::getArrayFromApiParameter($columns);
$requestedColumns = $columnsToShow;
$shouldAddAverageOrderRevenue = (in_array('avg_order_revenue', $requestedColumns) || empty($requestedColumns)) && $isEcommerceGoal;
if ($shouldAddAverageOrderRevenue && !empty($requestedColumns)) {
$avgOrder = new AverageOrderRevenue();
$metricsToAdd = $avgOrder->getDependentMetrics();
$requestedColumns = array_unique(array_merge($requestedColumns, $metricsToAdd));
}
if ($showAllGoalSpecificMetrics && !empty($requestedColumns)) {
foreach ($requestedColumns as $requestedColumn) {
if (strpos($requestedColumn, '_conversion_rate') !== false) {
$columnIdGoal = Goals::getGoalIdFromGoalColumn($requestedColumn);
if ($columnIdGoal) {
$goalConversionRate = new GoalConversionRate($idSite, $columnIdGoal);
$metricsToAdd = $goalConversionRate->getDependentMetrics();
$requestedColumns = array_unique(array_merge($requestedColumns, $metricsToAdd));
}
}
}
}
$report = ReportsProvider::factory('Goals', 'getMetrics');
$columnsToGet = $report->getMetricsRequiredForReport($allMetrics, $requestedColumns);
$inDbMetricNames = array_map(function ($name) use ($idGoal) {
$name = str_replace('goal_', '', $name);
return $name == 'nb_visits' ? $name : Archiver::getRecordName($name, $idGoal);
}, $columnsToGet);
$dataTable = $archive->getDataTableFromNumeric($inDbMetricNames);
if (count($columnsToGet) > 0) {
$newNameMapping = array_combine($inDbMetricNames, $columnsToGet);
} else {
$newNameMapping = array();
}
$dataTable->filter('ReplaceColumnNames', array($newNameMapping));
// TODO: this should be in Goals/Get.php but it depends on idGoal parameter which isn't always in _GET (ie,
// it's not in ProcessedReport.php). more refactoring must be done to report class before this can be
// corrected.
if ($shouldAddAverageOrderRevenue) {
$dataTable->filter(function (DataTable $table) {
$extraProcessedMetrics = $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME);
if (empty($extraProcessedMetrics)) {
$extraProcessedMetrics = array();
}
$extraProcessedMetrics[] = new AverageOrderRevenue();
$table->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics);
});
}
if ($showAllGoalSpecificMetrics) {
$dataTable->filter(function (DataTable $table) use($idSite, &$allMetrics, $requestedColumns) {
$extraProcessedMetrics = $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME);
if (empty($extraProcessedMetrics)) {
$extraProcessedMetrics = array();
}
foreach ($this->getGoals($idSite) as $aGoal) {
$metric = new GoalConversionRate($idSite, $aGoal['idgoal']);
if (!empty($requestedColumns) && !in_array($metric->getName(), $requestedColumns)) {
continue;
}
$extraProcessedMetrics[] = $metric;
$allMetrics[] = $metric->getName();
}
$table->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics);
});
}
// remove temporary metrics that were not explicitly requested
if (empty($columnsToShow)) {
$columnsToShow = $allMetrics;
$columnsToShow[] = 'conversion_rate';
if ($isEcommerceGoal) {
$columnsToShow[] = 'avg_order_revenue';
}
}
$dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow));
return $dataTable;
} | php | public function getMetrics($idSite, $period, $date, $segment = false, $idGoal = false, $columns = array(), $showAllGoalSpecificMetrics = false)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Archive::build($idSite, $period, $date, $segment);
$showAllGoalSpecificMetrics = $showAllGoalSpecificMetrics && $idGoal === false;
// Mapping string idGoal to internal ID
$idGoal = self::convertSpecialGoalIds($idGoal);
$isEcommerceGoal = $idGoal === GoalManager::IDGOAL_ORDER || $idGoal === GoalManager::IDGOAL_CART;
$allMetrics = Goals::getGoalColumns($idGoal);
if ($showAllGoalSpecificMetrics) {
foreach ($this->getGoals($idSite) as $aGoal) {
foreach (Goals::getGoalColumns($aGoal['idgoal']) as $goalColumn) {
$allMetrics[] = Goals::makeGoalColumn($aGoal['idgoal'], $goalColumn);
}
}
$allMetrics[] = 'nb_visits';
}
$columnsToShow = Piwik::getArrayFromApiParameter($columns);
$requestedColumns = $columnsToShow;
$shouldAddAverageOrderRevenue = (in_array('avg_order_revenue', $requestedColumns) || empty($requestedColumns)) && $isEcommerceGoal;
if ($shouldAddAverageOrderRevenue && !empty($requestedColumns)) {
$avgOrder = new AverageOrderRevenue();
$metricsToAdd = $avgOrder->getDependentMetrics();
$requestedColumns = array_unique(array_merge($requestedColumns, $metricsToAdd));
}
if ($showAllGoalSpecificMetrics && !empty($requestedColumns)) {
foreach ($requestedColumns as $requestedColumn) {
if (strpos($requestedColumn, '_conversion_rate') !== false) {
$columnIdGoal = Goals::getGoalIdFromGoalColumn($requestedColumn);
if ($columnIdGoal) {
$goalConversionRate = new GoalConversionRate($idSite, $columnIdGoal);
$metricsToAdd = $goalConversionRate->getDependentMetrics();
$requestedColumns = array_unique(array_merge($requestedColumns, $metricsToAdd));
}
}
}
}
$report = ReportsProvider::factory('Goals', 'getMetrics');
$columnsToGet = $report->getMetricsRequiredForReport($allMetrics, $requestedColumns);
$inDbMetricNames = array_map(function ($name) use ($idGoal) {
$name = str_replace('goal_', '', $name);
return $name == 'nb_visits' ? $name : Archiver::getRecordName($name, $idGoal);
}, $columnsToGet);
$dataTable = $archive->getDataTableFromNumeric($inDbMetricNames);
if (count($columnsToGet) > 0) {
$newNameMapping = array_combine($inDbMetricNames, $columnsToGet);
} else {
$newNameMapping = array();
}
$dataTable->filter('ReplaceColumnNames', array($newNameMapping));
// TODO: this should be in Goals/Get.php but it depends on idGoal parameter which isn't always in _GET (ie,
// it's not in ProcessedReport.php). more refactoring must be done to report class before this can be
// corrected.
if ($shouldAddAverageOrderRevenue) {
$dataTable->filter(function (DataTable $table) {
$extraProcessedMetrics = $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME);
if (empty($extraProcessedMetrics)) {
$extraProcessedMetrics = array();
}
$extraProcessedMetrics[] = new AverageOrderRevenue();
$table->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics);
});
}
if ($showAllGoalSpecificMetrics) {
$dataTable->filter(function (DataTable $table) use($idSite, &$allMetrics, $requestedColumns) {
$extraProcessedMetrics = $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME);
if (empty($extraProcessedMetrics)) {
$extraProcessedMetrics = array();
}
foreach ($this->getGoals($idSite) as $aGoal) {
$metric = new GoalConversionRate($idSite, $aGoal['idgoal']);
if (!empty($requestedColumns) && !in_array($metric->getName(), $requestedColumns)) {
continue;
}
$extraProcessedMetrics[] = $metric;
$allMetrics[] = $metric->getName();
}
$table->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics);
});
}
// remove temporary metrics that were not explicitly requested
if (empty($columnsToShow)) {
$columnsToShow = $allMetrics;
$columnsToShow[] = 'conversion_rate';
if ($isEcommerceGoal) {
$columnsToShow[] = 'avg_order_revenue';
}
}
$dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow));
return $dataTable;
} | [
"public",
"function",
"getMetrics",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"idGoal",
"=",
"false",
",",
"$",
"columns",
"=",
"array",
"(",
")",
",",
"$",
"showAllGoalSpecificMetrics",
"=",... | Similar to {@link get()} but does not return any metrics for new and returning visitors. It won't apply
any segment by default. This method is deprecated from the API as it is only there to make the implementation of
the actual {@link get()} method easy.
@deprecated
@internal | [
"Similar",
"to",
"{",
"@link",
"get",
"()",
"}",
"but",
"does",
"not",
"return",
"any",
"metrics",
"for",
"new",
"and",
"returning",
"visitors",
".",
"It",
"won",
"t",
"apply",
"any",
"segment",
"by",
"default",
".",
"This",
"method",
"is",
"deprecated",... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/API.php#L476-L583 | train | Returns metrics for the given site | [
30522,
2270,
3853,
2131,
12589,
2015,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
8909,
3995,
2389,
1027,
6270,
1010,
1002,
7753,
1027,
9140,
1006,
1007,
1010,
1002,
2265,
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... |
z-song/laravel-admin | src/Grid.php | Grid.buildRows | protected function buildRows(array $data)
{
$this->rows = collect($data)->map(function ($model, $number) {
return new Row($number, $model);
});
if ($this->rowsCallback) {
$this->rows->map($this->rowsCallback);
}
} | php | protected function buildRows(array $data)
{
$this->rows = collect($data)->map(function ($model, $number) {
return new Row($number, $model);
});
if ($this->rowsCallback) {
$this->rows->map($this->rowsCallback);
}
} | [
"protected",
"function",
"buildRows",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"rows",
"=",
"collect",
"(",
"$",
"data",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"model",
",",
"$",
"number",
")",
"{",
"return",
"new",
"Row",
"(",... | Build the grid rows.
@param array $data
@return void | [
"Build",
"the",
"grid",
"rows",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L602-L611 | train | Build rows from array | [
30522,
5123,
3853,
3857,
10524,
2015,
1006,
9140,
1002,
2951,
1007,
1063,
1002,
2023,
1011,
1028,
10281,
1027,
8145,
1006,
1002,
2951,
1007,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
2944,
1010,
1002,
2193,
1007,
1063,
2709,
2047,
5216,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php | PropertyNormalizer.getAttributeValue | protected function getAttributeValue($object, $attribute, $format = null, array $context = [])
{
try {
$reflectionProperty = $this->getReflectionProperty($object, $attribute);
} catch (\ReflectionException $reflectionException) {
return;
}
// Override visibility
if (!$reflectionProperty->isPublic()) {
$reflectionProperty->setAccessible(true);
}
return $reflectionProperty->getValue($object);
} | php | protected function getAttributeValue($object, $attribute, $format = null, array $context = [])
{
try {
$reflectionProperty = $this->getReflectionProperty($object, $attribute);
} catch (\ReflectionException $reflectionException) {
return;
}
// Override visibility
if (!$reflectionProperty->isPublic()) {
$reflectionProperty->setAccessible(true);
}
return $reflectionProperty->getValue($object);
} | [
"protected",
"function",
"getAttributeValue",
"(",
"$",
"object",
",",
"$",
"attribute",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"reflectionProperty",
"=",
"$",
"this",
"->",
"getReflection... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php#L121-L135 | train | Get the value of an attribute from an object | [
30522,
5123,
3853,
2131,
19321,
3089,
8569,
2618,
10175,
5657,
1006,
1002,
4874,
1010,
1002,
17961,
1010,
1002,
4289,
1027,
19701,
1010,
30524,
24422,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2058,
15637,
16476,
2065,
1006,
999,
1002,
9185... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php | JsonDescriptor.describeRouteCollection | protected function describeRouteCollection(RouteCollection $routes, array $options = [])
{
$data = [];
foreach ($routes->all() as $name => $route) {
$data[$name] = $this->getRouteData($route);
}
$this->writeData($data, $options);
} | php | protected function describeRouteCollection(RouteCollection $routes, array $options = [])
{
$data = [];
foreach ($routes->all() as $name => $route) {
$data[$name] = $this->getRouteData($route);
}
$this->writeData($data, $options);
} | [
"protected",
"function",
"describeRouteCollection",
"(",
"RouteCollection",
"$",
"routes",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"routes",
"->",
"all",
"(",
")",
"as",
"$",
"name",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php#L36-L44 | train | Describes the route collection | [
30522,
5123,
3853,
6235,
22494,
26557,
14511,
18491,
1006,
2799,
26895,
18491,
1002,
5847,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
2951,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
5847,
1011,
1028,
2035,
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... |
overtrue/wechat | src/OfficialAccount/Device/Client.php | Client.bind | public function bind(string $openid, string $deviceId, string $ticket)
{
$params = [
'ticket' => $ticket,
'device_id' => $deviceId,
'openid' => $openid,
];
return $this->httpPostJson('device/bind', $params);
} | php | public function bind(string $openid, string $deviceId, string $ticket)
{
$params = [
'ticket' => $ticket,
'device_id' => $deviceId,
'openid' => $openid,
];
return $this->httpPostJson('device/bind', $params);
} | [
"public",
"function",
"bind",
"(",
"string",
"$",
"openid",
",",
"string",
"$",
"deviceId",
",",
"string",
"$",
"ticket",
")",
"{",
"$",
"params",
"=",
"[",
"'ticket'",
"=>",
"$",
"ticket",
",",
"'device_id'",
"=>",
"$",
"deviceId",
",",
"'openid'",
"=... | @param string $openid
@param string $deviceId
@param string $ticket
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string | [
"@param",
"string",
"$openid",
"@param",
"string",
"$deviceId",
"@param",
"string",
"$ticket"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Device/Client.php#L103-L112 | train | Bind a device to a device | [
30522,
2270,
3853,
14187,
1006,
5164,
1002,
2330,
3593,
1010,
5164,
1002,
5080,
3593,
1010,
5164,
1002,
7281,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
7281,
1005,
1027,
1028,
1002,
7281,
1010,
1005,
5080,
1035,
8909,
30524,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.createTable | public function createTable($table, $columnNames, $primaryKey = array())
{
$table = $this->prefixTable($table);
if (!empty($primaryKey) && !is_array($primaryKey)) {
$primaryKey = array($primaryKey);
}
return $this->container->make('Piwik\Updater\Migration\Db\CreateTable', array(
'table' => $table, 'columnNames' => $columnNames, 'primaryKey' => $primaryKey
));
} | php | public function createTable($table, $columnNames, $primaryKey = array())
{
$table = $this->prefixTable($table);
if (!empty($primaryKey) && !is_array($primaryKey)) {
$primaryKey = array($primaryKey);
}
return $this->container->make('Piwik\Updater\Migration\Db\CreateTable', array(
'table' => $table, 'columnNames' => $columnNames, 'primaryKey' => $primaryKey
));
} | [
"public",
"function",
"createTable",
"(",
"$",
"table",
",",
"$",
"columnNames",
",",
"$",
"primaryKey",
"=",
"array",
"(",
")",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"if",
"(",
"!",
"empty",
"(... | Creates a new database table.
@param string $table Unprefixed database table name, eg 'log_visit'.
@param array $columnNames An array of column names and their type they should use. For example:
array('column_name_1' => 'VARCHAR(200) NOT NULL', 'column_name_2' => 'INT(10) DEFAULT 0')
@param string|string[] $primaryKey Optional. One or multiple columns that shall define the primary key.
@return CreateTable | [
"Creates",
"a",
"new",
"database",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L92-L103 | train | Creates a new migration table | [
30522,
2270,
3853,
3443,
10880,
1006,
1002,
2795,
1010,
1002,
5930,
18442,
2015,
1010,
1002,
3078,
14839,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,
1006,
1002,
2795,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Builder.php | Builder.paginate | public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
{
$page = $page ?: Paginator::resolveCurrentPage($pageName);
$perPage = $perPage ?: $this->model->getPerPage();
$results = ($total = $this->toBase()->getCountForPagination())
? $this->forPage($page, $perPage)->get($columns)
: $this->model->newCollection();
return $this->paginator($results, $total, $perPage, $page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => $pageName,
]);
} | php | public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
{
$page = $page ?: Paginator::resolveCurrentPage($pageName);
$perPage = $perPage ?: $this->model->getPerPage();
$results = ($total = $this->toBase()->getCountForPagination())
? $this->forPage($page, $perPage)->get($columns)
: $this->model->newCollection();
return $this->paginator($results, $total, $perPage, $page, [
'path' => Paginator::resolveCurrentPath(),
'pageName' => $pageName,
]);
} | [
"public",
"function",
"paginate",
"(",
"$",
"perPage",
"=",
"null",
",",
"$",
"columns",
"=",
"[",
"'*'",
"]",
",",
"$",
"pageName",
"=",
"'page'",
",",
"$",
"page",
"=",
"null",
")",
"{",
"$",
"page",
"=",
"$",
"page",
"?",
":",
"Paginator",
"::... | Paginate the given query.
@param int $perPage
@param array $columns
@param string $pageName
@param int|null $page
@return \Illuminate\Contracts\Pagination\LengthAwarePaginator
@throws \InvalidArgumentException | [
"Paginate",
"the",
"given",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L742-L756 | train | Paginate the results of the query | [
30522,
2270,
3853,
6643,
20876,
2618,
1006,
1002,
2566,
13704,
1027,
19701,
1010,
1002,
7753,
1027,
1031,
1005,
1008,
1005,
1033,
1010,
1002,
3931,
18442,
1027,
1005,
3931,
1005,
1010,
1002,
3931,
1027,
19701,
1007,
1063,
1002,
3931,
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... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | SQLiteGrammar.compileDropColumn | public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
{
$tableDiff = $this->getDoctrineTableDiff(
$blueprint, $schema = $connection->getDoctrineSchemaManager()
);
foreach ($command->columns as $name) {
$tableDiff->removedColumns[$name] = $connection->getDoctrineColumn(
$this->getTablePrefix().$blueprint->getTable(), $name
);
}
return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff);
} | php | public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
{
$tableDiff = $this->getDoctrineTableDiff(
$blueprint, $schema = $connection->getDoctrineSchemaManager()
);
foreach ($command->columns as $name) {
$tableDiff->removedColumns[$name] = $connection->getDoctrineColumn(
$this->getTablePrefix().$blueprint->getTable(), $name
);
}
return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff);
} | [
"public",
"function",
"compileDropColumn",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
",",
"Connection",
"$",
"connection",
")",
"{",
"$",
"tableDiff",
"=",
"$",
"this",
"->",
"getDoctrineTableDiff",
"(",
"$",
"blueprint",
",",
"$",
"... | Compile a drop column command.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@param \Illuminate\Database\Connection $connection
@return array | [
"Compile",
"a",
"drop",
"column",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php#L264-L277 | train | Compile drop column SQL | [
30522,
2270,
3853,
9227,
18981,
25778,
2819,
2078,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1010,
4434,
1002,
4434,
1007,
1063,
1002,
2795,
4305,
4246,
1027,
1002,
2023,
1011,
1028,
2131,
3527,
6593,
11467,
10880,
4305... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.requestServerFile | public function requestServerFile($uri, $fileCode, $expectedHash, $postData = [])
{
$filePath = $this->getFilePath($fileCode);
$result = Http::post($this->createServerUrl($uri), function ($http) use ($postData, $filePath) {
$this->applyHttpAttributes($http, $postData);
$http->toFile($filePath);
});
if ($result->code != 200) {
throw new ApplicationException(File::get($filePath));
}
if (md5_file($filePath) != $expectedHash) {
@unlink($filePath);
throw new ApplicationException(Lang::get('system::lang.server.file_corrupt'));
}
} | php | public function requestServerFile($uri, $fileCode, $expectedHash, $postData = [])
{
$filePath = $this->getFilePath($fileCode);
$result = Http::post($this->createServerUrl($uri), function ($http) use ($postData, $filePath) {
$this->applyHttpAttributes($http, $postData);
$http->toFile($filePath);
});
if ($result->code != 200) {
throw new ApplicationException(File::get($filePath));
}
if (md5_file($filePath) != $expectedHash) {
@unlink($filePath);
throw new ApplicationException(Lang::get('system::lang.server.file_corrupt'));
}
} | [
"public",
"function",
"requestServerFile",
"(",
"$",
"uri",
",",
"$",
"fileCode",
",",
"$",
"expectedHash",
",",
"$",
"postData",
"=",
"[",
"]",
")",
"{",
"$",
"filePath",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
"$",
"fileCode",
")",
";",
"$",
"r... | Downloads a file from the update server.
@param string $uri Gateway API URI
@param string $fileCode A unique code for saving the file.
@param string $expectedHash The expected file hash of the file.
@param array $postData Extra post data
@return void | [
"Downloads",
"a",
"file",
"from",
"the",
"update",
"server",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L858-L875 | train | Request server file | [
30522,
2270,
3853,
11186,
2121,
6299,
8873,
2571,
1006,
1002,
24471,
2072,
1010,
1002,
5371,
16044,
1010,
1002,
3517,
14949,
2232,
1010,
1002,
2695,
2850,
2696,
1027,
1031,
1033,
1007,
1063,
1002,
5371,
15069,
1027,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php | SimpleAuthenticationHandler.onAuthenticationFailure | public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
if ($this->simpleAuthenticator instanceof AuthenticationFailureHandlerInterface) {
if ($this->logger) {
$this->logger->debug('Selected an authentication failure handler.', ['handler' => \get_class($this->simpleAuthenticator)]);
}
$response = $this->simpleAuthenticator->onAuthenticationFailure($request, $exception);
if ($response instanceof Response) {
return $response;
}
if (null !== $response) {
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object', \get_class($this->simpleAuthenticator)));
}
}
if ($this->logger) {
$this->logger->debug('Fallback to the default authentication failure handler.');
}
return $this->failureHandler->onAuthenticationFailure($request, $exception);
} | php | public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
if ($this->simpleAuthenticator instanceof AuthenticationFailureHandlerInterface) {
if ($this->logger) {
$this->logger->debug('Selected an authentication failure handler.', ['handler' => \get_class($this->simpleAuthenticator)]);
}
$response = $this->simpleAuthenticator->onAuthenticationFailure($request, $exception);
if ($response instanceof Response) {
return $response;
}
if (null !== $response) {
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object', \get_class($this->simpleAuthenticator)));
}
}
if ($this->logger) {
$this->logger->debug('Fallback to the default authentication failure handler.');
}
return $this->failureHandler->onAuthenticationFailure($request, $exception);
} | [
"public",
"function",
"onAuthenticationFailure",
"(",
"Request",
"$",
"request",
",",
"AuthenticationException",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"simpleAuthenticator",
"instanceof",
"AuthenticationFailureHandlerInterface",
")",
"{",
"if",
"("... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php#L85-L107 | train | Return the response from the failure handler | [
30522,
2270,
3853,
2006,
4887,
10760,
16778,
10719,
7011,
4014,
5397,
1006,
5227,
1002,
5227,
1010,
27280,
10288,
24422,
1002,
6453,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3722,
4887,
10760,
16778,
11266,
2953,
6013,
11253,
27280,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Exception/Handler.php | Handler.renderException | public static function renderException(\Exception $exception)
{
$error = new MessageBag([
'type' => get_class($exception),
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTraceAsString(),
]);
$errors = new ViewErrorBag();
$errors->put('exception', $error);
return view('admin::partials.exception', compact('errors'))->render();
} | php | public static function renderException(\Exception $exception)
{
$error = new MessageBag([
'type' => get_class($exception),
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTraceAsString(),
]);
$errors = new ViewErrorBag();
$errors->put('exception', $error);
return view('admin::partials.exception', compact('errors'))->render();
} | [
"public",
"static",
"function",
"renderException",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"$",
"error",
"=",
"new",
"MessageBag",
"(",
"[",
"'type'",
"=>",
"get_class",
"(",
"$",
"exception",
")",
",",
"'message'",
"=>",
"$",
"exception",
"->"... | Render exception.
@param \Exception $exception
@return string | [
"Render",
"exception",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Exception/Handler.php#L17-L31 | train | Render exception view | [
30522,
2270,
10763,
3853,
17552,
10288,
24422,
1006,
1032,
6453,
1002,
6453,
1007,
1063,
1002,
7561,
1027,
2047,
4471,
16078,
1006,
1031,
1005,
2828,
1005,
1027,
1028,
2131,
1035,
2465,
1006,
1002,
6453,
1007,
1010,
1005,
4471,
1005,
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... |
laravel/framework | src/Illuminate/Support/Str.php | Str.replaceLast | public static function replaceLast($search, $replace, $subject)
{
$position = strrpos($subject, $search);
if ($position !== false) {
return substr_replace($subject, $replace, $position, strlen($search));
}
return $subject;
} | php | public static function replaceLast($search, $replace, $subject)
{
$position = strrpos($subject, $search);
if ($position !== false) {
return substr_replace($subject, $replace, $position, strlen($search));
}
return $subject;
} | [
"public",
"static",
"function",
"replaceLast",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"subject",
")",
"{",
"$",
"position",
"=",
"strrpos",
"(",
"$",
"subject",
",",
"$",
"search",
")",
";",
"if",
"(",
"$",
"position",
"!==",
"false",
")"... | Replace the last occurrence of a given value in the string.
@param string $search
@param string $replace
@param string $subject
@return string | [
"Replace",
"the",
"last",
"occurrence",
"of",
"a",
"given",
"value",
"in",
"the",
"string",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L372-L381 | train | Replace last part of string | [
30522,
2270,
10763,
3853,
5672,
8523,
2102,
1006,
1002,
3945,
1010,
1002,
5672,
1010,
1002,
3395,
1007,
1063,
1002,
2597,
1027,
2358,
12171,
6873,
2015,
1006,
1002,
3395,
1010,
1002,
3945,
1007,
1025,
2065,
1006,
1002,
2597,
999,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UsersManager/API.php | API.addUser | public function addUser($userLogin, $password, $email, $alias = false, $_isPasswordHashed = false, $initialIdSite = null)
{
Piwik::checkUserHasSomeAdminAccess();
if (!Piwik::hasUserSuperUserAccess()) {
if (empty($initialIdSite)) {
throw new \Exception(Piwik::translate("UsersManager_AddUserNoInitialAccessError"));
}
Piwik::checkUserHasAdminAccess($initialIdSite);
}
$this->checkLogin($userLogin);
$this->checkEmail($email);
$password = Common::unsanitizeInputValue($password);
if (!$_isPasswordHashed) {
UsersManager::checkPassword($password);
$passwordTransformed = UsersManager::getPasswordHash($password);
} else {
$passwordTransformed = $password;
}
$alias = $this->getCleanAlias($alias, $userLogin);
$passwordTransformed = $this->password->hash($passwordTransformed);
$token_auth = $this->createTokenAuth($userLogin);
$this->model->addUser($userLogin, $passwordTransformed, $email, $alias, $token_auth, Date::now()->getDatetime());
// we reload the access list which doesn't yet take in consideration this new user
Access::getInstance()->reloadAccess();
Cache::deleteTrackerCache();
/**
* Triggered after a new user is created.
*
* @param string $userLogin The new user's login handle.
*/
Piwik::postEvent('UsersManager.addUser.end', array($userLogin, $email, $password, $alias));
if ($initialIdSite) {
$this->setUserAccess($userLogin, 'view', $initialIdSite);
}
} | php | public function addUser($userLogin, $password, $email, $alias = false, $_isPasswordHashed = false, $initialIdSite = null)
{
Piwik::checkUserHasSomeAdminAccess();
if (!Piwik::hasUserSuperUserAccess()) {
if (empty($initialIdSite)) {
throw new \Exception(Piwik::translate("UsersManager_AddUserNoInitialAccessError"));
}
Piwik::checkUserHasAdminAccess($initialIdSite);
}
$this->checkLogin($userLogin);
$this->checkEmail($email);
$password = Common::unsanitizeInputValue($password);
if (!$_isPasswordHashed) {
UsersManager::checkPassword($password);
$passwordTransformed = UsersManager::getPasswordHash($password);
} else {
$passwordTransformed = $password;
}
$alias = $this->getCleanAlias($alias, $userLogin);
$passwordTransformed = $this->password->hash($passwordTransformed);
$token_auth = $this->createTokenAuth($userLogin);
$this->model->addUser($userLogin, $passwordTransformed, $email, $alias, $token_auth, Date::now()->getDatetime());
// we reload the access list which doesn't yet take in consideration this new user
Access::getInstance()->reloadAccess();
Cache::deleteTrackerCache();
/**
* Triggered after a new user is created.
*
* @param string $userLogin The new user's login handle.
*/
Piwik::postEvent('UsersManager.addUser.end', array($userLogin, $email, $password, $alias));
if ($initialIdSite) {
$this->setUserAccess($userLogin, 'view', $initialIdSite);
}
} | [
"public",
"function",
"addUser",
"(",
"$",
"userLogin",
",",
"$",
"password",
",",
"$",
"email",
",",
"$",
"alias",
"=",
"false",
",",
"$",
"_isPasswordHashed",
"=",
"false",
",",
"$",
"initialIdSite",
"=",
"null",
")",
"{",
"Piwik",
"::",
"checkUserHasS... | Add a user in the database.
A user is defined by
- a login that has to be unique and valid
- a password that has to be valid
- an alias
- an email that has to be in a correct format
@see userExists()
@see isValidLoginString()
@see isValidPasswordString()
@see isValidEmailString()
@exception in case of an invalid parameter | [
"Add",
"a",
"user",
"in",
"the",
"database",
".",
"A",
"user",
"is",
"defined",
"by",
"-",
"a",
"login",
"that",
"has",
"to",
"be",
"unique",
"and",
"valid",
"-",
"a",
"password",
"that",
"has",
"to",
"be",
"valid",
"-",
"an",
"alias",
"-",
"an",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L650-L695 | train | Add a new user to the user table | [
30522,
2270,
3853,
5587,
20330,
1006,
1002,
5310,
21197,
2378,
1010,
1002,
20786,
1010,
1002,
10373,
1010,
1002,
14593,
1027,
6270,
1010,
1002,
1035,
2003,
15194,
18351,
14949,
9072,
1027,
6270,
1010,
1002,
3988,
9821,
4221,
1027,
19701,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Flex/Storage/FolderStorage.php | FolderStorage.updateRows | public function updateRows(array $rows): array
{
$list = [];
foreach ($rows as $key => $row) {
$key = (string)$key;
if (!$this->hasKey($key)) {
$list[$key] = null;
} else {
$path = $this->getPathFromKey($key);
$file = $this->getFile($path);
$list[$key] = $this->saveFile($file, $row);
}
}
return $list;
} | php | public function updateRows(array $rows): array
{
$list = [];
foreach ($rows as $key => $row) {
$key = (string)$key;
if (!$this->hasKey($key)) {
$list[$key] = null;
} else {
$path = $this->getPathFromKey($key);
$file = $this->getFile($path);
$list[$key] = $this->saveFile($file, $row);
}
}
return $list;
} | [
"public",
"function",
"updateRows",
"(",
"array",
"$",
"rows",
")",
":",
"array",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"key",
"=>",
"$",
"row",
")",
"{",
"$",
"key",
"=",
"(",
"string",
")",
"$",
"key",
... | {@inheritdoc}
@see FlexStorageInterface::updateRows() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/FolderStorage.php#L129-L144 | train | Updates rows in the table | [
30522,
2270,
3853,
10651,
10524,
2015,
1006,
9140,
1002,
10281,
1007,
1024,
9140,
1063,
1002,
2862,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
10281,
2004,
1002,
3145,
1027,
1028,
1002,
5216,
1007,
1063,
1002,
3145,
1027,
1006,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Adapter/TraceableAdapter.php | TraceableAdapter.get | public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
if (!$this->pool instanceof CacheInterface) {
throw new \BadMethodCallException(sprintf('Cannot call "%s::get()": this class doesn\'t implement "%s".', \get_class($this->pool), CacheInterface::class));
}
$isHit = true;
$callback = function (CacheItem $item) use ($callback, &$isHit) {
$isHit = $item->isHit();
return $callback($item);
};
$event = $this->start(__FUNCTION__);
try {
$value = $this->pool->get($key, $callback, $beta, $metadata);
$event->result[$key] = \is_object($value) ? \get_class($value) : \gettype($value);
} finally {
$event->end = microtime(true);
}
if ($isHit) {
++$event->hits;
} else {
++$event->misses;
}
return $value;
} | php | public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
if (!$this->pool instanceof CacheInterface) {
throw new \BadMethodCallException(sprintf('Cannot call "%s::get()": this class doesn\'t implement "%s".', \get_class($this->pool), CacheInterface::class));
}
$isHit = true;
$callback = function (CacheItem $item) use ($callback, &$isHit) {
$isHit = $item->isHit();
return $callback($item);
};
$event = $this->start(__FUNCTION__);
try {
$value = $this->pool->get($key, $callback, $beta, $metadata);
$event->result[$key] = \is_object($value) ? \get_class($value) : \gettype($value);
} finally {
$event->end = microtime(true);
}
if ($isHit) {
++$event->hits;
} else {
++$event->misses;
}
return $value;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
",",
"callable",
"$",
"callback",
",",
"float",
"$",
"beta",
"=",
"null",
",",
"array",
"&",
"$",
"metadata",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"pool",
"instanceof",
"C... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php#L41-L68 | train | Get value from cache | [
30522,
2270,
3853,
2131,
1006,
5164,
1002,
3145,
1010,
2655,
3085,
1002,
2655,
5963,
1010,
14257,
1002,
8247,
1027,
19701,
1010,
9140,
1004,
1002,
27425,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
4770,
6013,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DoctrineOrmTypeGuesser.php | DoctrineOrmTypeGuesser.guessType | public function guessType($class, $property)
{
if (!$ret = $this->getMetadata($class)) {
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
}
list($metadata, $name) = $ret;
if ($metadata->hasAssociation($property)) {
$multiple = $metadata->isCollectionValuedAssociation($property);
$mapping = $metadata->getAssociationMapping($property);
return new TypeGuess('Symfony\Bridge\Doctrine\Form\Type\EntityType', ['em' => $name, 'class' => $mapping['targetEntity'], 'multiple' => $multiple], Guess::HIGH_CONFIDENCE);
}
switch ($metadata->getTypeOfField($property)) {
case Type::TARRAY:
case Type::SIMPLE_ARRAY:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE);
case Type::BOOLEAN:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::HIGH_CONFIDENCE);
case Type::DATETIME:
case Type::DATETIMETZ:
case 'vardatetime':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE);
case 'datetime_immutable':
case 'datetimetz_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
case 'dateinterval':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateIntervalType', [], Guess::HIGH_CONFIDENCE);
case Type::DATE:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::HIGH_CONFIDENCE);
case 'date_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
case Type::TIME:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', [], Guess::HIGH_CONFIDENCE);
case 'time_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
case Type::DECIMAL:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', ['input' => 'string'], Guess::MEDIUM_CONFIDENCE);
case Type::FLOAT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE);
case Type::INTEGER:
case Type::BIGINT:
case Type::SMALLINT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE);
case Type::STRING:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::MEDIUM_CONFIDENCE);
case Type::TEXT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextareaType', [], Guess::MEDIUM_CONFIDENCE);
default:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
}
} | php | public function guessType($class, $property)
{
if (!$ret = $this->getMetadata($class)) {
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
}
list($metadata, $name) = $ret;
if ($metadata->hasAssociation($property)) {
$multiple = $metadata->isCollectionValuedAssociation($property);
$mapping = $metadata->getAssociationMapping($property);
return new TypeGuess('Symfony\Bridge\Doctrine\Form\Type\EntityType', ['em' => $name, 'class' => $mapping['targetEntity'], 'multiple' => $multiple], Guess::HIGH_CONFIDENCE);
}
switch ($metadata->getTypeOfField($property)) {
case Type::TARRAY:
case Type::SIMPLE_ARRAY:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE);
case Type::BOOLEAN:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::HIGH_CONFIDENCE);
case Type::DATETIME:
case Type::DATETIMETZ:
case 'vardatetime':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE);
case 'datetime_immutable':
case 'datetimetz_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
case 'dateinterval':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateIntervalType', [], Guess::HIGH_CONFIDENCE);
case Type::DATE:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::HIGH_CONFIDENCE);
case 'date_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
case Type::TIME:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', [], Guess::HIGH_CONFIDENCE);
case 'time_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE);
case Type::DECIMAL:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', ['input' => 'string'], Guess::MEDIUM_CONFIDENCE);
case Type::FLOAT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE);
case Type::INTEGER:
case Type::BIGINT:
case Type::SMALLINT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE);
case Type::STRING:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::MEDIUM_CONFIDENCE);
case Type::TEXT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextareaType', [], Guess::MEDIUM_CONFIDENCE);
default:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
}
} | [
"public",
"function",
"guessType",
"(",
"$",
"class",
",",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"$",
"ret",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
"$",
"class",
")",
")",
"{",
"return",
"new",
"TypeGuess",
"(",
"'Symfony\\Component\\Form\\Exte... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php#L39-L92 | train | Guesses the type of a property | [
30522,
2270,
3853,
3984,
13874,
1006,
1002,
2465,
1010,
1002,
3200,
1007,
1063,
2065,
1006,
999,
1002,
2128,
2102,
1027,
1002,
2023,
1011,
1028,
2131,
11368,
8447,
2696,
1006,
1002,
2465,
1007,
1007,
1063,
2709,
2047,
2828,
22967,
2015,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Filter/Presenter/DateTime.php | DateTime.getOptions | protected function getOptions(array $options) : array
{
$options['format'] = Arr::get($options, 'format', $this->format);
$options['locale'] = Arr::get($options, 'locale', config('app.locale'));
return $options;
} | php | protected function getOptions(array $options) : array
{
$options['format'] = Arr::get($options, 'format', $this->format);
$options['locale'] = Arr::get($options, 'locale', config('app.locale'));
return $options;
} | [
"protected",
"function",
"getOptions",
"(",
"array",
"$",
"options",
")",
":",
"array",
"{",
"$",
"options",
"[",
"'format'",
"]",
"=",
"Arr",
"::",
"get",
"(",
"$",
"options",
",",
"'format'",
",",
"$",
"this",
"->",
"format",
")",
";",
"$",
"option... | @param array $options
@return mixed | [
"@param",
"array",
"$options"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Presenter/DateTime.php#L35-L41 | train | Get options for the current language | [
30522,
5123,
3853,
2131,
7361,
9285,
1006,
9140,
1002,
7047,
1007,
1024,
9140,
1063,
1002,
7047,
1031,
1005,
4289,
1005,
1033,
1027,
12098,
2099,
1024,
1024,
2131,
1006,
1002,
7047,
1010,
1005,
4289,
1005,
1010,
1002,
2023,
1011,
1028,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/KernelBrowser.php | KernelBrowser.doRequestInProcess | protected function doRequestInProcess($request)
{
$response = parent::doRequestInProcess($request);
$this->profiler = false;
return $response;
} | php | protected function doRequestInProcess($request)
{
$response = parent::doRequestInProcess($request);
$this->profiler = false;
return $response;
} | [
"protected",
"function",
"doRequestInProcess",
"(",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"parent",
"::",
"doRequestInProcess",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"profiler",
"=",
"false",
";",
"return",
"$",
"response",
";",
"}"
] | {@inheritdoc}
@param Request $request A Request instance
@return Response A Response instance | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php#L141-L148 | train | Do Request In Process | [
30522,
5123,
3853,
2079,
2890,
15500,
2378,
21572,
9623,
2015,
1006,
1002,
5227,
1007,
1063,
1002,
3433,
1027,
6687,
1024,
1024,
2079,
2890,
15500,
2378,
21572,
9623,
2015,
1006,
1002,
5227,
1007,
1025,
1002,
2023,
1011,
1028,
6337,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Encoder/YamlEncoder.php | YamlEncoder.encode | public function encode($data, $format, array $context = [])
{
$context = array_merge($this->defaultContext, $context);
return $this->dumper->dump($data, $context['yaml_inline'], $context['yaml_indent'], $context['yaml_flags']);
} | php | public function encode($data, $format, array $context = [])
{
$context = array_merge($this->defaultContext, $context);
return $this->dumper->dump($data, $context['yaml_inline'], $context['yaml_indent'], $context['yaml_flags']);
} | [
"public",
"function",
"encode",
"(",
"$",
"data",
",",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"context",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"defaultContext",
",",
"$",
"context",
")",
";",
"return",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/YamlEncoder.php#L46-L51 | train | Encode data to YAML format | [
30522,
2270,
3853,
4372,
16044,
1006,
1002,
2951,
1010,
1002,
4289,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
30524,
9140,
1035,
13590,
1006,
1002,
2023,
1011,
1028,
12398,
8663,
18209,
1010,
1002,
6123,
1007,
1025,
2709,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Arr.php | Arr.shuffle | public static function shuffle($array, $seed = null)
{
if (is_null($seed)) {
shuffle($array);
} else {
mt_srand($seed);
shuffle($array);
mt_srand();
}
return $array;
} | php | public static function shuffle($array, $seed = null)
{
if (is_null($seed)) {
shuffle($array);
} else {
mt_srand($seed);
shuffle($array);
mt_srand();
}
return $array;
} | [
"public",
"static",
"function",
"shuffle",
"(",
"$",
"array",
",",
"$",
"seed",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"seed",
")",
")",
"{",
"shuffle",
"(",
"$",
"array",
")",
";",
"}",
"else",
"{",
"mt_srand",
"(",
"$",
"seed",
... | Shuffle the given array and return the result.
@param array $array
@param int|null $seed
@return array | [
"Shuffle",
"the",
"given",
"array",
"and",
"return",
"the",
"result",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Arr.php#L539-L550 | train | Shuffle an array | [
30522,
2270,
10763,
3853,
23046,
1006,
1002,
9140,
1010,
1002,
6534,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
6534,
1007,
1007,
1063,
23046,
1006,
1002,
9140,
1007,
1025,
1065,
2842,
1063,
11047,
1035,
5034,
5685,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Option.php | Option.set | public static function set($name, $value, $autoload = 0)
{
self::getInstance()->setValue($name, $value, $autoload);
} | php | public static function set($name, $value, $autoload = 0)
{
self::getInstance()->setValue($name, $value, $autoload);
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"autoload",
"=",
"0",
")",
"{",
"self",
"::",
"getInstance",
"(",
")",
"->",
"setValue",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"autoload",
")",
";",
"}... | Sets an option value by name.
@param string $name The option name.
@param string $value The value to set the option to.
@param int $autoLoad If set to 1, this option value will be automatically loaded when Piwik is initialzed;
should be set to 1 for options that will be used in every Piwik request. | [
"Sets",
"an",
"option",
"value",
"by",
"name",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Option.php#L69-L72 | train | Set a value in the current context | [
30522,
2270,
10763,
3853,
2275,
1006,
1002,
2171,
1010,
1002,
3643,
1010,
1002,
8285,
11066,
1027,
1014,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.leftJoinWhere | public function leftJoinWhere($table, $first, $operator, $second)
{
return $this->joinWhere($table, $first, $operator, $second, 'left');
} | php | public function leftJoinWhere($table, $first, $operator, $second)
{
return $this->joinWhere($table, $first, $operator, $second, 'left');
} | [
"public",
"function",
"leftJoinWhere",
"(",
"$",
"table",
",",
"$",
"first",
",",
"$",
"operator",
",",
"$",
"second",
")",
"{",
"return",
"$",
"this",
"->",
"joinWhere",
"(",
"$",
"table",
",",
"$",
"first",
",",
"$",
"operator",
",",
"$",
"second",... | Add a "join where" clause to the query.
@param string $table
@param \Closure|string $first
@param string $operator
@param string $second
@return \Illuminate\Database\Query\Builder|static | [
"Add",
"a",
"join",
"where",
"clause",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L475-L478 | train | left join where clause | [
30522,
2270,
3853,
2187,
5558,
2378,
2860,
5886,
2063,
1006,
1002,
2795,
1010,
1002,
2034,
1010,
1002,
6872,
1010,
1002,
2117,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3693,
2860,
5886,
2063,
1006,
1002,
2795,
1010,
1002,
2034,
1010,
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 | plugins/UsersManager/API.php | API.getSitesAccessFromUser | public function getSitesAccessFromUser($userLogin)
{
Piwik::checkUserHasSuperUserAccess();
$this->checkUserExists($userLogin);
// Super users have 'admin' access for every site
if (Piwik::hasTheUserSuperUserAccess($userLogin)) {
$return = array();
$siteManagerModel = new \Piwik\Plugins\SitesManager\Model();
$sites = $siteManagerModel->getAllSites();
foreach ($sites as $site) {
$return[] = array(
'site' => $site['idsite'],
'access' => 'admin'
);
}
return $return;
}
return $this->model->getSitesAccessFromUser($userLogin);
} | php | public function getSitesAccessFromUser($userLogin)
{
Piwik::checkUserHasSuperUserAccess();
$this->checkUserExists($userLogin);
// Super users have 'admin' access for every site
if (Piwik::hasTheUserSuperUserAccess($userLogin)) {
$return = array();
$siteManagerModel = new \Piwik\Plugins\SitesManager\Model();
$sites = $siteManagerModel->getAllSites();
foreach ($sites as $site) {
$return[] = array(
'site' => $site['idsite'],
'access' => 'admin'
);
}
return $return;
}
return $this->model->getSitesAccessFromUser($userLogin);
} | [
"public",
"function",
"getSitesAccessFromUser",
"(",
"$",
"userLogin",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"$",
"this",
"->",
"checkUserExists",
"(",
"$",
"userLogin",
")",
";",
"// Super users have 'admin' access for every site",
"i... | For each website ID, returns the access level of the given $userLogin.
If the user doesn't have any access to a website ('noaccess'),
this website will not be in the returned array.
If the user doesn't have any access, the returned array will be an empty array.
@param string $userLogin User that has to be valid
@return array The returned array has the format
array(
idsite1 => 'view',
idsite2 => 'admin',
idsite3 => 'view',
...
) | [
"For",
"each",
"website",
"ID",
"returns",
"the",
"access",
"level",
"of",
"the",
"given",
"$userLogin",
".",
"If",
"the",
"user",
"doesn",
"t",
"have",
"any",
"access",
"to",
"a",
"website",
"(",
"noaccess",
")",
"this",
"website",
"will",
"not",
"be",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L493-L511 | train | Returns all sites access for a specific user | [
30522,
2270,
3853,
4152,
7616,
6305,
9623,
22747,
21716,
20330,
1006,
1002,
5310,
21197,
2378,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
463... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.registerFilter | public function registerFilter($extension, $filter)
{
if (is_array($extension)) {
foreach ($extension as $_extension) {
$this->registerFilter($_extension, $filter);
}
return;
}
$extension = strtolower($extension);
if (!isset($this->filters[$extension])) {
$this->filters[$extension] = [];
}
if ($filter !== null) {
$this->filters[$extension][] = $filter;
}
return $this;
} | php | public function registerFilter($extension, $filter)
{
if (is_array($extension)) {
foreach ($extension as $_extension) {
$this->registerFilter($_extension, $filter);
}
return;
}
$extension = strtolower($extension);
if (!isset($this->filters[$extension])) {
$this->filters[$extension] = [];
}
if ($filter !== null) {
$this->filters[$extension][] = $filter;
}
return $this;
} | [
"public",
"function",
"registerFilter",
"(",
"$",
"extension",
",",
"$",
"filter",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"extension",
")",
")",
"{",
"foreach",
"(",
"$",
"extension",
"as",
"$",
"_extension",
")",
"{",
"$",
"this",
"->",
"registerF... | Register a filter to apply to the combining process.
@param string|array $extension Extension name. Eg: css
@param object $filter Collection of files to combine.
@return self | [
"Register",
"a",
"filter",
"to",
"apply",
"to",
"the",
"combining",
"process",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L563-L583 | train | Registers a filter to the language | [
30522,
2270,
3853,
4236,
8873,
21928,
1006,
1002,
5331,
1010,
1002,
11307,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
5331,
1007,
1007,
1063,
18921,
6776,
1006,
1002,
5331,
2004,
1002,
1035,
5331,
1007,
1063,
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/Lock/Store/ZookeeperStore.php | ZookeeperStore.createNewLock | private function createNewLock(string $node, string $value)
{
// Default Node Permissions
$acl = [['perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone']];
// This ensures that the nodes are deleted when the client session to zookeeper server ends.
$type = \Zookeeper::EPHEMERAL;
try {
$this->zookeeper->create($node, $value, $acl, $type);
} catch (\ZookeeperException $ex) {
if (\Zookeeper::NODEEXISTS === $ex->getCode()) {
throw new LockConflictedException($ex);
}
throw new LockAcquiringException($ex);
}
} | php | private function createNewLock(string $node, string $value)
{
// Default Node Permissions
$acl = [['perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone']];
// This ensures that the nodes are deleted when the client session to zookeeper server ends.
$type = \Zookeeper::EPHEMERAL;
try {
$this->zookeeper->create($node, $value, $acl, $type);
} catch (\ZookeeperException $ex) {
if (\Zookeeper::NODEEXISTS === $ex->getCode()) {
throw new LockConflictedException($ex);
}
throw new LockAcquiringException($ex);
}
} | [
"private",
"function",
"createNewLock",
"(",
"string",
"$",
"node",
",",
"string",
"$",
"value",
")",
"{",
"// Default Node Permissions",
"$",
"acl",
"=",
"[",
"[",
"'perms'",
"=>",
"\\",
"Zookeeper",
"::",
"PERM_ALL",
",",
"'scheme'",
"=>",
"'world'",
",",
... | Creates a zookeeper node.
@param string $node The node which needs to be created
@param string $value The value to be assigned to a zookeeper node
@throws LockConflictedException
@throws LockAcquiringException | [
"Creates",
"a",
"zookeeper",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/ZookeeperStore.php#L106-L122 | train | Create a new lock on zookeeper server | [
30522,
2797,
3853,
3443,
2638,
13668,
7432,
1006,
5164,
1002,
13045,
1010,
5164,
1002,
3643,
1007,
1063,
1013,
1013,
12398,
13045,
6656,
2015,
1002,
9353,
2140,
1027,
1031,
1031,
1005,
2566,
5244,
1005,
1027,
1028,
1032,
9201,
13106,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php | AutowirePass.autowireCalls | private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot): array
{
$this->decoratedId = null;
$this->decoratedClass = null;
$this->getPreviousValue = null;
if ($isRoot && ($definition = $this->container->getDefinition($this->currentId)) && $this->container->has($this->decoratedId = $definition->innerServiceId)) {
$this->decoratedClass = $this->container->findDefinition($this->decoratedId)->getClass();
}
foreach ($this->methodCalls as $i => $call) {
$this->decoratedMethodIndex = $i;
list($method, $arguments) = $call;
if ($method instanceof \ReflectionFunctionAbstract) {
$reflectionMethod = $method;
} else {
$definition = new Definition($reflectionClass->name);
try {
$reflectionMethod = $this->getReflectionMethod($definition, $method);
} catch (RuntimeException $e) {
if ($definition->getFactory()) {
continue;
}
throw $e;
}
}
$arguments = $this->autowireMethod($reflectionMethod, $arguments);
if ($arguments !== $call[1]) {
$this->methodCalls[$i][1] = $arguments;
}
}
return $this->methodCalls;
} | php | private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot): array
{
$this->decoratedId = null;
$this->decoratedClass = null;
$this->getPreviousValue = null;
if ($isRoot && ($definition = $this->container->getDefinition($this->currentId)) && $this->container->has($this->decoratedId = $definition->innerServiceId)) {
$this->decoratedClass = $this->container->findDefinition($this->decoratedId)->getClass();
}
foreach ($this->methodCalls as $i => $call) {
$this->decoratedMethodIndex = $i;
list($method, $arguments) = $call;
if ($method instanceof \ReflectionFunctionAbstract) {
$reflectionMethod = $method;
} else {
$definition = new Definition($reflectionClass->name);
try {
$reflectionMethod = $this->getReflectionMethod($definition, $method);
} catch (RuntimeException $e) {
if ($definition->getFactory()) {
continue;
}
throw $e;
}
}
$arguments = $this->autowireMethod($reflectionMethod, $arguments);
if ($arguments !== $call[1]) {
$this->methodCalls[$i][1] = $arguments;
}
}
return $this->methodCalls;
} | [
"private",
"function",
"autowireCalls",
"(",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
",",
"bool",
"$",
"isRoot",
")",
":",
"array",
"{",
"$",
"this",
"->",
"decoratedId",
"=",
"null",
";",
"$",
"this",
"->",
"decoratedClass",
"=",
"null",
";",
"$"... | @param \ReflectionClass $reflectionClass
@return array | [
"@param",
"\\",
"ReflectionClass",
"$reflectionClass"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php#L144-L180 | train | Autowires all method calls from the container | [
30522,
2797,
3853,
8285,
20357,
9289,
4877,
1006,
1032,
9185,
26266,
1002,
9185,
26266,
1010,
22017,
2140,
1002,
2003,
3217,
4140,
1007,
1024,
9140,
1063,
1002,
2023,
1011,
1028,
7429,
3593,
1027,
19701,
1025,
1002,
2023,
1011,
1028,
7429,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OctoberInstall.php | OctoberInstall.getConfigFile | protected function getConfigFile($name = 'app')
{
$env = $this->option('env') ? $this->option('env').'/' : '';
$name .= '.php';
$contents = File::get($path = $this->laravel['path.config']."/{$env}{$name}");
return $path;
} | php | protected function getConfigFile($name = 'app')
{
$env = $this->option('env') ? $this->option('env').'/' : '';
$name .= '.php';
$contents = File::get($path = $this->laravel['path.config']."/{$env}{$name}");
return $path;
} | [
"protected",
"function",
"getConfigFile",
"(",
"$",
"name",
"=",
"'app'",
")",
"{",
"$",
"env",
"=",
"$",
"this",
"->",
"option",
"(",
"'env'",
")",
"?",
"$",
"this",
"->",
"option",
"(",
"'env'",
")",
".",
"'/'",
":",
"''",
";",
"$",
"name",
".=... | Get a config file and contents.
@return array | [
"Get",
"a",
"config",
"file",
"and",
"contents",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/OctoberInstall.php#L372-L381 | train | Get config file | [
30522,
5123,
3853,
2131,
8663,
8873,
25708,
9463,
1006,
1002,
2171,
1027,
1005,
10439,
1005,
1007,
1063,
1002,
4372,
2615,
1027,
1002,
2023,
1011,
1028,
5724,
1006,
1005,
4372,
2615,
1005,
1007,
1029,
1002,
2023,
1011,
1028,
5724,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Psr7/ServerRequest.php | ServerRequest.getContentLength | public function getContentLength(): ?int
{
$result = $this->getRequest()->getHeader('Content-Length');
return $result ? (int) $result[0] : null;
} | php | public function getContentLength(): ?int
{
$result = $this->getRequest()->getHeader('Content-Length');
return $result ? (int) $result[0] : null;
} | [
"public",
"function",
"getContentLength",
"(",
")",
":",
"?",
"int",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getHeader",
"(",
"'Content-Length'",
")",
";",
"return",
"$",
"result",
"?",
"(",
"int",
")",
"$",
"result",... | Get serverRequest content length, if known.
Note: This method is not part of the PSR-7 standard.
@return int|null | [
"Get",
"serverRequest",
"content",
"length",
"if",
"known",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Psr7/ServerRequest.php#L79-L84 | train | Get Content - Length of the request | [
30522,
2270,
3853,
2131,
8663,
6528,
9286,
3070,
2705,
1006,
1007,
1024,
1029,
20014,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
2131,
2890,
15500,
1006,
1007,
1011,
1028,
2131,
4974,
2121,
1006,
1005,
4180,
1011,
3091,
1005,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php | YamlFileLoader.getMappedClasses | public function getMappedClasses()
{
if (null === $this->classes) {
$this->classes = $this->getClassesFromYaml();
}
return array_keys($this->classes);
} | php | public function getMappedClasses()
{
if (null === $this->classes) {
$this->classes = $this->getClassesFromYaml();
}
return array_keys($this->classes);
} | [
"public",
"function",
"getMappedClasses",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"classes",
")",
"{",
"$",
"this",
"->",
"classes",
"=",
"$",
"this",
"->",
"getClassesFromYaml",
"(",
")",
";",
"}",
"return",
"array_keys",
"(",
"$",... | Return the names of the classes mapped in this file.
@return string[] The classes names | [
"Return",
"the",
"names",
"of",
"the",
"classes",
"mapped",
"in",
"this",
"file",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php#L122-L129 | train | Get all classes mapped to the current language | [
30522,
2270,
3853,
2131,
2863,
11469,
26266,
2229,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
4280,
1007,
1063,
1002,
2023,
1011,
1028,
4280,
1027,
1002,
2023,
1011,
1028,
2131,
26266,
2229,
19699,
16940,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Backup/Backups.php | Backups.backup | public static function backup($id = 0, callable $status = null)
{
$profiles = static::getBackupProfiles();
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
if (isset($profiles[$id])) {
$backup = (object) $profiles[$id];
} else {
throw new \RuntimeException('No backups defined...');
}
$name = Grav::instance()['inflector']->underscorize($backup->name);
$date = date(static::BACKUP_DATE_FORMAT, time());
$filename = trim($name, '_') . '--' . $date . '.zip';
$destination = static::$backup_dir . DS . $filename;
$max_execution_time = ini_set('max_execution_time', 600);
$backup_root = $backup->root;
if ($locator->isStream($backup_root)) {
$backup_root = $locator->findResource($backup_root);
} else {
$backup_root = rtrim(GRAV_ROOT . $backup_root, '/');
}
if (!file_exists($backup_root)) {
throw new \RuntimeException("Backup location: {$backup_root} does not exist...");
}
$options = [
'exclude_files' => static::convertExclude($backup->exclude_files ?? ''),
'exclude_paths' => static::convertExclude($backup->exclude_paths ?? ''),
];
/** @var Archiver $archiver */
$archiver = Archiver::create('zip');
$archiver->setArchive($destination)->setOptions($options)->compress($backup_root, $status)->addEmptyFolders($options['exclude_paths'], $status);
$status && $status([
'type' => 'message',
'message' => 'Done...',
]);
$status && $status([
'type' => 'progress',
'complete' => true
]);
if ($max_execution_time !== false) {
ini_set('max_execution_time', $max_execution_time);
}
// Log the backup
Grav::instance()['log']->notice('Backup Created: ' . $destination);
// Fire Finished event
Grav::instance()->fireEvent('onBackupFinished', new Event(['backup' => $destination]));
// Purge anything required
static::purge();
// Log
$log = JsonFile::instance(Grav::instance()['locator']->findResource("log://backup.log", true, true));
$log->content([
'time' => time(),
'location' => $destination
]);
$log->save();
return $destination;
} | php | public static function backup($id = 0, callable $status = null)
{
$profiles = static::getBackupProfiles();
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
if (isset($profiles[$id])) {
$backup = (object) $profiles[$id];
} else {
throw new \RuntimeException('No backups defined...');
}
$name = Grav::instance()['inflector']->underscorize($backup->name);
$date = date(static::BACKUP_DATE_FORMAT, time());
$filename = trim($name, '_') . '--' . $date . '.zip';
$destination = static::$backup_dir . DS . $filename;
$max_execution_time = ini_set('max_execution_time', 600);
$backup_root = $backup->root;
if ($locator->isStream($backup_root)) {
$backup_root = $locator->findResource($backup_root);
} else {
$backup_root = rtrim(GRAV_ROOT . $backup_root, '/');
}
if (!file_exists($backup_root)) {
throw new \RuntimeException("Backup location: {$backup_root} does not exist...");
}
$options = [
'exclude_files' => static::convertExclude($backup->exclude_files ?? ''),
'exclude_paths' => static::convertExclude($backup->exclude_paths ?? ''),
];
/** @var Archiver $archiver */
$archiver = Archiver::create('zip');
$archiver->setArchive($destination)->setOptions($options)->compress($backup_root, $status)->addEmptyFolders($options['exclude_paths'], $status);
$status && $status([
'type' => 'message',
'message' => 'Done...',
]);
$status && $status([
'type' => 'progress',
'complete' => true
]);
if ($max_execution_time !== false) {
ini_set('max_execution_time', $max_execution_time);
}
// Log the backup
Grav::instance()['log']->notice('Backup Created: ' . $destination);
// Fire Finished event
Grav::instance()->fireEvent('onBackupFinished', new Event(['backup' => $destination]));
// Purge anything required
static::purge();
// Log
$log = JsonFile::instance(Grav::instance()['locator']->findResource("log://backup.log", true, true));
$log->content([
'time' => time(),
'location' => $destination
]);
$log->save();
return $destination;
} | [
"public",
"static",
"function",
"backup",
"(",
"$",
"id",
"=",
"0",
",",
"callable",
"$",
"status",
"=",
"null",
")",
"{",
"$",
"profiles",
"=",
"static",
"::",
"getBackupProfiles",
"(",
")",
";",
"/** @var UniformResourceLocator $locator */",
"$",
"locator",
... | Backup
@param int $id
@param callable|null $status
@return null|string | [
"Backup"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Backup/Backups.php#L145-L215 | train | Backup a file | [
30522,
2270,
10763,
3853,
10200,
1006,
1002,
8909,
1027,
1014,
1010,
2655,
3085,
1002,
3570,
1027,
19701,
1007,
1063,
1002,
17879,
1027,
10763,
1024,
1024,
2131,
5963,
6279,
21572,
8873,
4244,
1006,
1007,
1025,
1013,
1008,
1008,
1030,
13075... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileBinaryMimeTypeGuesser.php | FileBinaryMimeTypeGuesser.guessMimeType | public function guessMimeType(string $path): ?string
{
if (!is_file($path) || !is_readable($path)) {
throw new InvalidArgumentException(sprintf('The "%s" file does not exist or is not readable.', $path));
}
if (!$this->isGuesserSupported()) {
throw new LogicException(sprintf('The "%s" guesser is not supported.', __CLASS__));
}
ob_start();
// need to use --mime instead of -i. see #6641
passthru(sprintf($this->cmd, escapeshellarg($path)), $return);
if ($return > 0) {
ob_end_clean();
return null;
}
$type = trim(ob_get_clean());
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) {
// it's not a type, but an error message
return null;
}
return $match[1];
} | php | public function guessMimeType(string $path): ?string
{
if (!is_file($path) || !is_readable($path)) {
throw new InvalidArgumentException(sprintf('The "%s" file does not exist or is not readable.', $path));
}
if (!$this->isGuesserSupported()) {
throw new LogicException(sprintf('The "%s" guesser is not supported.', __CLASS__));
}
ob_start();
// need to use --mime instead of -i. see #6641
passthru(sprintf($this->cmd, escapeshellarg($path)), $return);
if ($return > 0) {
ob_end_clean();
return null;
}
$type = trim(ob_get_clean());
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) {
// it's not a type, but an error message
return null;
}
return $match[1];
} | [
"public",
"function",
"guessMimeType",
"(",
"string",
"$",
"path",
")",
":",
"?",
"string",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"path",
")",
"||",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/FileBinaryMimeTypeGuesser.php#L66-L94 | train | Guesses the mime type of a file | [
30522,
2270,
3853,
3984,
4328,
11368,
18863,
1006,
5164,
1002,
4130,
1007,
1024,
1029,
5164,
1063,
2065,
1006,
999,
2003,
1035,
5371,
1006,
1002,
4130,
1007,
1064,
1064,
999,
2003,
1035,
3191,
3085,
1006,
1002,
4130,
1007,
1007,
1063,
546... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.forms | public function forms()
{
if (null === $this->forms) {
$header = $this->header();
// Call event to allow filling the page header form dynamically (e.g. use case: Comments plugin)
$grav = Grav::instance();
$grav->fireEvent('onFormPageHeaderProcessed', new Event(['page' => $this, 'header' => $header]));
$rules = $header->rules ?? null;
if (!\is_array($rules)) {
$rules = [];
}
$forms = [];
// First grab page.header.form
$form = $this->normalizeForm($header->form ?? null, null, $rules);
if ($form) {
$forms[$form['name']] = $form;
}
// Append page.header.forms (override singular form if it clashes)
$headerForms = $header->forms ?? null;
if (\is_array($headerForms)) {
foreach ($headerForms as $name => $form) {
$form = $this->normalizeForm($form, $name, $rules);
if ($form) {
$forms[$form['name']] = $form;
}
}
}
$this->forms = $forms;
}
return $this->forms;
} | php | public function forms()
{
if (null === $this->forms) {
$header = $this->header();
// Call event to allow filling the page header form dynamically (e.g. use case: Comments plugin)
$grav = Grav::instance();
$grav->fireEvent('onFormPageHeaderProcessed', new Event(['page' => $this, 'header' => $header]));
$rules = $header->rules ?? null;
if (!\is_array($rules)) {
$rules = [];
}
$forms = [];
// First grab page.header.form
$form = $this->normalizeForm($header->form ?? null, null, $rules);
if ($form) {
$forms[$form['name']] = $form;
}
// Append page.header.forms (override singular form if it clashes)
$headerForms = $header->forms ?? null;
if (\is_array($headerForms)) {
foreach ($headerForms as $name => $form) {
$form = $this->normalizeForm($form, $name, $rules);
if ($form) {
$forms[$form['name']] = $form;
}
}
}
$this->forms = $forms;
}
return $this->forms;
} | [
"public",
"function",
"forms",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"forms",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"header",
"(",
")",
";",
"// Call event to allow filling the page header form dynamically (e.g. use case: Comments ... | Returns normalized list of name => form pairs.
@return array | [
"Returns",
"normalized",
"list",
"of",
"name",
"=",
">",
"form",
"pairs",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1205-L1242 | train | Get the form array from the page header | [
30522,
2270,
3853,
3596,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
3596,
1007,
1063,
1002,
20346,
1027,
1002,
2023,
1011,
1028,
20346,
1006,
1007,
1025,
1013,
1013,
2655,
2724,
2000,
3499,
8110,
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... |
overtrue/wechat | src/OfficialAccount/ShakeAround/GroupClient.php | GroupClient.update | public function update(int $groupId, string $name)
{
$params = [
'group_id' => $groupId,
'group_name' => $name,
];
return $this->httpPostJson('shakearound/device/group/update', $params);
} | php | public function update(int $groupId, string $name)
{
$params = [
'group_id' => $groupId,
'group_name' => $name,
];
return $this->httpPostJson('shakearound/device/group/update', $params);
} | [
"public",
"function",
"update",
"(",
"int",
"$",
"groupId",
",",
"string",
"$",
"name",
")",
"{",
"$",
"params",
"=",
"[",
"'group_id'",
"=>",
"$",
"groupId",
",",
"'group_name'",
"=>",
"$",
"name",
",",
"]",
";",
"return",
"$",
"this",
"->",
"httpPo... | Update a device group name.
@param int $groupId
@param string $name
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string | [
"Update",
"a",
"device",
"group",
"name",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/ShakeAround/GroupClient.php#L47-L55 | train | Update device group | [
30522,
2270,
3853,
10651,
1006,
20014,
1002,
2177,
3593,
1010,
5164,
1002,
2171,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
2177,
1035,
8909,
1005,
1027,
1028,
1002,
2177,
3593,
1010,
1005,
2177,
1035,
2171,
1005,
1027,
1028,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/PluginManager.php | PluginManager.findMissingDependencies | public function findMissingDependencies()
{
$missing = [];
foreach ($this->plugins as $id => $plugin) {
if (!$required = $this->getDependencies($plugin)) {
continue;
}
foreach ($required as $require) {
if ($this->hasPlugin($require)) {
continue;
}
if (!in_array($require, $missing)) {
$missing[] = $require;
}
}
}
return $missing;
} | php | public function findMissingDependencies()
{
$missing = [];
foreach ($this->plugins as $id => $plugin) {
if (!$required = $this->getDependencies($plugin)) {
continue;
}
foreach ($required as $require) {
if ($this->hasPlugin($require)) {
continue;
}
if (!in_array($require, $missing)) {
$missing[] = $require;
}
}
}
return $missing;
} | [
"public",
"function",
"findMissingDependencies",
"(",
")",
"{",
"$",
"missing",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"plugins",
"as",
"$",
"id",
"=>",
"$",
"plugin",
")",
"{",
"if",
"(",
"!",
"$",
"required",
"=",
"$",
"this",
"->... | Scans the system plugins to locate any dependencies that are not currently
installed. Returns an array of plugin codes that are needed.
PluginManager::instance()->findMissingDependencies();
@return array | [
"Scans",
"the",
"system",
"plugins",
"to",
"locate",
"any",
"dependencies",
"that",
"are",
"not",
"currently",
"installed",
".",
"Returns",
"an",
"array",
"of",
"plugin",
"codes",
"that",
"are",
"needed",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L620-L641 | train | Find missing dependencies | [
30522,
2270,
3853,
2424,
15630,
7741,
30524,
1002,
13354,
2378,
1007,
1007,
1063,
3613,
1025,
1065,
18921,
6776,
1006,
1002,
3223,
2004,
1002,
5478,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2038,
24759,
15916,
2378,
1006,
1002,
5478,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Maildir.php | Zend_Mail_Storage_Maildir.getRawHeader | public function getRawHeader($id, $part = null, $topLines = 0)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$fh = fopen($this->_getFileData($id, 'filename'), 'r');
$content = '';
while (!feof($fh)) {
$line = fgets($fh);
if (!trim($line)) {
break;
}
$content .= $line;
}
fclose($fh);
return $content;
} | php | public function getRawHeader($id, $part = null, $topLines = 0)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$fh = fopen($this->_getFileData($id, 'filename'), 'r');
$content = '';
while (!feof($fh)) {
$line = fgets($fh);
if (!trim($line)) {
break;
}
$content .= $line;
}
fclose($fh);
return $content;
} | [
"public",
"function",
"getRawHeader",
"(",
"$",
"id",
",",
"$",
"part",
"=",
"null",
",",
"$",
"topLines",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"part",
"!==",
"null",
")",
"{",
"// TODO: implement",
"/**\n * @see Zend_Mail_Storage_Exception\n ... | /*
Get raw header of message or part
@param int $id number of message
@param null|array|string $part path to part or null for messsage header
@param int $topLines include this many lines with header (after an empty line)
@return string raw header
@throws Zend_Mail_Storage_Exception | [
"/",
"*",
"Get",
"raw",
"header",
"of",
"message",
"or",
"part"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Maildir.php#L196-L220 | train | Get raw header | [
30522,
2270,
3853,
2131,
2527,
2860,
4974,
2121,
1006,
1002,
8909,
1010,
1002,
2112,
1027,
19701,
1010,
1002,
2327,
12735,
1027,
1014,
1007,
1063,
2065,
1006,
1002,
2112,
999,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataAccess/ArchiveSelector.php | ArchiveSelector.getArchiveIds | public static function getArchiveIds($siteIds, $periods, $segment, $plugins)
{
if (empty($siteIds)) {
throw new \Exception("Website IDs could not be read from the request, ie. idSite=");
}
foreach ($siteIds as $index => $siteId) {
$siteIds[$index] = (int) $siteId;
}
$getArchiveIdsSql = "SELECT idsite, name, date1, date2, MAX(idarchive) as idarchive
FROM %s
WHERE idsite IN (" . implode(',', $siteIds) . ")
AND " . self::getNameCondition($plugins, $segment) . "
AND %s
GROUP BY idsite, date1, date2, name";
$monthToPeriods = array();
foreach ($periods as $period) {
/** @var Period $period */
if ($period->getDateStart()->isLater(Date::now()->addDay(2))) {
continue; // avoid creating any archive tables in the future
}
$table = ArchiveTableCreator::getNumericTable($period->getDateStart());
$monthToPeriods[$table][] = $period;
}
// for every month within the archive query, select from numeric table
$result = array();
foreach ($monthToPeriods as $table => $periods) {
$firstPeriod = reset($periods);
$bind = array();
if ($firstPeriod instanceof Range) {
$dateCondition = "date1 = ? AND date2 = ?";
$bind[] = $firstPeriod->getDateStart()->toString('Y-m-d');
$bind[] = $firstPeriod->getDateEnd()->toString('Y-m-d');
} else {
// we assume there is no range date in $periods
$dateCondition = '(';
foreach ($periods as $period) {
if (strlen($dateCondition) > 1) {
$dateCondition .= ' OR ';
}
$dateCondition .= "(period = ? AND date1 = ? AND date2 = ?)";
$bind[] = $period->getId();
$bind[] = $period->getDateStart()->toString('Y-m-d');
$bind[] = $period->getDateEnd()->toString('Y-m-d');
}
$dateCondition .= ')';
}
$sql = sprintf($getArchiveIdsSql, $table, $dateCondition);
$archiveIds = Db::fetchAll($sql, $bind);
// get the archive IDs
foreach ($archiveIds as $row) {
//FIXMEA duplicate with Archive.php
$dateStr = $row['date1'] . ',' . $row['date2'];
$result[$row['name']][$dateStr][] = $row['idarchive'];
}
}
return $result;
} | php | public static function getArchiveIds($siteIds, $periods, $segment, $plugins)
{
if (empty($siteIds)) {
throw new \Exception("Website IDs could not be read from the request, ie. idSite=");
}
foreach ($siteIds as $index => $siteId) {
$siteIds[$index] = (int) $siteId;
}
$getArchiveIdsSql = "SELECT idsite, name, date1, date2, MAX(idarchive) as idarchive
FROM %s
WHERE idsite IN (" . implode(',', $siteIds) . ")
AND " . self::getNameCondition($plugins, $segment) . "
AND %s
GROUP BY idsite, date1, date2, name";
$monthToPeriods = array();
foreach ($periods as $period) {
/** @var Period $period */
if ($period->getDateStart()->isLater(Date::now()->addDay(2))) {
continue; // avoid creating any archive tables in the future
}
$table = ArchiveTableCreator::getNumericTable($period->getDateStart());
$monthToPeriods[$table][] = $period;
}
// for every month within the archive query, select from numeric table
$result = array();
foreach ($monthToPeriods as $table => $periods) {
$firstPeriod = reset($periods);
$bind = array();
if ($firstPeriod instanceof Range) {
$dateCondition = "date1 = ? AND date2 = ?";
$bind[] = $firstPeriod->getDateStart()->toString('Y-m-d');
$bind[] = $firstPeriod->getDateEnd()->toString('Y-m-d');
} else {
// we assume there is no range date in $periods
$dateCondition = '(';
foreach ($periods as $period) {
if (strlen($dateCondition) > 1) {
$dateCondition .= ' OR ';
}
$dateCondition .= "(period = ? AND date1 = ? AND date2 = ?)";
$bind[] = $period->getId();
$bind[] = $period->getDateStart()->toString('Y-m-d');
$bind[] = $period->getDateEnd()->toString('Y-m-d');
}
$dateCondition .= ')';
}
$sql = sprintf($getArchiveIdsSql, $table, $dateCondition);
$archiveIds = Db::fetchAll($sql, $bind);
// get the archive IDs
foreach ($archiveIds as $row) {
//FIXMEA duplicate with Archive.php
$dateStr = $row['date1'] . ',' . $row['date2'];
$result[$row['name']][$dateStr][] = $row['idarchive'];
}
}
return $result;
} | [
"public",
"static",
"function",
"getArchiveIds",
"(",
"$",
"siteIds",
",",
"$",
"periods",
",",
"$",
"segment",
",",
"$",
"plugins",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"siteIds",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Website ID... | Queries and returns archive IDs for a set of sites, periods, and a segment.
@param array $siteIds
@param array $periods
@param Segment $segment
@param array $plugins List of plugin names for which data is being requested.
@return array Archive IDs are grouped by archive name and period range, ie,
array(
'VisitsSummary.done' => array(
'2010-01-01' => array(1,2,3)
)
)
@throws | [
"Queries",
"and",
"returns",
"archive",
"IDs",
"for",
"a",
"set",
"of",
"sites",
"periods",
"and",
"a",
"segment",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/ArchiveSelector.php#L149-L219 | train | Get archive IDs for all sites periods segment plugins | [
30522,
2270,
10763,
3853,
2131,
2906,
5428,
3726,
9821,
1006,
1002,
2609,
9821,
1010,
1002,
6993,
1010,
1002,
6903,
1010,
1002,
13354,
7076,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2609,
9821,
1007,
1007,
1063,
5466,
2047,
1032,
6453,
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/Support/Collection.php | Collection.eachSpread | public function eachSpread(callable $callback)
{
return $this->each(function ($chunk, $key) use ($callback) {
$chunk[] = $key;
return $callback(...$chunk);
});
} | php | public function eachSpread(callable $callback)
{
return $this->each(function ($chunk, $key) use ($callback) {
$chunk[] = $key;
return $callback(...$chunk);
});
} | [
"public",
"function",
"eachSpread",
"(",
"callable",
"$",
"callback",
")",
"{",
"return",
"$",
"this",
"->",
"each",
"(",
"function",
"(",
"$",
"chunk",
",",
"$",
"key",
")",
"use",
"(",
"$",
"callback",
")",
"{",
"$",
"chunk",
"[",
"]",
"=",
"$",
... | Execute a callback over each nested chunk of items.
@param callable $callback
@return static | [
"Execute",
"a",
"callback",
"over",
"each",
"nested",
"chunk",
"of",
"items",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L489-L496 | train | Iterators over the array and calls the callback with each item. | [
30522,
2270,
3853,
2169,
13102,
16416,
2094,
1006,
2655,
3085,
1002,
2655,
5963,
1007,
30524,
1025,
1065,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Writable/Maildir.php | Zend_Mail_Storage_Writable_Maildir.createFolder | public function createFolder($name, $parentFolder = null)
{
if ($parentFolder instanceof Zend_Mail_Storage_Folder) {
$folder = $parentFolder->getGlobalName() . $this->_delim . $name;
} else if ($parentFolder != null) {
$folder = rtrim($parentFolder, $this->_delim) . $this->_delim . $name;
} else {
$folder = $name;
}
$folder = trim($folder, $this->_delim);
// first we check if we try to create a folder that does exist
$exists = null;
try {
$exists = $this->getFolders($folder);
} catch (Zend_Mail_Exception $e) {
// ok
}
if ($exists) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('folder already exists');
}
if (strpos($folder, $this->_delim . $this->_delim) !== false) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid name - folder parts may not be empty');
}
if (strpos($folder, 'INBOX' . $this->_delim) === 0) {
$folder = substr($folder, 6);
}
$fulldir = $this->_rootdir . '.' . $folder;
// check if we got tricked and would create a dir outside of the rootdir or not as direct child
if (strpos($folder, DIRECTORY_SEPARATOR) !== false || strpos($folder, '/') !== false
|| dirname($fulldir) . DIRECTORY_SEPARATOR != $this->_rootdir) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid name - no directory seprator allowed in folder name');
}
// has a parent folder?
$parent = null;
if (strpos($folder, $this->_delim)) {
// let's see if the parent folder exists
$parent = substr($folder, 0, strrpos($folder, $this->_delim));
try {
$this->getFolders($parent);
} catch (Zend_Mail_Exception $e) {
// does not - create parent folder
$this->createFolder($parent);
}
}
if (!@mkdir($fulldir) || !@mkdir($fulldir . DIRECTORY_SEPARATOR . 'cur')) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while creating new folder, may be created incompletly');
}
mkdir($fulldir . DIRECTORY_SEPARATOR . 'new');
mkdir($fulldir . DIRECTORY_SEPARATOR . 'tmp');
$localName = $parent ? substr($folder, strlen($parent) + 1) : $folder;
$this->getFolders($parent)->$localName = new Zend_Mail_Storage_Folder($localName, $folder, true);
return $fulldir;
} | php | public function createFolder($name, $parentFolder = null)
{
if ($parentFolder instanceof Zend_Mail_Storage_Folder) {
$folder = $parentFolder->getGlobalName() . $this->_delim . $name;
} else if ($parentFolder != null) {
$folder = rtrim($parentFolder, $this->_delim) . $this->_delim . $name;
} else {
$folder = $name;
}
$folder = trim($folder, $this->_delim);
// first we check if we try to create a folder that does exist
$exists = null;
try {
$exists = $this->getFolders($folder);
} catch (Zend_Mail_Exception $e) {
// ok
}
if ($exists) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('folder already exists');
}
if (strpos($folder, $this->_delim . $this->_delim) !== false) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid name - folder parts may not be empty');
}
if (strpos($folder, 'INBOX' . $this->_delim) === 0) {
$folder = substr($folder, 6);
}
$fulldir = $this->_rootdir . '.' . $folder;
// check if we got tricked and would create a dir outside of the rootdir or not as direct child
if (strpos($folder, DIRECTORY_SEPARATOR) !== false || strpos($folder, '/') !== false
|| dirname($fulldir) . DIRECTORY_SEPARATOR != $this->_rootdir) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('invalid name - no directory seprator allowed in folder name');
}
// has a parent folder?
$parent = null;
if (strpos($folder, $this->_delim)) {
// let's see if the parent folder exists
$parent = substr($folder, 0, strrpos($folder, $this->_delim));
try {
$this->getFolders($parent);
} catch (Zend_Mail_Exception $e) {
// does not - create parent folder
$this->createFolder($parent);
}
}
if (!@mkdir($fulldir) || !@mkdir($fulldir . DIRECTORY_SEPARATOR . 'cur')) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while creating new folder, may be created incompletly');
}
mkdir($fulldir . DIRECTORY_SEPARATOR . 'new');
mkdir($fulldir . DIRECTORY_SEPARATOR . 'tmp');
$localName = $parent ? substr($folder, strlen($parent) + 1) : $folder;
$this->getFolders($parent)->$localName = new Zend_Mail_Storage_Folder($localName, $folder, true);
return $fulldir;
} | [
"public",
"function",
"createFolder",
"(",
"$",
"name",
",",
"$",
"parentFolder",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"parentFolder",
"instanceof",
"Zend_Mail_Storage_Folder",
")",
"{",
"$",
"folder",
"=",
"$",
"parentFolder",
"->",
"getGlobalName",
"(",
... | create a new folder
This method also creates parent folders if necessary. Some mail storages may restrict, which folder
may be used as parent or which chars may be used in the folder name
@param string $name global name of folder, local name if $parentFolder is set
@param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent
@return string only used internally (new created maildir)
@throws Zend_Mail_Storage_Exception | [
"create",
"a",
"new",
"folder"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Writable/Maildir.php#L134-L213 | train | Create a new folder | [
30522,
2270,
3853,
3443,
10371,
2121,
1006,
1002,
2171,
1010,
1002,
6687,
10371,
2121,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
6687,
10371,
2121,
6013,
11253,
16729,
2094,
1035,
5653,
1035,
5527,
1035,
19622,
1007,
1063,
1002,
19622,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Http.php | Http.fetchRemoteFile | public static function fetchRemoteFile($url, $destinationPath = null, $tries = 0, $timeout = 10)
{
@ignore_user_abort(true);
SettingsServer::setMaxExecutionTime(0);
return self::sendHttpRequest($url, $timeout, 'Update', $destinationPath);
} | php | public static function fetchRemoteFile($url, $destinationPath = null, $tries = 0, $timeout = 10)
{
@ignore_user_abort(true);
SettingsServer::setMaxExecutionTime(0);
return self::sendHttpRequest($url, $timeout, 'Update', $destinationPath);
} | [
"public",
"static",
"function",
"fetchRemoteFile",
"(",
"$",
"url",
",",
"$",
"destinationPath",
"=",
"null",
",",
"$",
"tries",
"=",
"0",
",",
"$",
"timeout",
"=",
"10",
")",
"{",
"@",
"ignore_user_abort",
"(",
"true",
")",
";",
"SettingsServer",
"::",
... | Fetches a file located at `$url` and saves it to `$destinationPath`.
@param string $url The URL of the file to download.
@param string $destinationPath The path to download the file to.
@param int $tries (deprecated)
@param int $timeout The amount of seconds to wait before aborting the HTTP request.
@throws Exception if the response cannot be saved to `$destinationPath`, if the HTTP response cannot be sent,
if there are more than 5 redirects or if the request times out.
@return bool `true` on success, throws Exception on failure
@api | [
"Fetches",
"a",
"file",
"located",
"at",
"$url",
"and",
"saves",
"it",
"to",
"$destinationPath",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Http.php#L827-L832 | train | Fetch remote file from remote server | [
30522,
2270,
10763,
3853,
18584,
28578,
12184,
8873,
2571,
1006,
1002,
24471,
2140,
1010,
1002,
7688,
15069,
1027,
19701,
1010,
1002,
5363,
1027,
1014,
1010,
1002,
2051,
5833,
1027,
2184,
1007,
1063,
1030,
8568,
1035,
5310,
1035,
11113,
115... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Middleware/ThrottleRequests.php | ThrottleRequests.buildException | protected function buildException($key, $maxAttempts)
{
$retryAfter = $this->getTimeUntilNextRetry($key);
$headers = $this->getHeaders(
$maxAttempts,
$this->calculateRemainingAttempts($key, $maxAttempts, $retryAfter),
$retryAfter
);
return new ThrottleRequestsException(
'Too Many Attempts.', null, $headers
);
} | php | protected function buildException($key, $maxAttempts)
{
$retryAfter = $this->getTimeUntilNextRetry($key);
$headers = $this->getHeaders(
$maxAttempts,
$this->calculateRemainingAttempts($key, $maxAttempts, $retryAfter),
$retryAfter
);
return new ThrottleRequestsException(
'Too Many Attempts.', null, $headers
);
} | [
"protected",
"function",
"buildException",
"(",
"$",
"key",
",",
"$",
"maxAttempts",
")",
"{",
"$",
"retryAfter",
"=",
"$",
"this",
"->",
"getTimeUntilNextRetry",
"(",
"$",
"key",
")",
";",
"$",
"headers",
"=",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
... | Create a 'too many attempts' exception.
@param string $key
@param int $maxAttempts
@return \Illuminate\Http\Exceptions\ThrottleRequestsException | [
"Create",
"a",
"too",
"many",
"attempts",
"exception",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Middleware/ThrottleRequests.php#L114-L127 | train | Build ThrottleRequestsException. | [
30522,
5123,
3853,
3857,
10288,
24422,
1006,
1002,
3145,
1010,
1002,
4098,
19321,
6633,
22798,
1007,
1063,
1002,
2128,
11129,
10354,
3334,
1027,
1002,
2023,
1011,
1028,
2131,
7292,
16671,
4014,
2638,
18413,
13465,
2854,
1006,
1002,
3145,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Flex/FlexDirectory.php | FlexDirectory.getCollection | public function getCollection(array $keys = null, string $keyField = null): FlexCollectionInterface
{
// Get all selected entries.
$index = $this->getIndex($keys, $keyField);
if (!Utils::isAdminPlugin()) {
// If not in admin, filter the list by using default filters.
$filters = (array)$this->getConfig('site.filter', []);
foreach ($filters as $filter) {
$index = $index->{$filter}();
}
}
return $index;
} | php | public function getCollection(array $keys = null, string $keyField = null): FlexCollectionInterface
{
// Get all selected entries.
$index = $this->getIndex($keys, $keyField);
if (!Utils::isAdminPlugin()) {
// If not in admin, filter the list by using default filters.
$filters = (array)$this->getConfig('site.filter', []);
foreach ($filters as $filter) {
$index = $index->{$filter}();
}
}
return $index;
} | [
"public",
"function",
"getCollection",
"(",
"array",
"$",
"keys",
"=",
"null",
",",
"string",
"$",
"keyField",
"=",
"null",
")",
":",
"FlexCollectionInterface",
"{",
"// Get all selected entries.",
"$",
"index",
"=",
"$",
"this",
"->",
"getIndex",
"(",
"$",
... | Get collection. In the site this will be filtered by the default filters (published etc).
Use $directory->getIndex() if you want unfiltered collection.
@param array|null $keys Array of keys.
@param string|null $keyField Field to be used as the key.
@return FlexCollectionInterface | [
"Get",
"collection",
".",
"In",
"the",
"site",
"this",
"will",
"be",
"filtered",
"by",
"the",
"default",
"filters",
"(",
"published",
"etc",
")",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexDirectory.php#L186-L201 | train | Get collection of entries | [
30522,
2270,
3853,
2131,
26895,
18491,
1006,
9140,
1002,
6309,
1027,
19701,
1010,
5164,
1002,
3145,
3790,
1027,
19701,
1007,
1024,
23951,
26895,
18491,
18447,
2121,
12172,
1063,
1013,
1013,
2131,
2035,
3479,
10445,
1012,
1002,
5950,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/ServiceProvider.php | ServiceProvider.registerBackendPermissions | protected function registerBackendPermissions()
{
BackendAuth::registerCallback(function ($manager) {
$manager->registerPermissions('October.Cms', [
'cms.manage_content' => [
'label' => 'cms::lang.permissions.manage_content',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_assets' => [
'label' => 'cms::lang.permissions.manage_assets',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_pages' => [
'label' => 'cms::lang.permissions.manage_pages',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_layouts' => [
'label' => 'cms::lang.permissions.manage_layouts',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_partials' => [
'label' => 'cms::lang.permissions.manage_partials',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_themes' => [
'label' => 'cms::lang.permissions.manage_themes',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_theme_options' => [
'label' => 'cms::lang.permissions.manage_theme_options',
'tab' => 'cms::lang.permissions.name',
'order' => 100
],
]);
});
} | php | protected function registerBackendPermissions()
{
BackendAuth::registerCallback(function ($manager) {
$manager->registerPermissions('October.Cms', [
'cms.manage_content' => [
'label' => 'cms::lang.permissions.manage_content',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_assets' => [
'label' => 'cms::lang.permissions.manage_assets',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_pages' => [
'label' => 'cms::lang.permissions.manage_pages',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_layouts' => [
'label' => 'cms::lang.permissions.manage_layouts',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_partials' => [
'label' => 'cms::lang.permissions.manage_partials',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_themes' => [
'label' => 'cms::lang.permissions.manage_themes',
'tab' => 'cms::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'order' => 100
],
'cms.manage_theme_options' => [
'label' => 'cms::lang.permissions.manage_theme_options',
'tab' => 'cms::lang.permissions.name',
'order' => 100
],
]);
});
} | [
"protected",
"function",
"registerBackendPermissions",
"(",
")",
"{",
"BackendAuth",
"::",
"registerCallback",
"(",
"function",
"(",
"$",
"manager",
")",
"{",
"$",
"manager",
"->",
"registerPermissions",
"(",
"'October.Cms'",
",",
"[",
"'cms.manage_content'",
"=>",
... | /*
Register permissions | [
"/",
"*",
"Register",
"permissions"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/ServiceProvider.php#L188-L235 | train | Registers the permissions for the backend | [
30522,
5123,
3853,
4236,
5963,
10497,
4842,
25481,
2015,
1006,
1007,
1063,
2067,
10497,
4887,
2705,
1024,
1024,
4236,
9289,
20850,
8684,
1006,
3853,
1006,
1002,
3208,
1007,
1063,
1002,
3208,
1011,
1028,
4236,
4842,
25481,
2015,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/DataTable.php | DataTable.populateTableWidget | protected function populateTableWidget()
{
$dataSource = $this->table->getDataSource();
// TODO: provide a streaming implementation of loading
// data from the model. The current implementation loads
// all records at once. -ab
$records = $this->getLoadValue() ?: [];
$dataSource->purge();
$dataSource->initRecords((array) $records);
} | php | protected function populateTableWidget()
{
$dataSource = $this->table->getDataSource();
// TODO: provide a streaming implementation of loading
// data from the model. The current implementation loads
// all records at once. -ab
$records = $this->getLoadValue() ?: [];
$dataSource->purge();
$dataSource->initRecords((array) $records);
} | [
"protected",
"function",
"populateTableWidget",
"(",
")",
"{",
"$",
"dataSource",
"=",
"$",
"this",
"->",
"table",
"->",
"getDataSource",
"(",
")",
";",
"// TODO: provide a streaming implementation of loading",
"// data from the model. The current implementation loads",
"// a... | /*
Populate data | [
"/",
"*",
"Populate",
"data"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/DataTable.php#L133-L145 | train | Populates the table widget with the data from the model. | [
30522,
5123,
3853,
3769,
9869,
10880,
9148,
24291,
1006,
1007,
1063,
1002,
2951,
6499,
3126,
3401,
1027,
1002,
2023,
1011,
1028,
2795,
1011,
1028,
2131,
2850,
10230,
8162,
3401,
1006,
1007,
1025,
1013,
1013,
28681,
2080,
1024,
3073,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getExtension | protected function getExtension($path)
{
$extensions = array_keys($this->extensions);
return Arr::first($extensions, function ($value) use ($path) {
return Str::endsWith($path, '.'.$value);
});
} | php | protected function getExtension($path)
{
$extensions = array_keys($this->extensions);
return Arr::first($extensions, function ($value) use ($path) {
return Str::endsWith($path, '.'.$value);
});
} | [
"protected",
"function",
"getExtension",
"(",
"$",
"path",
")",
"{",
"$",
"extensions",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"extensions",
")",
";",
"return",
"Arr",
"::",
"first",
"(",
"$",
"extensions",
",",
"function",
"(",
"$",
"value",
")",
... | Get the extension used by the view file.
@param string $path
@return string | [
"Get",
"the",
"extension",
"used",
"by",
"the",
"view",
"file",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Factory.php#L297-L304 | train | Get the extension from the path | [
30522,
5123,
3853,
2131,
10288,
29048,
1006,
1002,
4130,
1007,
1063,
1002,
14305,
1027,
9140,
1035,
6309,
1006,
1002,
2023,
1011,
1028,
14305,
1007,
1025,
2709,
12098,
2099,
1024,
1024,
2034,
1006,
1002,
14305,
1010,
3853,
1006,
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/Component/HttpFoundation/BinaryFileResponse.php | BinaryFileResponse.setAutoEtag | public function setAutoEtag()
{
$this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true)));
return $this;
} | php | public function setAutoEtag()
{
$this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true)));
return $this;
} | [
"public",
"function",
"setAutoEtag",
"(",
")",
"{",
"$",
"this",
"->",
"setEtag",
"(",
"base64_encode",
"(",
"hash_file",
"(",
"'sha256'",
",",
"$",
"this",
"->",
"file",
"->",
"getPathname",
"(",
")",
",",
"true",
")",
")",
")",
";",
"return",
"$",
... | Automatically sets the ETag header according to the checksum of the file. | [
"Automatically",
"sets",
"the",
"ETag",
"header",
"according",
"to",
"the",
"checksum",
"of",
"the",
"file",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php#L140-L145 | train | Set auto - etag | [
30522,
2270,
3853,
2275,
4887,
3406,
12928,
2290,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
12928,
2290,
1006,
2918,
21084,
1035,
4372,
16044,
1006,
23325,
1035,
5371,
1006,
1005,
21146,
17788,
2575,
1005,
1010,
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... |
matomo-org/matomo | libs/Zend/Cache/Backend/Sqlite.php | Zend_Cache_Backend_Sqlite.save | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$this->_checkAndBuildStructure();
$lifetime = $this->getLifetime($specificLifetime);
$data = @sqlite_escape_string($data);
$mktime = time();
if ($lifetime === null) {
$expire = 0;
} else {
$expire = $mktime + $lifetime;
}
$this->_query("DELETE FROM cache WHERE id='$id'");
$sql = "INSERT INTO cache (id, content, lastModified, expire) VALUES ('$id', '$data', $mktime, $expire)";
$res = $this->_query($sql);
if (!$res) {
$this->_log("Zend_Cache_Backend_Sqlite::save() : impossible to store the cache id=$id");
return false;
}
$res = true;
foreach ($tags as $tag) {
$res = $this->_registerTag($id, $tag) && $res;
}
return $res;
} | php | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$this->_checkAndBuildStructure();
$lifetime = $this->getLifetime($specificLifetime);
$data = @sqlite_escape_string($data);
$mktime = time();
if ($lifetime === null) {
$expire = 0;
} else {
$expire = $mktime + $lifetime;
}
$this->_query("DELETE FROM cache WHERE id='$id'");
$sql = "INSERT INTO cache (id, content, lastModified, expire) VALUES ('$id', '$data', $mktime, $expire)";
$res = $this->_query($sql);
if (!$res) {
$this->_log("Zend_Cache_Backend_Sqlite::save() : impossible to store the cache id=$id");
return false;
}
$res = true;
foreach ($tags as $tag) {
$res = $this->_registerTag($id, $tag) && $res;
}
return $res;
} | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"id",
",",
"$",
"tags",
"=",
"array",
"(",
")",
",",
"$",
"specificLifetime",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_checkAndBuildStructure",
"(",
")",
";",
"$",
"lifetime",
"=",
"$",
... | Save some string datas into a cache record
Note : $data is always "string" (serialization is done by the
core not by the backend)
@param string $data Datas to cache
@param string $id Cache id
@param array $tags Array of strings, the cache record will be tagged by each string entry
@param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
@throws Zend_Cache_Exception
@return boolean True if no problem | [
"Save",
"some",
"string",
"datas",
"into",
"a",
"cache",
"record"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L159-L182 | train | Save cache data | [
30522,
2270,
3853,
3828,
1006,
1002,
2951,
1010,
1002,
8909,
1010,
1002,
22073,
1027,
9140,
1006,
1007,
1010,
1002,
3563,
15509,
7292,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
4638,
5685,
8569,
4014,
5104,
18300,
5397,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Auth/RegistersUsers.php | RegistersUsers.register | public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
return $this->registered($request, $user)
?: redirect($this->redirectPath());
} | php | public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
return $this->registered($request, $user)
?: redirect($this->redirectPath());
} | [
"public",
"function",
"register",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"validator",
"(",
"$",
"request",
"->",
"all",
"(",
")",
")",
"->",
"validate",
"(",
")",
";",
"event",
"(",
"new",
"Registered",
"(",
"$",
"user",
"=",
... | Handle a registration request for the application.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response | [
"Handle",
"a",
"registration",
"request",
"for",
"the",
"application",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/RegistersUsers.php#L29-L39 | train | Register a new user and return the user object | [
30522,
2270,
3853,
4236,
1006,
5227,
1002,
5227,
1007,
1063,
1002,
2023,
1011,
1028,
9398,
8844,
1006,
1002,
5227,
1011,
1028,
2035,
1006,
1007,
1007,
1011,
1028,
9398,
3686,
1006,
1007,
1025,
2724,
1006,
2047,
5068,
1006,
1002,
5310,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.getRelationExistenceQueryForSelfRelation | public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*'])
{
$query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash());
$query->getModel()->setTable($hash);
return $query->select($columns)->whereColumn(
$this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->getForeignKeyName()
);
} | php | public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*'])
{
$query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash());
$query->getModel()->setTable($hash);
return $query->select($columns)->whereColumn(
$this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->getForeignKeyName()
);
} | [
"public",
"function",
"getRelationExistenceQueryForSelfRelation",
"(",
"Builder",
"$",
"query",
",",
"Builder",
"$",
"parentQuery",
",",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"$",
"query",
"->",
"from",
"(",
"$",
"query",
"->",
"getModel",
"(",
"... | Add the constraints for a relationship query on the same table.
@param \Illuminate\Database\Eloquent\Builder $query
@param \Illuminate\Database\Eloquent\Builder $parentQuery
@param array|mixed $columns
@return \Illuminate\Database\Eloquent\Builder | [
"Add",
"the",
"constraints",
"for",
"a",
"relationship",
"query",
"on",
"the",
"same",
"table",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php#L338-L347 | train | Get Query for relation existence for self relation | [
30522,
2270,
3853,
2131,
16570,
3370,
10288,
27870,
5897,
4226,
2854,
29278,
11246,
19699,
10581,
3508,
1006,
12508,
1002,
23032,
1010,
12508,
1002,
6687,
4226,
2854,
1010,
1002,
7753,
1027,
1031,
1005,
1008,
1005,
1033,
1007,
1063,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Settings/Settings.php | Settings.addSetting | public function addSetting(Setting $setting)
{
$name = $setting->getName();
if (isset($this->settings[$name])) {
throw new \Exception(sprintf('A setting with name "%s" does already exist for plugin "%s"', $name, $this->pluginName));
}
$this->settings[$name] = $setting;
} | php | public function addSetting(Setting $setting)
{
$name = $setting->getName();
if (isset($this->settings[$name])) {
throw new \Exception(sprintf('A setting with name "%s" does already exist for plugin "%s"', $name, $this->pluginName));
}
$this->settings[$name] = $setting;
} | [
"public",
"function",
"addSetting",
"(",
"Setting",
"$",
"setting",
")",
"{",
"$",
"name",
"=",
"$",
"setting",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
... | Adds a new setting to the settings container.
@param Setting $setting
@throws \Exception If there is a setting with the same name that already exists.
If the name contains non-alphanumeric characters. | [
"Adds",
"a",
"new",
"setting",
"to",
"the",
"settings",
"container",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Settings.php#L102-L111 | train | Adds a new setting | [
30522,
2270,
3853,
9909,
18319,
3070,
1006,
4292,
1002,
4292,
1007,
1063,
1002,
2171,
1027,
1002,
4292,
1011,
1028,
2131,
18442,
1006,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
10906,
1031,
1002,
2171,
1033,
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/Config.php | Zend_Config.setExtend | public function setExtend($extendingSection, $extendedSection = null)
{
if ($extendedSection === null && isset($this->_extends[$extendingSection])) {
unset($this->_extends[$extendingSection]);
} else if ($extendedSection !== null) {
$this->_extends[$extendingSection] = $extendedSection;
}
} | php | public function setExtend($extendingSection, $extendedSection = null)
{
if ($extendedSection === null && isset($this->_extends[$extendingSection])) {
unset($this->_extends[$extendingSection]);
} else if ($extendedSection !== null) {
$this->_extends[$extendingSection] = $extendedSection;
}
} | [
"public",
"function",
"setExtend",
"(",
"$",
"extendingSection",
",",
"$",
"extendedSection",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"extendedSection",
"===",
"null",
"&&",
"isset",
"(",
"$",
"this",
"->",
"_extends",
"[",
"$",
"extendingSection",
"]",
")"... | Set an extend for Zend_Config_Writer
@param string $extendingSection
@param string $extendedSection
@return void | [
"Set",
"an",
"extend",
"for",
"Zend_Config_Writer"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Config.php#L405-L412 | train | Set Extend Section | [
30522,
2270,
3853,
2275,
10288,
6528,
2094,
1006,
1002,
8402,
29015,
1010,
1002,
3668,
29015,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
3668,
29015,
1027,
1027,
1027,
19701,
1004,
1004,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
1035,
8908... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form.php | Form.input | public function input($key, $value = null)
{
if (is_null($value)) {
return Arr::get($this->inputs, $key);
}
return Arr::set($this->inputs, $key, $value);
} | php | public function input($key, $value = null)
{
if (is_null($value)) {
return Arr::get($this->inputs, $key);
}
return Arr::set($this->inputs, $key, $value);
} | [
"public",
"function",
"input",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"inputs",
",",
"$",
"key",
")",
";",
"}",
... | Get or set input data.
@param string $key
@param null $value
@return array|mixed | [
"Get",
"or",
"set",
"input",
"data",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1378-L1385 | train | Get or set the input value | [
30522,
2270,
3853,
7953,
1006,
1002,
3145,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
3643,
1007,
1007,
1063,
2709,
12098,
2099,
1024,
1024,
2131,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/traits/ViewMaker.php | ViewMaker.getViewPath | public function getViewPath($fileName, $viewPath = null)
{
if (!isset($this->viewPath)) {
$this->viewPath = $this->guessViewPath();
}
if (!$viewPath) {
$viewPath = $this->viewPath;
}
$fileName = File::symbolizePath($fileName);
if (File::isLocalPath($fileName) ||
(!Config::get('cms.restrictBaseDir', true) && realpath($fileName) !== false)
) {
return $fileName;
}
if (!is_array($viewPath)) {
$viewPath = [$viewPath];
}
foreach ($viewPath as $path) {
$_fileName = File::symbolizePath($path) . '/' . $fileName;
if (File::isFile($_fileName)) {
return $_fileName;
}
}
return $fileName;
} | php | public function getViewPath($fileName, $viewPath = null)
{
if (!isset($this->viewPath)) {
$this->viewPath = $this->guessViewPath();
}
if (!$viewPath) {
$viewPath = $this->viewPath;
}
$fileName = File::symbolizePath($fileName);
if (File::isLocalPath($fileName) ||
(!Config::get('cms.restrictBaseDir', true) && realpath($fileName) !== false)
) {
return $fileName;
}
if (!is_array($viewPath)) {
$viewPath = [$viewPath];
}
foreach ($viewPath as $path) {
$_fileName = File::symbolizePath($path) . '/' . $fileName;
if (File::isFile($_fileName)) {
return $_fileName;
}
}
return $fileName;
} | [
"public",
"function",
"getViewPath",
"(",
"$",
"fileName",
",",
"$",
"viewPath",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"viewPath",
")",
")",
"{",
"$",
"this",
"->",
"viewPath",
"=",
"$",
"this",
"->",
"guessViewPath"... | Locates a file based on its definition. The file name can be prefixed with a
symbol (~|$) to return in context of the application or plugin base path,
otherwise it will be returned in context of this object view path.
@param string $fileName File to load.
@param mixed $viewPath Explicitly define a view path.
@return string Full path to the view file. | [
"Locates",
"a",
"file",
"based",
"on",
"its",
"definition",
".",
"The",
"file",
"name",
"can",
"be",
"prefixed",
"with",
"a",
"symbol",
"(",
"~|$",
")",
"to",
"return",
"in",
"context",
"of",
"the",
"application",
"or",
"plugin",
"base",
"path",
"otherwi... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ViewMaker.php#L183-L213 | train | Returns the view path of a file | [
30522,
2270,
3853,
2131,
8584,
15069,
1006,
1002,
5371,
18442,
1010,
1002,
3193,
15069,
1027,
19701,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
3193,
15069,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
3193,
15069,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OfficialAccount/Card/Client.php | Client.create | public function create($cardType = 'member_card', array $attributes)
{
$params = [
'card' => [
'card_type' => strtoupper($cardType),
strtolower($cardType) => $attributes,
],
];
return $this->httpPostJson('card/create', $params);
} | php | public function create($cardType = 'member_card', array $attributes)
{
$params = [
'card' => [
'card_type' => strtoupper($cardType),
strtolower($cardType) => $attributes,
],
];
return $this->httpPostJson('card/create', $params);
} | [
"public",
"function",
"create",
"(",
"$",
"cardType",
"=",
"'member_card'",
",",
"array",
"$",
"attributes",
")",
"{",
"$",
"params",
"=",
"[",
"'card'",
"=>",
"[",
"'card_type'",
"=>",
"strtoupper",
"(",
"$",
"cardType",
")",
",",
"strtolower",
"(",
"$"... | 创建卡券.
@param string $cardType
@param array $attributes
@return mixed | [
"创建卡券",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/Client.php#L73-L83 | train | Create a new member card | [
30522,
2270,
3853,
3443,
1006,
1002,
4003,
13874,
1027,
1005,
2266,
1035,
4003,
1005,
1010,
9140,
1002,
12332,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
4003,
1005,
1027,
1028,
1031,
1005,
4003,
1035,
2828,
1005,
1027,
1028,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Medium/AudioMedium.php | AudioMedium.preload | public function preload($preload)
{
$validPreloadAttrs = ['auto', 'metadata', 'none'];
if (\in_array($preload, $validPreloadAttrs, true)) {
$this->attributes['preload'] = $preload;
}
return $this;
} | php | public function preload($preload)
{
$validPreloadAttrs = ['auto', 'metadata', 'none'];
if (\in_array($preload, $validPreloadAttrs, true)) {
$this->attributes['preload'] = $preload;
}
return $this;
} | [
"public",
"function",
"preload",
"(",
"$",
"preload",
")",
"{",
"$",
"validPreloadAttrs",
"=",
"[",
"'auto'",
",",
"'metadata'",
",",
"'none'",
"]",
";",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"preload",
",",
"$",
"validPreloadAttrs",
",",
"true",
")",
... | Allows to set the preload behaviour
@param string $preload
@return $this | [
"Allows",
"to",
"set",
"the",
"preload",
"behaviour"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AudioMedium.php#L57-L66 | train | Set the preload attribute | [
30522,
2270,
3853,
3653,
11066,
1006,
1002,
3653,
11066,
1007,
1063,
1002,
9398,
28139,
11066,
19321,
2869,
1027,
1031,
1005,
30524,
2023,
1011,
1028,
12332,
1031,
1005,
3653,
11066,
1005,
1033,
1027,
1002,
3653,
11066,
1025,
1065,
2709,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UserCountry/API.php | API.getRegion | public function getRegion($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(Archiver::REGION_RECORD_NAME, $idSite, $period, $date, $segment);
$separator = Archiver::LOCATION_SEPARATOR;
$unk = Visit::UNKNOWN_CODE;
$dataTables = [$dataTable];
if ($dataTable instanceof DataTable\Map) {
$dataTables = $dataTable->getDataTables();
}
foreach ($dataTables as $dt) {
$archiveDate = $dt->getMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME);
// convert fips region codes to iso if required
if ($this->shouldRegionCodesBeConvertedToIso($archiveDate, $date, $period)) {
$dt->filter('GroupBy', array(
'label',
function ($label) use ($separator, $unk) {
$regionCode = getElementFromStringArray($label, $separator, 0, '');
$countryCode = getElementFromStringArray($label, $separator, 1, '');
list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso($countryCode,
$regionCode, true);
$splitLabel = explode($separator, $label);
if (isset($splitLabel[0])) {
$splitLabel[0] = $regionCode;
}
if (isset($splitLabel[1])) {
$splitLabel[1] = strtolower($countryCode);
}
return implode($separator, $splitLabel);
}
));
} else if ($dt->getRowFromLabel('1|ti')) {
$dt->filter('GroupBy', array(
'label',
function ($label) {
if ($label == '1|ti') {
return '14|cn';
}
return $label;
}
));
}
}
$segments = array('regionCode', 'countryCode');
$dataTable->filter('AddSegmentByLabel', array($segments, Archiver::LOCATION_SEPARATOR));
// split the label and put the elements into the 'region' and 'country' metadata fields
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 0, $unk)));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk)));
// add country name metadata
$dataTable->filter('MetadataCallbackAddMetadata',
array('country', 'country_name', __NAMESPACE__ . '\CountryTranslate', $applyToSummaryRow = false));
// get the region name of each row and put it into the 'region_name' metadata
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'region_name', __NAMESPACE__ . '\getRegionName', $params = null,
$applyToSummaryRow = false));
// add the country flag as a url to the 'logo' metadata field
$dataTable->filter('MetadataCallbackAddMetadata', array('country', 'logo', __NAMESPACE__ . '\getFlagFromCode'));
// prettify the region label
$dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getPrettyRegionName'));
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable;
} | php | public function getRegion($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(Archiver::REGION_RECORD_NAME, $idSite, $period, $date, $segment);
$separator = Archiver::LOCATION_SEPARATOR;
$unk = Visit::UNKNOWN_CODE;
$dataTables = [$dataTable];
if ($dataTable instanceof DataTable\Map) {
$dataTables = $dataTable->getDataTables();
}
foreach ($dataTables as $dt) {
$archiveDate = $dt->getMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME);
// convert fips region codes to iso if required
if ($this->shouldRegionCodesBeConvertedToIso($archiveDate, $date, $period)) {
$dt->filter('GroupBy', array(
'label',
function ($label) use ($separator, $unk) {
$regionCode = getElementFromStringArray($label, $separator, 0, '');
$countryCode = getElementFromStringArray($label, $separator, 1, '');
list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso($countryCode,
$regionCode, true);
$splitLabel = explode($separator, $label);
if (isset($splitLabel[0])) {
$splitLabel[0] = $regionCode;
}
if (isset($splitLabel[1])) {
$splitLabel[1] = strtolower($countryCode);
}
return implode($separator, $splitLabel);
}
));
} else if ($dt->getRowFromLabel('1|ti')) {
$dt->filter('GroupBy', array(
'label',
function ($label) {
if ($label == '1|ti') {
return '14|cn';
}
return $label;
}
));
}
}
$segments = array('regionCode', 'countryCode');
$dataTable->filter('AddSegmentByLabel', array($segments, Archiver::LOCATION_SEPARATOR));
// split the label and put the elements into the 'region' and 'country' metadata fields
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 0, $unk)));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk)));
// add country name metadata
$dataTable->filter('MetadataCallbackAddMetadata',
array('country', 'country_name', __NAMESPACE__ . '\CountryTranslate', $applyToSummaryRow = false));
// get the region name of each row and put it into the 'region_name' metadata
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'region_name', __NAMESPACE__ . '\getRegionName', $params = null,
$applyToSummaryRow = false));
// add the country flag as a url to the 'logo' metadata field
$dataTable->filter('MetadataCallbackAddMetadata', array('country', 'logo', __NAMESPACE__ . '\getFlagFromCode'));
// prettify the region label
$dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getPrettyRegionName'));
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable;
} | [
"public",
"function",
"getRegion",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"getDataTable",
"(",
"Archiver",
"::",
"REGION_RECORD_NAME",
",",
"$",
"... | Returns visit information for every region with at least one visit.
@param int|string $idSite
@param string $period
@param string $date
@param string|bool $segment
@return DataTable | [
"Returns",
"visit",
"information",
"for",
"every",
"region",
"with",
"at",
"least",
"one",
"visit",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/API.php#L91-L171 | train | Returns the region code for the given site period and date | [
30522,
2270,
3853,
2131,
23784,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1007,
1063,
1002,
2951,
10880,
1027,
1002,
2023,
1011,
1028,
2131,
2850,
29336,
3085,
1006,
8756,
2099,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php | Broadcaster.verifyUserCanAccessChannel | protected function verifyUserCanAccessChannel($request, $channel)
{
foreach ($this->channels as $pattern => $callback) {
if (! $this->channelNameMatchesPattern($channel, $pattern)) {
continue;
}
$parameters = $this->extractAuthParameters($pattern, $channel, $callback);
$handler = $this->normalizeChannelHandlerToCallable($callback);
if ($result = $handler($this->retrieveUser($request, $channel), ...$parameters)) {
return $this->validAuthenticationResponse($request, $result);
}
}
throw new AccessDeniedHttpException;
} | php | protected function verifyUserCanAccessChannel($request, $channel)
{
foreach ($this->channels as $pattern => $callback) {
if (! $this->channelNameMatchesPattern($channel, $pattern)) {
continue;
}
$parameters = $this->extractAuthParameters($pattern, $channel, $callback);
$handler = $this->normalizeChannelHandlerToCallable($callback);
if ($result = $handler($this->retrieveUser($request, $channel), ...$parameters)) {
return $this->validAuthenticationResponse($request, $result);
}
}
throw new AccessDeniedHttpException;
} | [
"protected",
"function",
"verifyUserCanAccessChannel",
"(",
"$",
"request",
",",
"$",
"channel",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"channels",
"as",
"$",
"pattern",
"=>",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"channelNa... | Authenticate the incoming request for a given channel.
@param \Illuminate\Http\Request $request
@param string $channel
@return mixed
@throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException | [
"Authenticate",
"the",
"incoming",
"request",
"for",
"a",
"given",
"channel",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php#L65-L82 | train | Verify user can access channel | [
30522,
5123,
3853,
20410,
20330,
28621,
9468,
7971,
26058,
1006,
1002,
5227,
1010,
1002,
3149,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
6833,
2004,
1002,
5418,
1027,
1028,
1002,
2655,
5963,
1007,
1063,
2065,
1006,
999,
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... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.getDistinctValues | protected function getDistinctValues($attribute)
{
$attributeName = $this->getPrimaryAttribute($attribute);
if (! property_exists($this, 'distinctValues')) {
return $this->extractDistinctValues($attributeName);
}
if (! array_key_exists($attributeName, $this->distinctValues)) {
$this->distinctValues[$attributeName] = $this->extractDistinctValues($attributeName);
}
return $this->distinctValues[$attributeName];
} | php | protected function getDistinctValues($attribute)
{
$attributeName = $this->getPrimaryAttribute($attribute);
if (! property_exists($this, 'distinctValues')) {
return $this->extractDistinctValues($attributeName);
}
if (! array_key_exists($attributeName, $this->distinctValues)) {
$this->distinctValues[$attributeName] = $this->extractDistinctValues($attributeName);
}
return $this->distinctValues[$attributeName];
} | [
"protected",
"function",
"getDistinctValues",
"(",
"$",
"attribute",
")",
"{",
"$",
"attributeName",
"=",
"$",
"this",
"->",
"getPrimaryAttribute",
"(",
"$",
"attribute",
")",
";",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"'distinctValues'",
... | Get the values to distinct between.
@param string $attribute
@return array | [
"Get",
"the",
"values",
"to",
"distinct",
"between",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L586-L599 | train | Returns the distinct values for the attribute | [
30522,
5123,
3853,
2131,
10521,
7629,
6593,
10175,
15808,
1006,
1002,
17961,
1007,
1063,
1002,
17961,
18442,
1027,
1002,
2023,
1011,
1028,
2131,
18098,
9581,
20444,
4779,
3089,
8569,
2618,
1006,
1002,
17961,
1007,
1025,
2065,
1006,
999,
320... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/MessageBag.php | MessageBag.hasAny | public function hasAny($keys = [])
{
if ($this->isEmpty()) {
return false;
}
$keys = is_array($keys) ? $keys : func_get_args();
foreach ($keys as $key) {
if ($this->has($key)) {
return true;
}
}
return false;
} | php | public function hasAny($keys = [])
{
if ($this->isEmpty()) {
return false;
}
$keys = is_array($keys) ? $keys : func_get_args();
foreach ($keys as $key) {
if ($this->has($key)) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasAny",
"(",
"$",
"keys",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"keys",
"=",
"is_array",
"(",
"$",
"keys",
")",
"?",
"$",
"keys",
":",
"... | Determine if messages exist for any of the given keys.
@param array|string $keys
@return bool | [
"Determine",
"if",
"messages",
"exist",
"for",
"any",
"of",
"the",
"given",
"keys",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/MessageBag.php#L133-L148 | train | Has Any key | [
30522,
2270,
3853,
17000,
2100,
1006,
1002,
6309,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
1002,
6309,
1027,
2003,
1035,
9140,
1006,
1002,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Security/RememberMe/DoctrineTokenProvider.php | DoctrineTokenProvider.loadTokenBySeries | public function loadTokenBySeries($series)
{
// the alias for lastUsed works around case insensitivity in PostgreSQL
$sql = 'SELECT class, username, value, lastUsed AS last_used'
.' FROM rememberme_token WHERE series=:series';
$paramValues = ['series' => $series];
$paramTypes = ['series' => \PDO::PARAM_STR];
$stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($row) {
return new PersistentToken($row['class'], $row['username'], $series, $row['value'], new \DateTime($row['last_used']));
}
throw new TokenNotFoundException('No token found.');
} | php | public function loadTokenBySeries($series)
{
// the alias for lastUsed works around case insensitivity in PostgreSQL
$sql = 'SELECT class, username, value, lastUsed AS last_used'
.' FROM rememberme_token WHERE series=:series';
$paramValues = ['series' => $series];
$paramTypes = ['series' => \PDO::PARAM_STR];
$stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($row) {
return new PersistentToken($row['class'], $row['username'], $series, $row['value'], new \DateTime($row['last_used']));
}
throw new TokenNotFoundException('No token found.');
} | [
"public",
"function",
"loadTokenBySeries",
"(",
"$",
"series",
")",
"{",
"// the alias for lastUsed works around case insensitivity in PostgreSQL",
"$",
"sql",
"=",
"'SELECT class, username, value, lastUsed AS last_used'",
".",
"' FROM rememberme_token WHERE series=:series'",
";",
"$... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php#L51-L66 | train | Load token by series | [
30522,
2270,
3853,
7170,
18715,
2368,
3762,
8043,
3111,
1006,
1002,
2186,
1007,
1063,
1013,
1013,
1996,
14593,
2005,
2197,
13901,
2573,
2105,
2553,
16021,
6132,
25090,
24872,
1999,
2695,
17603,
2015,
4160,
2140,
1002,
29296,
1027,
1005,
727... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ComponentHelpers.php | ComponentHelpers.getComponentName | public static function getComponentName($component)
{
$details = $component->componentDetails();
$name = $details['name'] ?? 'cms::lang.component.unnamed';
return Lang::get($name);
} | php | public static function getComponentName($component)
{
$details = $component->componentDetails();
$name = $details['name'] ?? 'cms::lang.component.unnamed';
return Lang::get($name);
} | [
"public",
"static",
"function",
"getComponentName",
"(",
"$",
"component",
")",
"{",
"$",
"details",
"=",
"$",
"component",
"->",
"componentDetails",
"(",
")",
";",
"$",
"name",
"=",
"$",
"details",
"[",
"'name'",
"]",
"??",
"'cms::lang.component.unnamed'",
... | Returns a component name.
@param mixed $component The component object
@return string | [
"Returns",
"a",
"component",
"name",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentHelpers.php#L108-L114 | train | Get component name | [
30522,
2270,
10763,
3853,
2131,
9006,
29513,
3372,
18442,
1006,
1002,
6922,
1007,
1063,
1002,
4751,
1027,
1002,
6922,
1011,
1028,
6922,
3207,
22081,
1006,
1007,
1025,
1002,
2171,
1027,
1002,
4751,
1031,
1005,
2171,
1005,
1033,
1029,
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... |
matomo-org/matomo | plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php | ServerBased.getSupportedLocationInfo | public function getSupportedLocationInfo()
{
$result = array();
// assume country info is always available. it's an error if it's not.
$result[self::COUNTRY_CODE_KEY] = true;
$result[self::COUNTRY_NAME_KEY] = true;
$result[self::CONTINENT_CODE_KEY] = true;
$result[self::CONTINENT_NAME_KEY] = true;
return $result;
} | php | public function getSupportedLocationInfo()
{
$result = array();
// assume country info is always available. it's an error if it's not.
$result[self::COUNTRY_CODE_KEY] = true;
$result[self::COUNTRY_NAME_KEY] = true;
$result[self::CONTINENT_CODE_KEY] = true;
$result[self::CONTINENT_NAME_KEY] = true;
return $result;
} | [
"public",
"function",
"getSupportedLocationInfo",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"// assume country info is always available. it's an error if it's not.",
"$",
"result",
"[",
"self",
"::",
"COUNTRY_CODE_KEY",
"]",
"=",
"true",
";",
"$",
"... | Returns an array describing the types of location information this provider will
return.
There's no way to tell exactly what database the HTTP server is using, so we just
assume country and continent information is available. This can make diagnostics
a bit more difficult, unfortunately.
@return array | [
"Returns",
"an",
"array",
"describing",
"the",
"types",
"of",
"location",
"information",
"this",
"provider",
"will",
"return",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php#L125-L136 | train | Get supported location info | [
30522,
2270,
3853,
4152,
6279,
6442,
2098,
4135,
10719,
2378,
14876,
1006,
1007,
1063,
1002,
2765,
1027,
9140,
1006,
1007,
1025,
1013,
1013,
7868,
2406,
18558,
2003,
2467,
2800,
1012,
2009,
1005,
1055,
2019,
7561,
2065,
2009,
1005,
1055,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Columns/Metrics/EvolutionMetric.php | EvolutionMetric.getPastRowFromCurrent | public function getPastRowFromCurrent(Row $row)
{
$pastData = $this->getPastDataTable();
if (empty($pastData)) {
return null;
}
$label = $row->getColumn('label');
return $label ? $pastData->getRowFromLabel($label) : $pastData->getFirstRow();
} | php | public function getPastRowFromCurrent(Row $row)
{
$pastData = $this->getPastDataTable();
if (empty($pastData)) {
return null;
}
$label = $row->getColumn('label');
return $label ? $pastData->getRowFromLabel($label) : $pastData->getFirstRow();
} | [
"public",
"function",
"getPastRowFromCurrent",
"(",
"Row",
"$",
"row",
")",
"{",
"$",
"pastData",
"=",
"$",
"this",
"->",
"getPastDataTable",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"pastData",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"la... | public for Insights use. | [
"public",
"for",
"Insights",
"use",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php#L144-L153 | train | Get past row from current row | [
30522,
2270,
3853,
2131,
19707,
13181,
2860,
19699,
5358,
10841,
14343,
3372,
1006,
5216,
1002,
5216,
1007,
1063,
1002,
2627,
2850,
2696,
1027,
1002,
2023,
1011,
1028,
2131,
19707,
2102,
2850,
29336,
3085,
1006,
1007,
1025,
2065,
1006,
4064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/ZendServer.php | Zend_Cache_Backend_ZendServer.clean | public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
$this->_clear();
return true;
break;
case Zend_Cache::CLEANING_MODE_OLD:
$this->_log("Zend_Cache_Backend_ZendServer::clean() : CLEANING_MODE_OLD is unsupported by the Zend Server backends.");
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$this->_clear();
$this->_log('Zend_Cache_Backend_ZendServer::clean() : tags are unsupported by the Zend Server backends.');
break;
default:
Zend_Cache::throwException('Invalid mode for clean() method');
break;
}
} | php | public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
$this->_clear();
return true;
break;
case Zend_Cache::CLEANING_MODE_OLD:
$this->_log("Zend_Cache_Backend_ZendServer::clean() : CLEANING_MODE_OLD is unsupported by the Zend Server backends.");
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$this->_clear();
$this->_log('Zend_Cache_Backend_ZendServer::clean() : tags are unsupported by the Zend Server backends.');
break;
default:
Zend_Cache::throwException('Invalid mode for clean() method');
break;
}
} | [
"public",
"function",
"clean",
"(",
"$",
"mode",
"=",
"Zend_Cache",
"::",
"CLEANING_MODE_ALL",
",",
"$",
"tags",
"=",
"array",
"(",
")",
")",
"{",
"switch",
"(",
"$",
"mode",
")",
"{",
"case",
"Zend_Cache",
"::",
"CLEANING_MODE_ALL",
":",
"$",
"this",
... | Clean some cache records
Available modes are :
'all' (default) => remove all cache entries ($tags is not used)
'old' => unsupported
'matchingTag' => unsupported
'notMatchingTag' => unsupported
'matchingAnyTag' => unsupported
@param string $mode clean mode
@param array $tags array of tags
@throws Zend_Cache_Exception
@return boolean true if no problem | [
"Clean",
"some",
"cache",
"records"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/ZendServer.php#L186-L206 | train | Clean the cache | [
30522,
2270,
3853,
4550,
1006,
1002,
5549,
1027,
16729,
2094,
1035,
17053,
1024,
1024,
9344,
1035,
5549,
1035,
2035,
1010,
1002,
22073,
1027,
9140,
1006,
1007,
1007,
1063,
6942,
1006,
1002,
5549,
1007,
1063,
2553,
16729,
2094,
1035,
17053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Definition.php | Definition.setDecoratedService | public function setDecoratedService($id, $renamedId = null, $priority = 0)
{
if ($renamedId && $id === $renamedId) {
throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));
}
$this->changes['decorated_service'] = true;
if (null === $id) {
$this->decoratedService = null;
} else {
$this->decoratedService = [$id, $renamedId, (int) $priority];
}
return $this;
} | php | public function setDecoratedService($id, $renamedId = null, $priority = 0)
{
if ($renamedId && $id === $renamedId) {
throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));
}
$this->changes['decorated_service'] = true;
if (null === $id) {
$this->decoratedService = null;
} else {
$this->decoratedService = [$id, $renamedId, (int) $priority];
}
return $this;
} | [
"public",
"function",
"setDecoratedService",
"(",
"$",
"id",
",",
"$",
"renamedId",
"=",
"null",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"renamedId",
"&&",
"$",
"id",
"===",
"$",
"renamedId",
")",
"{",
"throw",
"new",
"InvalidArgument... | Sets the service that this service is decorating.
@param string|null $id The decorated service id, use null to remove decoration
@param string|null $renamedId The new decorated service id
@param int $priority The priority of decoration
@return $this
@throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals | [
"Sets",
"the",
"service",
"that",
"this",
"service",
"is",
"decorating",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Definition.php#L138-L153 | train | Set the decorated service name | [
30522,
2270,
3853,
2275,
3207,
27108,
4383,
8043,
7903,
2063,
1006,
1002,
8909,
1010,
1002,
4096,
3593,
1027,
19701,
1010,
1002,
9470,
1027,
1014,
1007,
1063,
2065,
1006,
1002,
4096,
3593,
1004,
1004,
1002,
8909,
1027,
1027,
1027,
1002,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UserCountry/LocationProvider/DefaultProvider.php | DefaultProvider.getInfo | public function getInfo()
{
$desc = Piwik::translate('UserCountry_DefaultLocationProviderDesc1') . ' '
. Piwik::translate('UserCountry_DefaultLocationProviderDesc2',
array('<strong>', '', '', '</strong>'))
. '<p><a href="https://matomo.org/faq/how-to/#faq_163" rel="noreferrer noopener" target="_blank">'
. Piwik::translate('UserCountry_HowToInstallGeoIPDatabases')
. '</a></p>';
return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'order' => 1);
} | php | public function getInfo()
{
$desc = Piwik::translate('UserCountry_DefaultLocationProviderDesc1') . ' '
. Piwik::translate('UserCountry_DefaultLocationProviderDesc2',
array('<strong>', '', '', '</strong>'))
. '<p><a href="https://matomo.org/faq/how-to/#faq_163" rel="noreferrer noopener" target="_blank">'
. Piwik::translate('UserCountry_HowToInstallGeoIPDatabases')
. '</a></p>';
return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'order' => 1);
} | [
"public",
"function",
"getInfo",
"(",
")",
"{",
"$",
"desc",
"=",
"Piwik",
"::",
"translate",
"(",
"'UserCountry_DefaultLocationProviderDesc1'",
")",
".",
"' '",
".",
"Piwik",
"::",
"translate",
"(",
"'UserCountry_DefaultLocationProviderDesc2'",
",",
"array",
"(",
... | Returns information about this location provider. Contains an id, title & description:
array(
'id' => 'default',
'title' => '...',
'description' => '...'
);
@return array | [
"Returns",
"information",
"about",
"this",
"location",
"provider",
".",
"Contains",
"an",
"id",
"title",
"&",
"description",
":"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/DefaultProvider.php#L102-L111 | train | Returns an array with the information about the country | [
30522,
2270,
3853,
2131,
2378,
14876,
1006,
1007,
1063,
1002,
4078,
2278,
1027,
14255,
9148,
2243,
1024,
1024,
17637,
1006,
1005,
5310,
3597,
16671,
2854,
1035,
12398,
4135,
10719,
21572,
17258,
2121,
6155,
2278,
2487,
1005,
1007,
1012,
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/Support/MessageBag.php | MessageBag.add | public function add($key, $message)
{
if ($this->isUnique($key, $message)) {
$this->messages[$key][] = $message;
}
return $this;
} | php | public function add($key, $message)
{
if ($this->isUnique($key, $message)) {
$this->messages[$key][] = $message;
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isUnique",
"(",
"$",
"key",
",",
"$",
"message",
")",
")",
"{",
"$",
"this",
"->",
"messages",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$... | Add a message to the message bag.
@param string $key
@param string $message
@return $this | [
"Add",
"a",
"message",
"to",
"the",
"message",
"bag",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/MessageBag.php#L60-L67 | train | Add message to the message array | [
30522,
2270,
3853,
5587,
1006,
1002,
3145,
1010,
1002,
4471,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
19496,
4226,
1006,
1002,
3145,
1010,
1002,
4471,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
7696,
1031,
1002,
3145,
1033,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
walkor/Workerman | Protocols/Websocket.php | Websocket.encode | public static function encode($buffer, ConnectionInterface $connection)
{
if (!is_scalar($buffer)) {
throw new \Exception("You can't send(" . gettype($buffer) . ") to client, you need to convert it to a string. ");
}
$len = strlen($buffer);
if (empty($connection->websocketType)) {
$connection->websocketType = static::BINARY_TYPE_BLOB;
}
$first_byte = $connection->websocketType;
if ($len <= 125) {
$encode_buffer = $first_byte . chr($len) . $buffer;
} else {
if ($len <= 65535) {
$encode_buffer = $first_byte . chr(126) . pack("n", $len) . $buffer;
} else {
$encode_buffer = $first_byte . chr(127) . pack("xxxxN", $len) . $buffer;
}
}
// Handshake not completed so temporary buffer websocket data waiting for send.
if (empty($connection->websocketHandshake)) {
if (empty($connection->tmpWebsocketData)) {
$connection->tmpWebsocketData = '';
}
// If buffer has already full then discard the current package.
if (strlen($connection->tmpWebsocketData) > $connection->maxSendBufferSize) {
if ($connection->onError) {
try {
call_user_func($connection->onError, $connection, WORKERMAN_SEND_FAIL, 'send buffer full and drop package');
} catch (\Exception $e) {
Worker::log($e);
exit(250);
} catch (\Error $e) {
Worker::log($e);
exit(250);
}
}
return '';
}
$connection->tmpWebsocketData .= $encode_buffer;
// Check buffer is full.
if ($connection->maxSendBufferSize <= strlen($connection->tmpWebsocketData)) {
if ($connection->onBufferFull) {
try {
call_user_func($connection->onBufferFull, $connection);
} catch (\Exception $e) {
Worker::log($e);
exit(250);
} catch (\Error $e) {
Worker::log($e);
exit(250);
}
}
}
// Return empty string.
return '';
}
return $encode_buffer;
} | php | public static function encode($buffer, ConnectionInterface $connection)
{
if (!is_scalar($buffer)) {
throw new \Exception("You can't send(" . gettype($buffer) . ") to client, you need to convert it to a string. ");
}
$len = strlen($buffer);
if (empty($connection->websocketType)) {
$connection->websocketType = static::BINARY_TYPE_BLOB;
}
$first_byte = $connection->websocketType;
if ($len <= 125) {
$encode_buffer = $first_byte . chr($len) . $buffer;
} else {
if ($len <= 65535) {
$encode_buffer = $first_byte . chr(126) . pack("n", $len) . $buffer;
} else {
$encode_buffer = $first_byte . chr(127) . pack("xxxxN", $len) . $buffer;
}
}
// Handshake not completed so temporary buffer websocket data waiting for send.
if (empty($connection->websocketHandshake)) {
if (empty($connection->tmpWebsocketData)) {
$connection->tmpWebsocketData = '';
}
// If buffer has already full then discard the current package.
if (strlen($connection->tmpWebsocketData) > $connection->maxSendBufferSize) {
if ($connection->onError) {
try {
call_user_func($connection->onError, $connection, WORKERMAN_SEND_FAIL, 'send buffer full and drop package');
} catch (\Exception $e) {
Worker::log($e);
exit(250);
} catch (\Error $e) {
Worker::log($e);
exit(250);
}
}
return '';
}
$connection->tmpWebsocketData .= $encode_buffer;
// Check buffer is full.
if ($connection->maxSendBufferSize <= strlen($connection->tmpWebsocketData)) {
if ($connection->onBufferFull) {
try {
call_user_func($connection->onBufferFull, $connection);
} catch (\Exception $e) {
Worker::log($e);
exit(250);
} catch (\Error $e) {
Worker::log($e);
exit(250);
}
}
}
// Return empty string.
return '';
}
return $encode_buffer;
} | [
"public",
"static",
"function",
"encode",
"(",
"$",
"buffer",
",",
"ConnectionInterface",
"$",
"connection",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"buffer",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"You can't send(\"",
".",
"gett... | Websocket encode.
@param string $buffer
@param ConnectionInterface $connection
@return string | [
"Websocket",
"encode",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Websocket.php#L233-L296 | train | Encode buffer to client | [
30522,
2270,
10763,
3853,
4372,
16044,
1006,
1002,
17698,
1010,
4434,
18447,
2121,
12172,
1002,
4434,
1007,
1063,
2065,
1006,
999,
2003,
1035,
26743,
2099,
1006,
1002,
17698,
1007,
1007,
1063,
5466,
2047,
1032,
6453,
1006,
1000,
2017,
2064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.save | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$lifetime = $this->getLifetime($specificLifetime);
if ($this->_options['compression']) {
$flag = MEMCACHE_COMPRESSED;
} else {
$flag = 0;
}
// ZF-8856: using set because add needs a second request if item already exists
$result = @$this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
if (count($tags) > 0) {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND);
}
return $result;
} | php | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$lifetime = $this->getLifetime($specificLifetime);
if ($this->_options['compression']) {
$flag = MEMCACHE_COMPRESSED;
} else {
$flag = 0;
}
// ZF-8856: using set because add needs a second request if item already exists
$result = @$this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
if (count($tags) > 0) {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND);
}
return $result;
} | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"id",
",",
"$",
"tags",
"=",
"array",
"(",
")",
",",
"$",
"specificLifetime",
"=",
"false",
")",
"{",
"$",
"lifetime",
"=",
"$",
"this",
"->",
"getLifetime",
"(",
"$",
"specificLifetime",
")",... | Save some string datas into a cache record
Note : $data is always "string" (serialization is done by the
core not by the backend)
@param string $data Datas to cache
@param string $id Cache id
@param array $tags Array of strings, the cache record will be tagged by each string entry
@param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
@return boolean True if no problem | [
"Save",
"some",
"string",
"datas",
"into",
"a",
"cache",
"record"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Memcached.php#L214-L231 | train | Save data into cache | [
30522,
2270,
3853,
3828,
1006,
1002,
2951,
1010,
1002,
8909,
1010,
1002,
22073,
1027,
9140,
1006,
1007,
1010,
1002,
3563,
15509,
7292,
1027,
6270,
1007,
1063,
1002,
6480,
1027,
1002,
2023,
1011,
1028,
2131,
15509,
7292,
1006,
1002,
3563,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.removeDefinition | public function removeDefinition($id)
{
if (isset($this->definitions[$id = (string) $id])) {
unset($this->definitions[$id]);
$this->removedIds[$id] = true;
}
} | php | public function removeDefinition($id)
{
if (isset($this->definitions[$id = (string) $id])) {
unset($this->definitions[$id]);
$this->removedIds[$id] = true;
}
} | [
"public",
"function",
"removeDefinition",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"definitions",
"[",
"$",
"id",
"=",
"(",
"string",
")",
"$",
"id",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"definitions",
... | Removes a service definition.
@param string $id The service identifier | [
"Removes",
"a",
"service",
"definition",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L515-L521 | train | Remove a definition from the stack | [
30522,
2270,
3853,
3718,
12879,
5498,
3508,
1006,
1002,
8909,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
15182,
1031,
1002,
8909,
1027,
1006,
5164,
1007,
1002,
8909,
1033,
1007,
1007,
1063,
4895,
13462,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Asset.php | Asset.validateFileName | protected function validateFileName($fileName = null)
{
if ($fileName === null) {
$fileName = $this->fileName;
}
$fileName = trim($fileName);
if (!strlen($fileName)) {
throw new ValidationException(['fileName' =>
Lang::get('cms::lang.cms_object.file_name_required', [
'allowed' => implode(', ', $this->allowedExtensions),
'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)
])
]);
}
if (!FileHelper::validateExtension($fileName, $this->allowedExtensions, false)) {
throw new ValidationException(['fileName' =>
Lang::get('cms::lang.cms_object.invalid_file_extension', [
'allowed' => implode(', ', $this->allowedExtensions),
'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)
])
]);
}
if (!FileHelper::validatePath($fileName, null)) {
throw new ValidationException(['fileName' =>
Lang::get('cms::lang.cms_object.invalid_file', [
'name' => $fileName
])
]);
}
} | php | protected function validateFileName($fileName = null)
{
if ($fileName === null) {
$fileName = $this->fileName;
}
$fileName = trim($fileName);
if (!strlen($fileName)) {
throw new ValidationException(['fileName' =>
Lang::get('cms::lang.cms_object.file_name_required', [
'allowed' => implode(', ', $this->allowedExtensions),
'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)
])
]);
}
if (!FileHelper::validateExtension($fileName, $this->allowedExtensions, false)) {
throw new ValidationException(['fileName' =>
Lang::get('cms::lang.cms_object.invalid_file_extension', [
'allowed' => implode(', ', $this->allowedExtensions),
'invalid' => pathinfo($fileName, PATHINFO_EXTENSION)
])
]);
}
if (!FileHelper::validatePath($fileName, null)) {
throw new ValidationException(['fileName' =>
Lang::get('cms::lang.cms_object.invalid_file', [
'name' => $fileName
])
]);
}
} | [
"protected",
"function",
"validateFileName",
"(",
"$",
"fileName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fileName",
"===",
"null",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"fileName",
";",
"}",
"$",
"fileName",
"=",
"trim",
"(",
"$",
"fil... | Validate the supplied filename, extension and path.
@param string $fileName | [
"Validate",
"the",
"supplied",
"filename",
"extension",
"and",
"path",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Asset.php#L233-L266 | train | Validate the file name | [
30522,
5123,
3853,
9398,
3686,
8873,
20844,
4168,
1006,
1002,
5371,
18442,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
5371,
18442,
1027,
1027,
1027,
30524,
1002,
5371,
18442,
1027,
12241,
1006,
1002,
5371,
18442,
1007,
1025,
2065,
1006,
999... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Http/Request.php | Request.getParams | public function getParams(array $only = null)
{
$params = $this->getQueryParams();
$postParams = $this->getParsedBody();
if ($postParams) {
$params = array_replace($params, (array)$postParams);
}
if ($only) {
$onlyParams = [];
foreach ($only as $key) {
if (array_key_exists($key, $params)) {
$onlyParams[$key] = $params[$key];
}
}
return $onlyParams;
}
return $params;
} | php | public function getParams(array $only = null)
{
$params = $this->getQueryParams();
$postParams = $this->getParsedBody();
if ($postParams) {
$params = array_replace($params, (array)$postParams);
}
if ($only) {
$onlyParams = [];
foreach ($only as $key) {
if (array_key_exists($key, $params)) {
$onlyParams[$key] = $params[$key];
}
}
return $onlyParams;
}
return $params;
} | [
"public",
"function",
"getParams",
"(",
"array",
"$",
"only",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getQueryParams",
"(",
")",
";",
"$",
"postParams",
"=",
"$",
"this",
"->",
"getParsedBody",
"(",
")",
";",
"if",
"(",
"$",
... | Fetch associative array of body and query string parameters.
Note: This method is not part of the PSR-7 standard.
@param array|null $only list the keys to retrieve.
@return array|null | [
"Fetch",
"associative",
"array",
"of",
"body",
"and",
"query",
"string",
"parameters",
"."
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Request.php#L1191-L1210 | train | Get Params from Request | [
30522,
2270,
3853,
2131,
28689,
5244,
1006,
9140,
1002,
2069,
1027,
19701,
1007,
1063,
1002,
11498,
5244,
1027,
1002,
2023,
1011,
1028,
2131,
4226,
2854,
28689,
5244,
1006,
1007,
1025,
1002,
2695,
28689,
5244,
1027,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/MobileMessaging/API.php | API.sendSMS | public function sendSMS($content, $phoneNumber, $from)
{
Piwik::checkUserIsNotAnonymous();
$credential = $this->getSMSAPICredential();
$SMSProvider = SMSProvider::factory($credential[MobileMessaging::PROVIDER_OPTION]);
$SMSProvider->sendSMS(
$credential[MobileMessaging::API_KEY_OPTION],
$content,
$phoneNumber,
$from
);
$this->increaseCount(MobileMessaging::SMS_SENT_COUNT_OPTION, $phoneNumber);
return true;
} | php | public function sendSMS($content, $phoneNumber, $from)
{
Piwik::checkUserIsNotAnonymous();
$credential = $this->getSMSAPICredential();
$SMSProvider = SMSProvider::factory($credential[MobileMessaging::PROVIDER_OPTION]);
$SMSProvider->sendSMS(
$credential[MobileMessaging::API_KEY_OPTION],
$content,
$phoneNumber,
$from
);
$this->increaseCount(MobileMessaging::SMS_SENT_COUNT_OPTION, $phoneNumber);
return true;
} | [
"public",
"function",
"sendSMS",
"(",
"$",
"content",
",",
"$",
"phoneNumber",
",",
"$",
"from",
")",
"{",
"Piwik",
"::",
"checkUserIsNotAnonymous",
"(",
")",
";",
"$",
"credential",
"=",
"$",
"this",
"->",
"getSMSAPICredential",
"(",
")",
";",
"$",
"SMS... | send a SMS
@param string $content
@param string $phoneNumber
@param string $from
@return bool true
@ignore | [
"send",
"a",
"SMS"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MobileMessaging/API.php#L158-L174 | train | Send SMS to user | [
30522,
2270,
3853,
10255,
5244,
1006,
1002,
4180,
1010,
1002,
3042,
19172,
5677,
1010,
1002,
2013,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
2483,
17048,
6761,
4890,
27711,
1006,
1007,
1025,
1002,
13675,
14728,
19909,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Period/Range.php | Range.getPrettyString | public function getPrettyString()
{
$out = $this->translator->translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString()));
return $out;
} | php | public function getPrettyString()
{
$out = $this->translator->translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString()));
return $out;
} | [
"public",
"function",
"getPrettyString",
"(",
")",
"{",
"$",
"out",
"=",
"$",
"this",
"->",
"translator",
"->",
"translate",
"(",
"'General_DateRangeFromTo'",
",",
"array",
"(",
"$",
"this",
"->",
"getDateStart",
"(",
")",
"->",
"toString",
"(",
")",
",",
... | Returns the current period as a string.
@return string | [
"Returns",
"the",
"current",
"period",
"as",
"a",
"string",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L166-L170 | train | Get the translated date range from to or from the current date range | [
30522,
2270,
3853,
2131,
28139,
15353,
3367,
4892,
1006,
1007,
1063,
1002,
2041,
1027,
1002,
2023,
1011,
1028,
11403,
1011,
1028,
17637,
1006,
1005,
2236,
1035,
3058,
24388,
12879,
21716,
3406,
1005,
1010,
9140,
1006,
1002,
2023,
1011,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php | CodeHelper.fileExcerpt | public function fileExcerpt($file, $line)
{
if (is_readable($file)) {
if (\extension_loaded('fileinfo')) {
$finfo = new \finfo();
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) {
return;
}
}
// highlight_file could throw warnings
// see https://bugs.php.net/bug.php?id=25725
$code = @highlight_file($file, true);
// remove main code/span tags
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
$content = explode('<br />', $code);
$lines = [];
for ($i = max($line - 3, 1), $max = min($line + 3, \count($content)); $i <= $max; ++$i) {
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
}
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
}
} | php | public function fileExcerpt($file, $line)
{
if (is_readable($file)) {
if (\extension_loaded('fileinfo')) {
$finfo = new \finfo();
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) {
return;
}
}
// highlight_file could throw warnings
// see https://bugs.php.net/bug.php?id=25725
$code = @highlight_file($file, true);
// remove main code/span tags
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
$content = explode('<br />', $code);
$lines = [];
for ($i = max($line - 3, 1), $max = min($line + 3, \count($content)); $i <= $max; ++$i) {
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>';
}
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
}
} | [
"public",
"function",
"fileExcerpt",
"(",
"$",
"file",
",",
"$",
"line",
")",
"{",
"if",
"(",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"if",
"(",
"\\",
"extension_loaded",
"(",
"'fileinfo'",
")",
")",
"{",
"$",
"finfo",
"=",
"new",
"\\",
"fi... | Returns an excerpt of a code file around the given line number.
@param string $file A file path
@param int $line The selected line number
@return string An HTML string | [
"Returns",
"an",
"excerpt",
"of",
"a",
"code",
"file",
"around",
"the",
"given",
"line",
"number",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php#L121-L147 | train | Highlights a file and returns the excerpt | [
30522,
2270,
3853,
5371,
10288,
17119,
13876,
1006,
1002,
5371,
1010,
1002,
2240,
1007,
1063,
2065,
1006,
2003,
1035,
3191,
3085,
1006,
1002,
5371,
1007,
1007,
1063,
2065,
1006,
1032,
5331,
1035,
8209,
1006,
1005,
5371,
2378,
14876,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/VarDumper/Dumper/CliDumper.php | CliDumper.leaveHash | public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
$this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : ''));
$this->endValue($cursor);
} | php | public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
$this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : ''));
$this->endValue($cursor);
} | [
"public",
"function",
"leaveHash",
"(",
"Cursor",
"$",
"cursor",
",",
"$",
"type",
",",
"$",
"class",
",",
"$",
"hasChild",
",",
"$",
"cut",
")",
"{",
"$",
"this",
"->",
"dumpEllipsis",
"(",
"$",
"cursor",
",",
"$",
"hasChild",
",",
"$",
"cut",
")"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/CliDumper.php#L311-L316 | train | Enter a hash statement | [
30522,
2270,
3853,
2681,
14949,
2232,
1006,
12731,
25301,
2099,
1002,
12731,
25301,
2099,
1010,
1002,
2828,
1010,
1002,
2465,
1010,
1002,
2038,
19339,
1010,
1002,
3013,
1007,
1063,
1002,
2023,
1011,
1028,
15653,
13348,
18409,
1006,
1002,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Menu/MenuAbstract.php | MenuAbstract.applyOrdering | private function applyOrdering()
{
if (empty($this->menu)
|| $this->orderingApplied
) {
return;
}
uasort($this->menu, array($this, 'menuCompare'));
foreach ($this->menu as $key => &$element) {
if (is_null($element)) {
unset($this->menu[$key]);
} elseif ($element['_hasSubmenu']) {
uasort($element, array($this, 'menuCompare'));
}
}
$this->orderingApplied = true;
} | php | private function applyOrdering()
{
if (empty($this->menu)
|| $this->orderingApplied
) {
return;
}
uasort($this->menu, array($this, 'menuCompare'));
foreach ($this->menu as $key => &$element) {
if (is_null($element)) {
unset($this->menu[$key]);
} elseif ($element['_hasSubmenu']) {
uasort($element, array($this, 'menuCompare'));
}
}
$this->orderingApplied = true;
} | [
"private",
"function",
"applyOrdering",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"menu",
")",
"||",
"$",
"this",
"->",
"orderingApplied",
")",
"{",
"return",
";",
"}",
"uasort",
"(",
"$",
"this",
"->",
"menu",
",",
"array",
"(",
"... | Orders the menu according to their order. | [
"Orders",
"the",
"menu",
"according",
"to",
"their",
"order",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAbstract.php#L305-L323 | train | Apply the menu ordering | [
30522,
2797,
3853,
6611,
8551,
7999,
1006,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
12183,
1007,
1064,
1064,
1002,
2023,
1011,
1028,
13063,
29098,
8751,
2094,
1007,
1063,
2709,
1025,
1065,
25423,
21748,
2102,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Menu.php | Menu.urlForModuleActionWithDefaultUserParams | protected function urlForModuleActionWithDefaultUserParams($module, $controllerAction, $additionalParams = array())
{
$urlModuleAction = $this->urlForModuleAction($module, $controllerAction);
$date = Common::getRequestVar('date', false);
if ($date) {
$urlModuleAction['date'] = $date;
}
$period = Common::getRequestVar('period', false);
if ($period) {
$urlModuleAction['period'] = $period;
}
// We want the current query parameters to override the user's defaults
return array_merge(
$this->urlForDefaultUserParams(),
$urlModuleAction,
$additionalParams
);
} | php | protected function urlForModuleActionWithDefaultUserParams($module, $controllerAction, $additionalParams = array())
{
$urlModuleAction = $this->urlForModuleAction($module, $controllerAction);
$date = Common::getRequestVar('date', false);
if ($date) {
$urlModuleAction['date'] = $date;
}
$period = Common::getRequestVar('period', false);
if ($period) {
$urlModuleAction['period'] = $period;
}
// We want the current query parameters to override the user's defaults
return array_merge(
$this->urlForDefaultUserParams(),
$urlModuleAction,
$additionalParams
);
} | [
"protected",
"function",
"urlForModuleActionWithDefaultUserParams",
"(",
"$",
"module",
",",
"$",
"controllerAction",
",",
"$",
"additionalParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"urlModuleAction",
"=",
"$",
"this",
"->",
"urlForModuleAction",
"(",
"$",
... | Generates a URL to the given action of the given module, and it will also append some URL query parameters from the
User preferences: idSite, period, date. If you do not need the parameters idSite, period and date to be generated
use {@link urlForModuleAction()} instead.
@param string $module The name of the module/plugin the action belongs to. The module name is case sensitive.
@param string $controllerAction The name of the action that should be executed within your controller
@param array $additionalParams Optional URL parameters that will be appended to the URL
@return array|null Returns the array of query parameter names and values to the given module action and idSite date and period.
Returns null if the module or action is invalid. | [
"Generates",
"a",
"URL",
"to",
"the",
"given",
"action",
"of",
"the",
"given",
"module",
"and",
"it",
"will",
"also",
"append",
"some",
"URL",
"query",
"parameters",
"from",
"the",
"User",
"preferences",
":",
"idSite",
"period",
"date",
".",
"If",
"you",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Menu.php#L157-L176 | train | Returns the URL parameters for the module action with the default user parameters | [
30522,
5123,
3853,
24471,
10270,
2953,
5302,
8566,
19738,
7542,
24415,
3207,
7011,
11314,
20330,
28689,
5244,
1006,
1002,
11336,
1010,
1002,
11486,
18908,
3258,
1010,
1002,
3176,
28689,
5244,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
24471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Iban.php | Zend_Validate_Iban.isValid | public function isValid($value)
{
$value = strtoupper($value);
$this->_setValue($value);
if (empty($this->_locale)) {
$region = substr($value, 0, 2);
} else {
$region = new Zend_Locale($this->_locale);
$region = $region->getRegion();
}
if (!array_key_exists($region, $this->_ibanregex)) {
$this->_setValue($region);
$this->_error(self::NOTSUPPORTED);
return false;
}
if (!preg_match($this->_ibanregex[$region], $value)) {
$this->_error(self::FALSEFORMAT);
return false;
}
$format = substr($value, 4) . substr($value, 0, 4);
$format = str_replace(
array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'),
array('10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22',
'23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'),
$format);
$temp = intval(substr($format, 0, 1));
$len = strlen($format);
for ($x = 1; $x < $len; ++$x) {
$temp *= 10;
$temp += intval(substr($format, $x, 1));
$temp %= 97;
}
if ($temp != 1) {
$this->_error(self::CHECKFAILED);
return false;
}
return true;
} | php | public function isValid($value)
{
$value = strtoupper($value);
$this->_setValue($value);
if (empty($this->_locale)) {
$region = substr($value, 0, 2);
} else {
$region = new Zend_Locale($this->_locale);
$region = $region->getRegion();
}
if (!array_key_exists($region, $this->_ibanregex)) {
$this->_setValue($region);
$this->_error(self::NOTSUPPORTED);
return false;
}
if (!preg_match($this->_ibanregex[$region], $value)) {
$this->_error(self::FALSEFORMAT);
return false;
}
$format = substr($value, 4) . substr($value, 0, 4);
$format = str_replace(
array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'),
array('10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22',
'23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'),
$format);
$temp = intval(substr($format, 0, 1));
$len = strlen($format);
for ($x = 1; $x < $len; ++$x) {
$temp *= 10;
$temp += intval(substr($format, $x, 1));
$temp %= 97;
}
if ($temp != 1) {
$this->_error(self::CHECKFAILED);
return false;
}
return true;
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"strtoupper",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"_setValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_locale",
")",
"... | Defined by Zend_Validate_Interface
Returns true if $value is a valid IBAN
@param string $value
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Iban.php#L177-L222 | train | Valida o valor de um format | [
30522,
2270,
3853,
2003,
10175,
3593,
1006,
1002,
3643,
1007,
1063,
1002,
3643,
1027,
2358,
5339,
7140,
18620,
1006,
1002,
3643,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
2275,
10175,
5657,
1006,
1002,
3643,
1007,
1025,
2065,
1006,
4064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/Lock.php | Lock.get | public function get($callback = null)
{
$result = $this->acquire();
if ($result && is_callable($callback)) {
try {
return $callback();
} finally {
$this->release();
}
}
return $result;
} | php | public function get($callback = null)
{
$result = $this->acquire();
if ($result && is_callable($callback)) {
try {
return $callback();
} finally {
$this->release();
}
}
return $result;
} | [
"public",
"function",
"get",
"(",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"acquire",
"(",
")",
";",
"if",
"(",
"$",
"result",
"&&",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"try",
"{",
"return",
"... | Attempt to acquire the lock.
@param callable|null $callback
@return mixed | [
"Attempt",
"to",
"acquire",
"the",
"lock",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Lock.php#L81-L94 | train | Returns the result of the callback | [
30522,
2270,
3853,
2131,
1006,
1002,
2655,
5963,
1027,
19701,
1007,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
9878,
1006,
1007,
1025,
2065,
1006,
1002,
2765,
1004,
1004,
2003,
1035,
2655,
3085,
1006,
1002,
2655,
5963,
1007,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php | ResponseListener.onKernelResponse | public function onKernelResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$response = $event->getResponse();
if (null === $response->getCharset()) {
$response->setCharset($this->charset);
}
$response->prepare($event->getRequest());
} | php | public function onKernelResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$response = $event->getResponse();
if (null === $response->getCharset()) {
$response->setCharset($this->charset);
}
$response->prepare($event->getRequest());
} | [
"public",
"function",
"onKernelResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")"... | Filters the Response. | [
"Filters",
"the",
"Response",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php#L37-L50 | train | Called when kernel response event is dispatched. | [
30522,
2270,
3853,
2006,
5484,
11877,
6072,
26029,
3366,
1006,
11307,
6072,
26029,
19763,
15338,
1002,
2724,
1007,
1063,
2065,
1006,
999,
1002,
2724,
1011,
1028,
2003,
8706,
2890,
15500,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
3433,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SitesManager.php | SitesManager.shouldKeepURLFragmentsFor | private static function shouldKeepURLFragmentsFor($site)
{
if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_YES) {
return true;
} else if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_NO) {
return false;
}
return API::getInstance()->getKeepURLFragmentsGlobal();
} | php | private static function shouldKeepURLFragmentsFor($site)
{
if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_YES) {
return true;
} else if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_NO) {
return false;
}
return API::getInstance()->getKeepURLFragmentsGlobal();
} | [
"private",
"static",
"function",
"shouldKeepURLFragmentsFor",
"(",
"$",
"site",
")",
"{",
"if",
"(",
"$",
"site",
"[",
"'keep_url_fragment'",
"]",
"==",
"self",
"::",
"KEEP_URL_FRAGMENT_YES",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"$",
"s... | Returns whether we should keep URL fragments for a specific site.
@param array $site DB data for the site.
@return bool | [
"Returns",
"whether",
"we",
"should",
"keep",
"URL",
"fragments",
"for",
"a",
"specific",
"site",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SitesManager.php#L198-L207 | train | Returns true if the keep_url_fragment setting is TRUE | [
30522,
2797,
10763,
3853,
2323,
20553,
5311,
10270,
29181,
8163,
29278,
1006,
1002,
2609,
1007,
1063,
2065,
1006,
1002,
2609,
1031,
1005,
2562,
1035,
24471,
2140,
1035,
15778,
1005,
1033,
1027,
1027,
2969,
1024,
1024,
2562,
1035,
24471,
214... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BlankValidator.php | BlankValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Blank) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Blank');
}
if ('' !== $value && null !== $value) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Blank::NOT_BLANK_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Blank) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Blank');
}
if ('' !== $value && null !== $value) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Blank::NOT_BLANK_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Blank",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/BlankValidator.php#L26-L38 | train | Checks if the value of the constraint is not blank | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
8744,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
15327,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/FileStore.php | FileStore.ensureCacheDirectoryExists | protected function ensureCacheDirectoryExists($path)
{
if (! $this->files->exists(dirname($path))) {
$this->files->makeDirectory(dirname($path), 0777, true, true);
}
} | php | protected function ensureCacheDirectoryExists($path)
{
if (! $this->files->exists(dirname($path))) {
$this->files->makeDirectory(dirname($path), 0777, true, true);
}
} | [
"protected",
"function",
"ensureCacheDirectoryExists",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"dirname",
"(",
"$",
"path",
")",
")",
")",
"{",
"$",
"this",
"->",
"files",
"->",
"makeDirectory",
"(",... | Create the file cache directory if necessary.
@param string $path
@return void | [
"Create",
"the",
"file",
"cache",
"directory",
"if",
"necessary",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/FileStore.php#L77-L82 | train | Ensure that the cache directory exists. | [
30522,
5123,
3853,
5676,
3540,
7690,
7442,
16761,
6672,
9048,
12837,
30524,
16101,
18442,
1006,
1002,
4130,
1007,
1010,
5718,
2581,
2581,
1010,
2995,
1010,
2995,
1007,
1025,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TokenParser/TwigTokenParserRender.php | TwigTokenParserRender.parse | public function parse(Token $token)
{
$lineno = $token->getLine();
[$object, $layout, $context] = $this->parseArguments($token);
return new TwigNodeRender($object, $layout, $context, $lineno, $this->getTag());
} | php | public function parse(Token $token)
{
$lineno = $token->getLine();
[$object, $layout, $context] = $this->parseArguments($token);
return new TwigNodeRender($object, $layout, $context, $lineno, $this->getTag());
} | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"lineno",
"=",
"$",
"token",
"->",
"getLine",
"(",
")",
";",
"[",
"$",
"object",
",",
"$",
"layout",
",",
"$",
"context",
"]",
"=",
"$",
"this",
"->",
"parseArguments",
"(",
... | Parses a token and returns a node.
@param Token $token A Twig_Token instance
@return Node A Twig_Node instance | [
"Parses",
"a",
"token",
"and",
"returns",
"a",
"node",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserRender.php#L31-L38 | train | Parse the token and return a TwigNodeRender object | [
30522,
2270,
3853,
11968,
3366,
1006,
19204,
1002,
19204,
1007,
1063,
1002,
17517,
2080,
1027,
1002,
19204,
1011,
1028,
2131,
4179,
1006,
1007,
1025,
1031,
1002,
4874,
1010,
1002,
9621,
1010,
1002,
6123,
1033,
1027,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Migrations/Migrator.php | Migrator.pendingMigrations | protected function pendingMigrations($files, $ran)
{
return Collection::make($files)
->reject(function ($file) use ($ran) {
return in_array($this->getMigrationName($file), $ran);
})->values()->all();
} | php | protected function pendingMigrations($files, $ran)
{
return Collection::make($files)
->reject(function ($file) use ($ran) {
return in_array($this->getMigrationName($file), $ran);
})->values()->all();
} | [
"protected",
"function",
"pendingMigrations",
"(",
"$",
"files",
",",
"$",
"ran",
")",
"{",
"return",
"Collection",
"::",
"make",
"(",
"$",
"files",
")",
"->",
"reject",
"(",
"function",
"(",
"$",
"file",
")",
"use",
"(",
"$",
"ran",
")",
"{",
"retur... | Get the migration files that have not yet run.
@param array $files
@param array $ran
@return array | [
"Get",
"the",
"migration",
"files",
"that",
"have",
"not",
"yet",
"run",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Migrations/Migrator.php#L123-L129 | train | Get all migrations that have been executed | [
30522,
5123,
3853,
14223,
4328,
29397,
2015,
1006,
1002,
6764,
1010,
1002,
2743,
1007,
1063,
2709,
3074,
1024,
1024,
2191,
1006,
1002,
6764,
1007,
1011,
1028,
15454,
1006,
3853,
1006,
1002,
5371,
1007,
2224,
1006,
1002,
2743,
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/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php | StaticPrefixCollection.addRoute | public function addRoute(string $prefix, $route)
{
list($prefix, $staticPrefix) = $this->getCommonPrefix($prefix, $prefix);
for ($i = \count($this->items) - 1; 0 <= $i; --$i) {
$item = $this->items[$i];
list($commonPrefix, $commonStaticPrefix) = $this->getCommonPrefix($prefix, $this->prefixes[$i]);
if ($this->prefix === $commonPrefix) {
// the new route and a previous one have no common prefix, let's see if they are exclusive to each others
if ($this->prefix !== $staticPrefix && $this->prefix !== $this->staticPrefixes[$i]) {
// the new route and the previous one have exclusive static prefixes
continue;
}
if ($this->prefix === $staticPrefix && $this->prefix === $this->staticPrefixes[$i]) {
// the new route and the previous one have no static prefix
break;
}
if ($this->prefixes[$i] !== $this->staticPrefixes[$i] && $this->prefix === $this->staticPrefixes[$i]) {
// the previous route is non-static and has no static prefix
break;
}
if ($prefix !== $staticPrefix && $this->prefix === $staticPrefix) {
// the new route is non-static and has no static prefix
break;
}
continue;
}
if ($item instanceof self && $this->prefixes[$i] === $commonPrefix) {
// the new route is a child of a previous one, let's nest it
$item->addRoute($prefix, $route);
} else {
// the new route and a previous one have a common prefix, let's merge them
$child = new self($commonPrefix);
list($child->prefixes[0], $child->staticPrefixes[0]) = $child->getCommonPrefix($this->prefixes[$i], $this->prefixes[$i]);
list($child->prefixes[1], $child->staticPrefixes[1]) = $child->getCommonPrefix($prefix, $prefix);
$child->items = [$this->items[$i], $route];
$this->staticPrefixes[$i] = $commonStaticPrefix;
$this->prefixes[$i] = $commonPrefix;
$this->items[$i] = $child;
}
return;
}
// No optimised case was found, in this case we simple add the route for possible
// grouping when new routes are added.
$this->staticPrefixes[] = $staticPrefix;
$this->prefixes[] = $prefix;
$this->items[] = $route;
} | php | public function addRoute(string $prefix, $route)
{
list($prefix, $staticPrefix) = $this->getCommonPrefix($prefix, $prefix);
for ($i = \count($this->items) - 1; 0 <= $i; --$i) {
$item = $this->items[$i];
list($commonPrefix, $commonStaticPrefix) = $this->getCommonPrefix($prefix, $this->prefixes[$i]);
if ($this->prefix === $commonPrefix) {
// the new route and a previous one have no common prefix, let's see if they are exclusive to each others
if ($this->prefix !== $staticPrefix && $this->prefix !== $this->staticPrefixes[$i]) {
// the new route and the previous one have exclusive static prefixes
continue;
}
if ($this->prefix === $staticPrefix && $this->prefix === $this->staticPrefixes[$i]) {
// the new route and the previous one have no static prefix
break;
}
if ($this->prefixes[$i] !== $this->staticPrefixes[$i] && $this->prefix === $this->staticPrefixes[$i]) {
// the previous route is non-static and has no static prefix
break;
}
if ($prefix !== $staticPrefix && $this->prefix === $staticPrefix) {
// the new route is non-static and has no static prefix
break;
}
continue;
}
if ($item instanceof self && $this->prefixes[$i] === $commonPrefix) {
// the new route is a child of a previous one, let's nest it
$item->addRoute($prefix, $route);
} else {
// the new route and a previous one have a common prefix, let's merge them
$child = new self($commonPrefix);
list($child->prefixes[0], $child->staticPrefixes[0]) = $child->getCommonPrefix($this->prefixes[$i], $this->prefixes[$i]);
list($child->prefixes[1], $child->staticPrefixes[1]) = $child->getCommonPrefix($prefix, $prefix);
$child->items = [$this->items[$i], $route];
$this->staticPrefixes[$i] = $commonStaticPrefix;
$this->prefixes[$i] = $commonPrefix;
$this->items[$i] = $child;
}
return;
}
// No optimised case was found, in this case we simple add the route for possible
// grouping when new routes are added.
$this->staticPrefixes[] = $staticPrefix;
$this->prefixes[] = $prefix;
$this->items[] = $route;
} | [
"public",
"function",
"addRoute",
"(",
"string",
"$",
"prefix",
",",
"$",
"route",
")",
"{",
"list",
"(",
"$",
"prefix",
",",
"$",
"staticPrefix",
")",
"=",
"$",
"this",
"->",
"getCommonPrefix",
"(",
"$",
"prefix",
",",
"$",
"prefix",
")",
";",
"for"... | Adds a route to a group.
@param array|self $route | [
"Adds",
"a",
"route",
"to",
"a",
"group",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php#L66-L124 | train | Add a route to the menu | [
30522,
2270,
3853,
5587,
22494,
2618,
1006,
5164,
1002,
17576,
1010,
1002,
2799,
1007,
1063,
2862,
1006,
1002,
17576,
1010,
1002,
10763,
28139,
8873,
2595,
1007,
1027,
1002,
2023,
1011,
1028,
2131,
9006,
8202,
28139,
8873,
2595,
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... |
laravel/framework | src/Illuminate/Cache/ArrayStore.php | ArrayStore.increment | public function increment($key, $value = 1)
{
if (! isset($this->storage[$key])) {
$this->forever($key, $value);
return $this->storage[$key]['value'];
}
$this->storage[$key]['value'] = ((int) $this->storage[$key]['value']) + $value;
return $this->storage[$key]['value'];
} | php | public function increment($key, $value = 1)
{
if (! isset($this->storage[$key])) {
$this->forever($key, $value);
return $this->storage[$key]['value'];
}
$this->storage[$key]['value'] = ((int) $this->storage[$key]['value']) + $value;
return $this->storage[$key]['value'];
} | [
"public",
"function",
"increment",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"1",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"forever",
"(",
"$",
"key",
",",
"$... | Increment the value of an item in the cache.
@param string $key
@param mixed $value
@return int | [
"Increment",
"the",
"value",
"of",
"an",
"item",
"in",
"the",
"cache",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/ArrayStore.php#L68-L79 | train | Increments the value of a key in the cache | [
30522,
30524,
1063,
1002,
2023,
1011,
1028,
5091,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
5527,
1031,
1002,
3145,
1033,
1031,
1005,
3643,
1005,
1033,
1025,
1065,
1002,
2023,
1011,
1028,
5527,
1031,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/Kernel.php | Kernel.getArtisan | protected function getArtisan()
{
if (is_null($this->artisan)) {
return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version()))
->resolveCommands($this->commands);
}
return $this->artisan;
} | php | protected function getArtisan()
{
if (is_null($this->artisan)) {
return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version()))
->resolveCommands($this->commands);
}
return $this->artisan;
} | [
"protected",
"function",
"getArtisan",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"artisan",
")",
")",
"{",
"return",
"$",
"this",
"->",
"artisan",
"=",
"(",
"new",
"Artisan",
"(",
"$",
"this",
"->",
"app",
",",
"$",
"this",
"->",... | Get the Artisan application instance.
@return \Illuminate\Console\Application | [
"Get",
"the",
"Artisan",
"application",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/Kernel.php#L328-L336 | train | Get Artisan instance | [
30522,
5123,
3853,
2131,
8445,
29196,
1006,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2023,
1011,
1028,
2396,
29196,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2396,
29196,
1027,
1006,
2047,
2396,
29196,
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... |
dompdf/dompdf | src/Css/Stylesheet.php | Stylesheet._specificity | private function _specificity($selector, $origin = self::ORIG_AUTHOR)
{
// http://www.w3.org/TR/CSS21/cascade.html#specificity
// ignoring the ":" pseudoclass modifiers
// also ignored in _css_selector_to_xpath
$a = ($selector === "!attr") ? 1 : 0;
$b = min(mb_substr_count($selector, "#"), 255);
$c = min(mb_substr_count($selector, ".") +
mb_substr_count($selector, "["), 255);
$d = min(mb_substr_count($selector, " ") +
mb_substr_count($selector, ">") +
mb_substr_count($selector, "+"), 255);
//If a normal element name is at the beginning of the string,
//a leading whitespace might have been removed on whitespace collapsing and removal
//therefore there might be one whitespace less as selected element names
//this can lead to a too small specificity
//see _css_selector_to_xpath
if (!in_array($selector[0], array(" ", ">", ".", "#", "+", ":", "[")) && $selector !== "*") {
$d++;
}
if ($this->_dompdf->getOptions()->getDebugCss()) {
/*DEBUGCSS*/
print "<pre>\n";
/*DEBUGCSS*/
printf("_specificity(): 0x%08x \"%s\"\n", self::$_stylesheet_origins[$origin] + (($a << 24) | ($b << 16) | ($c << 8) | ($d)), $selector);
/*DEBUGCSS*/
print "</pre>";
}
return self::$_stylesheet_origins[$origin] + (($a << 24) | ($b << 16) | ($c << 8) | ($d));
} | php | private function _specificity($selector, $origin = self::ORIG_AUTHOR)
{
// http://www.w3.org/TR/CSS21/cascade.html#specificity
// ignoring the ":" pseudoclass modifiers
// also ignored in _css_selector_to_xpath
$a = ($selector === "!attr") ? 1 : 0;
$b = min(mb_substr_count($selector, "#"), 255);
$c = min(mb_substr_count($selector, ".") +
mb_substr_count($selector, "["), 255);
$d = min(mb_substr_count($selector, " ") +
mb_substr_count($selector, ">") +
mb_substr_count($selector, "+"), 255);
//If a normal element name is at the beginning of the string,
//a leading whitespace might have been removed on whitespace collapsing and removal
//therefore there might be one whitespace less as selected element names
//this can lead to a too small specificity
//see _css_selector_to_xpath
if (!in_array($selector[0], array(" ", ">", ".", "#", "+", ":", "[")) && $selector !== "*") {
$d++;
}
if ($this->_dompdf->getOptions()->getDebugCss()) {
/*DEBUGCSS*/
print "<pre>\n";
/*DEBUGCSS*/
printf("_specificity(): 0x%08x \"%s\"\n", self::$_stylesheet_origins[$origin] + (($a << 24) | ($b << 16) | ($c << 8) | ($d)), $selector);
/*DEBUGCSS*/
print "</pre>";
}
return self::$_stylesheet_origins[$origin] + (($a << 24) | ($b << 16) | ($c << 8) | ($d));
} | [
"private",
"function",
"_specificity",
"(",
"$",
"selector",
",",
"$",
"origin",
"=",
"self",
"::",
"ORIG_AUTHOR",
")",
"{",
"// http://www.w3.org/TR/CSS21/cascade.html#specificity",
"// ignoring the \":\" pseudoclass modifiers",
"// also ignored in _css_selector_to_xpath",
"$",
... | @link http://www.w3.org/TR/CSS21/cascade.html#specificity
@param string $selector
@param int $origin :
- Stylesheet::ORIG_UA: user agent style sheet
- Stylesheet::ORIG_USER: user style sheet
- Stylesheet::ORIG_AUTHOR: author style sheet
@return int | [
"@link",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"CSS21",
"/",
"cascade",
".",
"html#specificity"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Stylesheet.php#L402-L439 | train | Return the specificity of the element | [
30522,
2797,
3853,
1035,
3563,
3012,
1006,
1002,
27000,
1010,
1002,
4761,
1027,
2969,
1024,
1024,
2030,
8004,
1035,
3166,
1007,
1063,
1013,
1013,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
19817,
1013,
20116,
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... |
matomo-org/matomo | libs/Zend/Mail/Protocol/Smtp.php | Zend_Mail_Protocol_Smtp._ehlo | protected function _ehlo($host)
{
// Support for older, less-compliant remote servers. Tries multiple attempts of EHLO or HELO.
try {
$this->_send('EHLO ' . $host);
$this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
} catch (Zend_Mail_Protocol_Exception $e) {
$this->_send('HELO ' . $host);
$this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
} catch (Zend_Mail_Protocol_Exception $e) {
throw $e;
}
} | php | protected function _ehlo($host)
{
// Support for older, less-compliant remote servers. Tries multiple attempts of EHLO or HELO.
try {
$this->_send('EHLO ' . $host);
$this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
} catch (Zend_Mail_Protocol_Exception $e) {
$this->_send('HELO ' . $host);
$this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
} catch (Zend_Mail_Protocol_Exception $e) {
throw $e;
}
} | [
"protected",
"function",
"_ehlo",
"(",
"$",
"host",
")",
"{",
"// Support for older, less-compliant remote servers. Tries multiple attempts of EHLO or HELO.",
"try",
"{",
"$",
"this",
"->",
"_send",
"(",
"'EHLO '",
".",
"$",
"host",
")",
";",
"$",
"this",
"->",
"_ex... | Send EHLO or HELO depending on capabilities of smtp host
@param string $host The client hostname or IP address (default: 127.0.0.1)
@throws Zend_Mail_Protocol_Exception
@return void | [
"Send",
"EHLO",
"or",
"HELO",
"depending",
"on",
"capabilities",
"of",
"smtp",
"host"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Smtp.php#L228-L240 | train | EHLO or HELO | [
30522,
5123,
3853,
1035,
15501,
4135,
1006,
1002,
3677,
1007,
1063,
1013,
1013,
2490,
2005,
3080,
1010,
2625,
1011,
24577,
6556,
14903,
1012,
5363,
3674,
4740,
1997,
15501,
4135,
2030,
2002,
4135,
1012,
3046,
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... |
overtrue/wechat | src/MiniProgram/NearbyPoi/Client.php | Client.add | public function add(string $name, string $credential, string $address, string $proofMaterial = null)
{
return $this->httpPostJson('wxa/addnearbypoi', [
'related_name' => $name,
'related_credential' => $credential,
'related_address' => $address,
'related_proof_material' => $proofMaterial,
]);
} | php | public function add(string $name, string $credential, string $address, string $proofMaterial = null)
{
return $this->httpPostJson('wxa/addnearbypoi', [
'related_name' => $name,
'related_credential' => $credential,
'related_address' => $address,
'related_proof_material' => $proofMaterial,
]);
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"credential",
",",
"string",
"$",
"address",
",",
"string",
"$",
"proofMaterial",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"httpPostJson",
"(",
"'wxa/addnearbypoi'",
",... | Add nearby poi.
@param string $name
@param string $credential
@param string $address
@param string $proofMaterial
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string | [
"Add",
"nearby",
"poi",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/MiniProgram/NearbyPoi/Client.php#L34-L42 | train | Add nearbypoi to the tree | [
30522,
2270,
3853,
5587,
1006,
5164,
1002,
2171,
1010,
5164,
1002,
13675,
14728,
19909,
1010,
5164,
1002,
4769,
1010,
5164,
1002,
6947,
8585,
14482,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
8299,
19894,
22578,
2239,
1006,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php | MappingRule.isPrefix | public function isPrefix($propertyPath)
{
$length = \strlen($propertyPath);
$prefix = substr($this->propertyPath, 0, $length);
$next = isset($this->propertyPath[$length]) ? $this->propertyPath[$length] : null;
return $prefix === $propertyPath && ('[' === $next || '.' === $next);
} | php | public function isPrefix($propertyPath)
{
$length = \strlen($propertyPath);
$prefix = substr($this->propertyPath, 0, $length);
$next = isset($this->propertyPath[$length]) ? $this->propertyPath[$length] : null;
return $prefix === $propertyPath && ('[' === $next || '.' === $next);
} | [
"public",
"function",
"isPrefix",
"(",
"$",
"propertyPath",
")",
"{",
"$",
"length",
"=",
"\\",
"strlen",
"(",
"$",
"propertyPath",
")",
";",
"$",
"prefix",
"=",
"substr",
"(",
"$",
"this",
"->",
"propertyPath",
",",
"0",
",",
"$",
"length",
")",
";"... | Matches a property path against a prefix of the rule path.
@param string $propertyPath The property path to match against the rule
@return bool Whether the property path is a prefix of the rule or not | [
"Matches",
"a",
"property",
"path",
"against",
"a",
"prefix",
"of",
"the",
"rule",
"path",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php#L65-L72 | train | Checks if the property path is a prefix of the current namespace | [
30522,
30524,
1027,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
3200,
15069,
1031,
1002,
3091,
1033,
1007,
1029,
1002,
2023,
1011,
1028,
3200,
15069,
1031,
1002,
3091,
1033,
1024,
19701,
1025,
2709,
1002,
17576,
1027,
1027,
1027,
1002,
3200,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.