repo stringclasses 21 values | path stringlengths 10 100 | func_name stringlengths 6 71 | original_string stringlengths 115 97k | language stringclasses 1 value | code stringlengths 115 97k | code_tokens listlengths 27 7.5k | docstring stringlengths 6 1.88k | docstring_tokens listlengths 1 177 | sha stringclasses 21 values | url stringlengths 100 189 | partition stringclasses 1 value | summary stringlengths 9 340 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
symfony/symfony | src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php | BirthdayType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('years', range(date('Y') - 120, date('Y')));
$resolver->setAllowedTypes('years', 'array');
} | php | public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('years', range(date('Y') - 120, date('Y')));
$resolver->setAllowedTypes('years', 'array');
} | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setDefault",
"(",
"'years'",
",",
"range",
"(",
"date",
"(",
"'Y'",
")",
"-",
"120",
",",
"date",
"(",
"'Y'",
")",
")",
")",
";",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php#L22-L27 | train | Adds the year range to the options resolver | [
30522,
2270,
3853,
9530,
8873,
27390,
8780,
16790,
2015,
1006,
7047,
6072,
4747,
6299,
1002,
10663,
2099,
1007,
1063,
1002,
10663,
2099,
1011,
1028,
2275,
3207,
7011,
11314,
1006,
1005,
2086,
1005,
1010,
2846,
1006,
3058,
1006,
1005,
1061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Serializer.php | Serializer.getNormalizer | private function getNormalizer($data, ?string $format, array $context)
{
if ($this->cachedNormalizers !== $this->normalizers) {
$this->cachedNormalizers = $this->normalizers;
$this->denormalizerCache = $this->normalizerCache = [];
}
$type = \is_object($data) ? \get_class($data) : 'native-'.\gettype($data);
if (!isset($this->normalizerCache[$format][$type])) {
$this->normalizerCache[$format][$type] = [];
foreach ($this->normalizers as $k => $normalizer) {
if (!$normalizer instanceof NormalizerInterface) {
continue;
}
if (!$normalizer instanceof CacheableSupportsMethodInterface || !$normalizer->hasCacheableSupportsMethod()) {
$this->normalizerCache[$format][$type][$k] = false;
} elseif ($normalizer->supportsNormalization($data, $format, $context)) {
$this->normalizerCache[$format][$type][$k] = true;
break;
}
}
}
foreach ($this->normalizerCache[$format][$type] as $k => $cached) {
$normalizer = $this->normalizers[$k];
if ($cached || $normalizer->supportsNormalization($data, $format, $context)) {
return $normalizer;
}
}
} | php | private function getNormalizer($data, ?string $format, array $context)
{
if ($this->cachedNormalizers !== $this->normalizers) {
$this->cachedNormalizers = $this->normalizers;
$this->denormalizerCache = $this->normalizerCache = [];
}
$type = \is_object($data) ? \get_class($data) : 'native-'.\gettype($data);
if (!isset($this->normalizerCache[$format][$type])) {
$this->normalizerCache[$format][$type] = [];
foreach ($this->normalizers as $k => $normalizer) {
if (!$normalizer instanceof NormalizerInterface) {
continue;
}
if (!$normalizer instanceof CacheableSupportsMethodInterface || !$normalizer->hasCacheableSupportsMethod()) {
$this->normalizerCache[$format][$type][$k] = false;
} elseif ($normalizer->supportsNormalization($data, $format, $context)) {
$this->normalizerCache[$format][$type][$k] = true;
break;
}
}
}
foreach ($this->normalizerCache[$format][$type] as $k => $cached) {
$normalizer = $this->normalizers[$k];
if ($cached || $normalizer->supportsNormalization($data, $format, $context)) {
return $normalizer;
}
}
} | [
"private",
"function",
"getNormalizer",
"(",
"$",
"data",
",",
"?",
"string",
"$",
"format",
",",
"array",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cachedNormalizers",
"!==",
"$",
"this",
"->",
"normalizers",
")",
"{",
"$",
"this",
"->"... | Returns a matching normalizer.
@param mixed $data Data to get the serializer for
@param string $format Format name, present to give the option to normalizers to act differently based on formats
@param array $context Options available to the normalizer
@return NormalizerInterface|null | [
"Returns",
"a",
"matching",
"normalizer",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Serializer.php#L222-L253 | train | Get the normalizer that supports the given data | [
30522,
2797,
3853,
2131,
12131,
9067,
17629,
1006,
1002,
2951,
1010,
1029,
5164,
1002,
4289,
1010,
9140,
1002,
6123,
1007,
1063,
2065,
1006,
1002,
2023,
30524,
17629,
2015,
1027,
1002,
2023,
1011,
1028,
3671,
17629,
2015,
1025,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
walkor/Workerman | Worker.php | Worker.forkWorkersForLinux | protected static function forkWorkersForLinux()
{
foreach (static::$_workers as $worker) {
if (static::$_status === static::STATUS_STARTING) {
if (empty($worker->name)) {
$worker->name = $worker->getSocketName();
}
$worker_name_length = strlen($worker->name);
if (static::$_maxWorkerNameLength < $worker_name_length) {
static::$_maxWorkerNameLength = $worker_name_length;
}
}
while (count(static::$_pidMap[$worker->workerId]) < $worker->count) {
static::forkOneWorkerForLinux($worker);
}
}
} | php | protected static function forkWorkersForLinux()
{
foreach (static::$_workers as $worker) {
if (static::$_status === static::STATUS_STARTING) {
if (empty($worker->name)) {
$worker->name = $worker->getSocketName();
}
$worker_name_length = strlen($worker->name);
if (static::$_maxWorkerNameLength < $worker_name_length) {
static::$_maxWorkerNameLength = $worker_name_length;
}
}
while (count(static::$_pidMap[$worker->workerId]) < $worker->count) {
static::forkOneWorkerForLinux($worker);
}
}
} | [
"protected",
"static",
"function",
"forkWorkersForLinux",
"(",
")",
"{",
"foreach",
"(",
"static",
"::",
"$",
"_workers",
"as",
"$",
"worker",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"_status",
"===",
"static",
"::",
"STATUS_STARTING",
")",
"{",
"if",
... | Fork some worker processes.
@return void | [
"Fork",
"some",
"worker",
"processes",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1303-L1321 | train | Forks workers for Linux | [
30522,
5123,
10763,
3853,
9292,
6198,
2545,
29278,
4115,
5602,
1006,
1007,
1063,
18921,
6776,
1006,
10763,
1024,
1024,
1002,
1035,
3667,
2004,
1002,
7309,
1007,
1063,
2065,
1006,
10763,
1024,
1024,
1002,
1035,
3570,
1027,
1027,
1027,
10763,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Globals/IntlGlobals.php | IntlGlobals.setError | public static function setError($code, $message = '')
{
if (!isset(self::$errorCodes[$code])) {
throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
}
self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code];
self::$errorCode = $code;
} | php | public static function setError($code, $message = '')
{
if (!isset(self::$errorCodes[$code])) {
throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
}
self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code];
self::$errorCode = $code;
} | [
"public",
"static",
"function",
"setError",
"(",
"$",
"code",
",",
"$",
"message",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"errorCodes",
"[",
"$",
"code",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcepti... | Sets the current error.
@param int $code One of the error constants in this class
@param string $message The ICU class error message
@throws \InvalidArgumentException If the code is not one of the error constants in this class | [
"Sets",
"the",
"current",
"error",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Globals/IntlGlobals.php#L114-L122 | train | Set error code and message | [
30522,
2270,
10763,
3853,
2275,
2121,
29165,
1006,
1002,
3642,
1010,
1002,
4471,
1027,
1005,
1005,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
2969,
1024,
1024,
1002,
7561,
23237,
1031,
1002,
3642,
1033,
1007,
1007,
1063,
5466,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Controller.php | Controller.recordUserSettings | public function recordUserSettings()
{
$response = new ResponseBuilder(Common::getRequestVar('format'));
try {
$this->checkTokenInUrl();
$defaultReport = Common::getRequestVar('defaultReport');
$defaultDate = Common::getRequestVar('defaultDate');
$language = Common::getRequestVar('language');
$timeFormat = Common::getRequestVar('timeformat');
$userLogin = Piwik::getCurrentUserLogin();
Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
$this->processPasswordChange($userLogin);
LanguagesManager::setLanguageForSession($language);
Request::processRequest('LanguagesManager.setLanguageForUser', [
'login' => $userLogin,
'languageCode' => $language,
]);
Request::processRequest('LanguagesManager.set12HourClockForUser', [
'login' => $userLogin,
'use12HourClock' => $timeFormat,
]);
APIUsersManager::getInstance()->setUserPreference($userLogin,
APIUsersManager::PREFERENCE_DEFAULT_REPORT,
$defaultReport);
APIUsersManager::getInstance()->setUserPreference($userLogin,
APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE,
$defaultDate);
$toReturn = $response->getResponse();
} catch (Exception $e) {
$toReturn = $response->getResponseException($e);
}
return $toReturn;
} | php | public function recordUserSettings()
{
$response = new ResponseBuilder(Common::getRequestVar('format'));
try {
$this->checkTokenInUrl();
$defaultReport = Common::getRequestVar('defaultReport');
$defaultDate = Common::getRequestVar('defaultDate');
$language = Common::getRequestVar('language');
$timeFormat = Common::getRequestVar('timeformat');
$userLogin = Piwik::getCurrentUserLogin();
Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
$this->processPasswordChange($userLogin);
LanguagesManager::setLanguageForSession($language);
Request::processRequest('LanguagesManager.setLanguageForUser', [
'login' => $userLogin,
'languageCode' => $language,
]);
Request::processRequest('LanguagesManager.set12HourClockForUser', [
'login' => $userLogin,
'use12HourClock' => $timeFormat,
]);
APIUsersManager::getInstance()->setUserPreference($userLogin,
APIUsersManager::PREFERENCE_DEFAULT_REPORT,
$defaultReport);
APIUsersManager::getInstance()->setUserPreference($userLogin,
APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE,
$defaultDate);
$toReturn = $response->getResponse();
} catch (Exception $e) {
$toReturn = $response->getResponseException($e);
}
return $toReturn;
} | [
"public",
"function",
"recordUserSettings",
"(",
")",
"{",
"$",
"response",
"=",
"new",
"ResponseBuilder",
"(",
"Common",
"::",
"getRequestVar",
"(",
"'format'",
")",
")",
";",
"try",
"{",
"$",
"this",
"->",
"checkTokenInUrl",
"(",
")",
";",
"$",
"defaultR... | Records settings from the "User Settings" page
@throws Exception | [
"Records",
"settings",
"from",
"the",
"User",
"Settings",
"page"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/Controller.php#L367-L406 | train | This method is used to record the user settings | [
30522,
2270,
3853,
2501,
20330,
21678,
8613,
1006,
1007,
1063,
1002,
3433,
1027,
2047,
3433,
8569,
23891,
2099,
1006,
2691,
1024,
1024,
2131,
2890,
15500,
10755,
1006,
1005,
4289,
1005,
1007,
1007,
1025,
3046,
1063,
1002,
2023,
1011,
30524,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/traits/AssetMaker.php | AssetMaker.getAssetScheme | protected function getAssetScheme($asset)
{
if (starts_with($asset, ['//', 'http://', 'https://'])) {
return $asset;
}
if (substr($asset, 0, 1) == '/') {
$asset = Url::asset($asset);
}
return $asset;
} | php | protected function getAssetScheme($asset)
{
if (starts_with($asset, ['//', 'http://', 'https://'])) {
return $asset;
}
if (substr($asset, 0, 1) == '/') {
$asset = Url::asset($asset);
}
return $asset;
} | [
"protected",
"function",
"getAssetScheme",
"(",
"$",
"asset",
")",
"{",
"if",
"(",
"starts_with",
"(",
"$",
"asset",
",",
"[",
"'//'",
",",
"'http://'",
",",
"'https://'",
"]",
")",
")",
"{",
"return",
"$",
"asset",
";",
"}",
"if",
"(",
"substr",
"("... | Internal helper, get asset scheme
@param string $asset Specifies a path (URL) to the asset.
@return string | [
"Internal",
"helper",
"get",
"asset",
"scheme"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/AssetMaker.php#L290-L301 | train | Get asset scheme | [
30522,
5123,
3853,
2131,
27241,
3215,
5403,
4168,
1006,
1002,
11412,
1007,
1063,
2065,
1006,
4627,
1035,
2007,
1006,
1002,
11412,
1010,
1031,
1005,
1013,
1013,
1005,
1010,
1005,
8299,
1024,
1013,
1013,
1005,
1010,
1005,
16770,
1024,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Manager.php | Manager.deactivatePlugin | public function deactivatePlugin($pluginName)
{
$this->clearCache($pluginName);
// execute deactivate() to let the plugin do cleanups
$this->executePluginDeactivate($pluginName);
$this->unloadPluginFromMemory($pluginName);
$this->removePluginFromConfig($pluginName);
/**
* Event triggered after a plugin has been deactivated.
*
* @param string $pluginName The plugin that has been deactivated.
*/
Piwik::postEvent('PluginManager.pluginDeactivated', array($pluginName));
} | php | public function deactivatePlugin($pluginName)
{
$this->clearCache($pluginName);
// execute deactivate() to let the plugin do cleanups
$this->executePluginDeactivate($pluginName);
$this->unloadPluginFromMemory($pluginName);
$this->removePluginFromConfig($pluginName);
/**
* Event triggered after a plugin has been deactivated.
*
* @param string $pluginName The plugin that has been deactivated.
*/
Piwik::postEvent('PluginManager.pluginDeactivated', array($pluginName));
} | [
"public",
"function",
"deactivatePlugin",
"(",
"$",
"pluginName",
")",
"{",
"$",
"this",
"->",
"clearCache",
"(",
"$",
"pluginName",
")",
";",
"// execute deactivate() to let the plugin do cleanups",
"$",
"this",
"->",
"executePluginDeactivate",
"(",
"$",
"pluginName"... | Deactivate plugin
@param string $pluginName Name of plugin | [
"Deactivate",
"plugin"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L486-L503 | train | Deactivates a plugin | [
30522,
2270,
3853,
26709,
6593,
21466,
24759,
15916,
2378,
1006,
1002,
13354,
23111,
14074,
1007,
1063,
1002,
2023,
1011,
1028,
3154,
3540,
5403,
1006,
1002,
13354,
23111,
14074,
1007,
1025,
1013,
1013,
15389,
26709,
6593,
21466,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/FileUpload.php | FileUpload.checkUploadPostback | protected function checkUploadPostback()
{
if (!($uniqueId = Request::header('X-OCTOBER-FILEUPLOAD')) || $uniqueId != $this->getId()) {
return;
}
try {
if (!Input::hasFile('file_data')) {
throw new ApplicationException('File missing from request');
}
$fileModel = $this->getRelationModel();
$uploadedFile = Input::file('file_data');
$validationRules = ['max:'.$fileModel::getMaxFilesize()];
if ($fileTypes = $this->getAcceptedFileTypes()) {
$validationRules[] = 'extensions:'.$fileTypes;
}
if ($this->mimeTypes) {
$validationRules[] = 'mimes:'.$this->mimeTypes;
}
$validation = Validator::make(
['file_data' => $uploadedFile],
['file_data' => $validationRules]
);
if ($validation->fails()) {
throw new ValidationException($validation);
}
if (!$uploadedFile->isValid()) {
throw new ApplicationException('File is not valid');
}
$fileRelation = $this->getRelationObject();
$file = $fileModel;
$file->data = $uploadedFile;
$file->is_public = $fileRelation->isPublic();
$file->save();
/**
* Attach directly to the parent model if it exists and attachOnUpload has been set to true
* else attach via deferred binding
*/
$parent = $fileRelation->getParent();
if ($this->attachOnUpload && $parent && $parent->exists) {
$fileRelation->add($file);
} else {
$fileRelation->add($file, $this->sessionKey);
}
$file = $this->decorateFileAttributes($file);
$result = [
'id' => $file->id,
'thumb' => $file->thumbUrl,
'path' => $file->pathUrl
];
Response::json($result, 200)->send();
}
catch (Exception $ex) {
Response::json($ex->getMessage(), 400)->send();
}
exit;
} | php | protected function checkUploadPostback()
{
if (!($uniqueId = Request::header('X-OCTOBER-FILEUPLOAD')) || $uniqueId != $this->getId()) {
return;
}
try {
if (!Input::hasFile('file_data')) {
throw new ApplicationException('File missing from request');
}
$fileModel = $this->getRelationModel();
$uploadedFile = Input::file('file_data');
$validationRules = ['max:'.$fileModel::getMaxFilesize()];
if ($fileTypes = $this->getAcceptedFileTypes()) {
$validationRules[] = 'extensions:'.$fileTypes;
}
if ($this->mimeTypes) {
$validationRules[] = 'mimes:'.$this->mimeTypes;
}
$validation = Validator::make(
['file_data' => $uploadedFile],
['file_data' => $validationRules]
);
if ($validation->fails()) {
throw new ValidationException($validation);
}
if (!$uploadedFile->isValid()) {
throw new ApplicationException('File is not valid');
}
$fileRelation = $this->getRelationObject();
$file = $fileModel;
$file->data = $uploadedFile;
$file->is_public = $fileRelation->isPublic();
$file->save();
/**
* Attach directly to the parent model if it exists and attachOnUpload has been set to true
* else attach via deferred binding
*/
$parent = $fileRelation->getParent();
if ($this->attachOnUpload && $parent && $parent->exists) {
$fileRelation->add($file);
} else {
$fileRelation->add($file, $this->sessionKey);
}
$file = $this->decorateFileAttributes($file);
$result = [
'id' => $file->id,
'thumb' => $file->thumbUrl,
'path' => $file->pathUrl
];
Response::json($result, 200)->send();
}
catch (Exception $ex) {
Response::json($ex->getMessage(), 400)->send();
}
exit;
} | [
"protected",
"function",
"checkUploadPostback",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"uniqueId",
"=",
"Request",
"::",
"header",
"(",
"'X-OCTOBER-FILEUPLOAD'",
")",
")",
"||",
"$",
"uniqueId",
"!=",
"$",
"this",
"->",
"getId",
"(",
")",
")",
"{",
"... | Checks the current request to see if it is a postback containing a file upload
for this particular widget. | [
"Checks",
"the",
"current",
"request",
"to",
"see",
"if",
"it",
"is",
"a",
"postback",
"containing",
"a",
"file",
"upload",
"for",
"this",
"particular",
"widget",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L363-L433 | train | Check upload postback | [
30522,
5123,
3853,
4638,
6279,
11066,
19894,
5963,
1006,
1007,
1063,
2065,
1006,
999,
1006,
1002,
4310,
3593,
1027,
5227,
1024,
1024,
20346,
1006,
1005,
1060,
1011,
2255,
1011,
5371,
6279,
11066,
1005,
1007,
1007,
1064,
1064,
1002,
4310,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php | IcuResFileDumper.formatCatalogue | public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = [])
{
$data = $indexes = $resources = '';
foreach ($messages->all($domain) as $source => $target) {
$indexes .= pack('v', \strlen($data) + 28);
$data .= $source."\0";
}
$data .= $this->writePadding($data);
$keyTop = $this->getPosition($data);
foreach ($messages->all($domain) as $source => $target) {
$resources .= pack('V', $this->getPosition($data));
$data .= pack('V', \strlen($target))
.mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8')
.$this->writePadding($data)
;
}
$resOffset = $this->getPosition($data);
$data .= pack('v', \count($messages->all($domain)))
.$indexes
.$this->writePadding($data)
.$resources
;
$bundleTop = $this->getPosition($data);
$root = pack('V7',
$resOffset + (2 << 28), // Resource Offset + Resource Type
6, // Index length
$keyTop, // Index keys top
$bundleTop, // Index resources top
$bundleTop, // Index bundle top
\count($messages->all($domain)), // Index max table length
0 // Index attributes
);
$header = pack('vC2v4C12@32',
32, // Header size
0xDA, 0x27, // Magic number 1 and 2
20, 0, 0, 2, // Rest of the header, ..., Size of a char
0x52, 0x65, 0x73, 0x42, // Data format identifier
1, 2, 0, 0, // Data version
1, 4, 0, 0 // Unicode version
);
return $header.$root.$data;
} | php | public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = [])
{
$data = $indexes = $resources = '';
foreach ($messages->all($domain) as $source => $target) {
$indexes .= pack('v', \strlen($data) + 28);
$data .= $source."\0";
}
$data .= $this->writePadding($data);
$keyTop = $this->getPosition($data);
foreach ($messages->all($domain) as $source => $target) {
$resources .= pack('V', $this->getPosition($data));
$data .= pack('V', \strlen($target))
.mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8')
.$this->writePadding($data)
;
}
$resOffset = $this->getPosition($data);
$data .= pack('v', \count($messages->all($domain)))
.$indexes
.$this->writePadding($data)
.$resources
;
$bundleTop = $this->getPosition($data);
$root = pack('V7',
$resOffset + (2 << 28), // Resource Offset + Resource Type
6, // Index length
$keyTop, // Index keys top
$bundleTop, // Index resources top
$bundleTop, // Index bundle top
\count($messages->all($domain)), // Index max table length
0 // Index attributes
);
$header = pack('vC2v4C12@32',
32, // Header size
0xDA, 0x27, // Magic number 1 and 2
20, 0, 0, 2, // Rest of the header, ..., Size of a char
0x52, 0x65, 0x73, 0x42, // Data format identifier
1, 2, 0, 0, // Data version
1, 4, 0, 0 // Unicode version
);
return $header.$root.$data;
} | [
"public",
"function",
"formatCatalogue",
"(",
"MessageCatalogue",
"$",
"messages",
",",
"$",
"domain",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"$",
"indexes",
"=",
"$",
"resources",
"=",
"''",
";",
"foreach",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php#L31-L83 | train | Format a catalogue | [
30522,
2270,
3853,
4289,
11266,
23067,
9077,
1006,
4471,
11266,
23067,
9077,
1002,
7696,
1010,
1002,
5884,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
2951,
1027,
1002,
5950,
2229,
1027,
1002,
4219,
1027,
1005,
1005,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.blueprints | public function blueprints()
{
$grav = Grav::instance();
/** @var Pages $pages */
$pages = $grav['pages'];
$blueprint = $pages->blueprints($this->blueprintName());
$fields = $blueprint->fields();
$edit_mode = isset($grav['admin']) ? $grav['config']->get('plugins.admin.edit_mode') : null;
// override if you only want 'normal' mode
if (empty($fields) && ($edit_mode === 'auto' || $edit_mode === 'normal')) {
$blueprint = $pages->blueprints('default');
}
// override if you only want 'expert' mode
if (!empty($fields) && $edit_mode === 'expert') {
$blueprint = $pages->blueprints('');
}
return $blueprint;
} | php | public function blueprints()
{
$grav = Grav::instance();
/** @var Pages $pages */
$pages = $grav['pages'];
$blueprint = $pages->blueprints($this->blueprintName());
$fields = $blueprint->fields();
$edit_mode = isset($grav['admin']) ? $grav['config']->get('plugins.admin.edit_mode') : null;
// override if you only want 'normal' mode
if (empty($fields) && ($edit_mode === 'auto' || $edit_mode === 'normal')) {
$blueprint = $pages->blueprints('default');
}
// override if you only want 'expert' mode
if (!empty($fields) && $edit_mode === 'expert') {
$blueprint = $pages->blueprints('');
}
return $blueprint;
} | [
"public",
"function",
"blueprints",
"(",
")",
"{",
"$",
"grav",
"=",
"Grav",
"::",
"instance",
"(",
")",
";",
"/** @var Pages $pages */",
"$",
"pages",
"=",
"$",
"grav",
"[",
"'pages'",
"]",
";",
"$",
"blueprint",
"=",
"$",
"pages",
"->",
"blueprints",
... | Get blueprints for the page.
@return Blueprint | [
"Get",
"blueprints",
"for",
"the",
"page",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1088-L1110 | train | Get blueprints for this page | [
30522,
2270,
3853,
2630,
16550,
2015,
1006,
1007,
1063,
1002,
24665,
11431,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1025,
1013,
1008,
1008,
1030,
13075,
5530,
1002,
5530,
1008,
1013,
1002,
5530,
1027,
1002,
24665,
11431,
1031,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Filter.php | Filter.applyScopeToQuery | public function applyScopeToQuery($scope, $query)
{
if (is_string($scope)) {
$scope = $this->getScope($scope);
}
if (!$scope->value) {
return;
}
switch ($scope->type) {
case 'date':
if ($scope->value instanceof Carbon) {
$value = $scope->value;
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':filtered' => $value->format('Y-m-d'),
':after' => $value->format('Y-m-d H:i:s'),
':before' => $value->copy()->addDay()->addMinutes(-1)->format('Y-m-d H:i:s')
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($value);
}
}
break;
case 'daterange':
if (is_array($scope->value) && count($scope->value) > 1) {
list($after, $before) = array_values($scope->value);
if ($after && $after instanceof Carbon && $before && $before instanceof Carbon) {
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':afterDate' => $after->format('Y-m-d'),
':after' => $after->format('Y-m-d H:i:s'),
':beforeDate' => $before->format('Y-m-d'),
':before' => $before->format('Y-m-d H:i:s')
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($after, $before);
}
}
}
break;
case 'number':
if (is_numeric($scope->value)) {
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':filtered' => $scope->value,
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($scope->value);
}
}
break;
case 'numberrange':
if (is_array($scope->value) && count($scope->value) > 1) {
list($min, $max) = array_values($scope->value);
if ($min && $max) {
/*
* Condition
*
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':min' => $min,
':max' => $max
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($min, $max);
}
}
}
break;
case 'text':
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':value' => Db::getPdo()->quote($scope->value),
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($scope->value);
}
break;
default:
$value = is_array($scope->value) ? array_keys($scope->value) : $scope->value;
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
/*
* Switch scope: multiple conditions, value either 1 or 2
*/
if (is_array($scopeConditions)) {
$conditionNum = is_array($value) ? 0 : $value - 1;
list($scopeConditions) = array_slice($scopeConditions, $conditionNum);
}
if (is_array($value)) {
$filtered = implode(',', array_build($value, function ($key, $_value) {
return [$key, Db::getPdo()->quote($_value)];
}));
}
else {
$filtered = Db::getPdo()->quote($value);
}
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [':filtered' => $filtered])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($value);
}
break;
}
return $query;
} | php | public function applyScopeToQuery($scope, $query)
{
if (is_string($scope)) {
$scope = $this->getScope($scope);
}
if (!$scope->value) {
return;
}
switch ($scope->type) {
case 'date':
if ($scope->value instanceof Carbon) {
$value = $scope->value;
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':filtered' => $value->format('Y-m-d'),
':after' => $value->format('Y-m-d H:i:s'),
':before' => $value->copy()->addDay()->addMinutes(-1)->format('Y-m-d H:i:s')
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($value);
}
}
break;
case 'daterange':
if (is_array($scope->value) && count($scope->value) > 1) {
list($after, $before) = array_values($scope->value);
if ($after && $after instanceof Carbon && $before && $before instanceof Carbon) {
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':afterDate' => $after->format('Y-m-d'),
':after' => $after->format('Y-m-d H:i:s'),
':beforeDate' => $before->format('Y-m-d'),
':before' => $before->format('Y-m-d H:i:s')
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($after, $before);
}
}
}
break;
case 'number':
if (is_numeric($scope->value)) {
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':filtered' => $scope->value,
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($scope->value);
}
}
break;
case 'numberrange':
if (is_array($scope->value) && count($scope->value) > 1) {
list($min, $max) = array_values($scope->value);
if ($min && $max) {
/*
* Condition
*
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':min' => $min,
':max' => $max
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($min, $max);
}
}
}
break;
case 'text':
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [
':value' => Db::getPdo()->quote($scope->value),
])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($scope->value);
}
break;
default:
$value = is_array($scope->value) ? array_keys($scope->value) : $scope->value;
/*
* Condition
*/
if ($scopeConditions = $scope->conditions) {
/*
* Switch scope: multiple conditions, value either 1 or 2
*/
if (is_array($scopeConditions)) {
$conditionNum = is_array($value) ? 0 : $value - 1;
list($scopeConditions) = array_slice($scopeConditions, $conditionNum);
}
if (is_array($value)) {
$filtered = implode(',', array_build($value, function ($key, $_value) {
return [$key, Db::getPdo()->quote($_value)];
}));
}
else {
$filtered = Db::getPdo()->quote($value);
}
$query->whereRaw(DbDongle::parse(strtr($scopeConditions, [':filtered' => $filtered])));
}
/*
* Scope
*/
elseif ($scopeMethod = $scope->scope) {
$query->$scopeMethod($value);
}
break;
}
return $query;
} | [
"public",
"function",
"applyScopeToQuery",
"(",
"$",
"scope",
",",
"$",
"query",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"scope",
")",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getScope",
"(",
"$",
"scope",
")",
";",
"}",
"if",
"(",
"!... | Applies a filter scope constraints to a DB query.
@param string $scope
@param Builder $query
@return Builder | [
"Applies",
"a",
"filter",
"scope",
"constraints",
"to",
"a",
"DB",
"query",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L677-L844 | train | Apply scope to query | [
30522,
2270,
3853,
6611,
26127,
3406,
4226,
2854,
1006,
1002,
9531,
1010,
1002,
23032,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
9531,
1007,
1007,
1063,
1002,
9531,
1027,
1002,
2023,
1011,
1028,
4152,
16186,
1006,
1002,
9531,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ReplacesAttributes.php | ReplacesAttributes.replaceDimensions | protected function replaceDimensions($message, $attribute, $rule, $parameters)
{
$parameters = $this->parseNamedParameters($parameters);
if (is_array($parameters)) {
foreach ($parameters as $key => $value) {
$message = str_replace(':'.$key, $value, $message);
}
}
return $message;
} | php | protected function replaceDimensions($message, $attribute, $rule, $parameters)
{
$parameters = $this->parseNamedParameters($parameters);
if (is_array($parameters)) {
foreach ($parameters as $key => $value) {
$message = str_replace(':'.$key, $value, $message);
}
}
return $message;
} | [
"protected",
"function",
"replaceDimensions",
"(",
"$",
"message",
",",
"$",
"attribute",
",",
"$",
"rule",
",",
"$",
"parameters",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"parseNamedParameters",
"(",
"$",
"parameters",
")",
";",
"if",
"(",
... | Replace all place-holders for the dimensions rule.
@param string $message
@param string $attribute
@param string $rule
@param array $parameters
@return string | [
"Replace",
"all",
"place",
"-",
"holders",
"for",
"the",
"dimensions",
"rule",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php#L460-L471 | train | Replace all occurrences of the dimensions in the message with the values of the parameters | [
30522,
5123,
3853,
2999,
14428,
3619,
8496,
1006,
1002,
4471,
1010,
1002,
17961,
1010,
1002,
3627,
1010,
1002,
11709,
1007,
1063,
1002,
11709,
1027,
1002,
2023,
1011,
1028,
11968,
5054,
14074,
18927,
5400,
22828,
2015,
1006,
1002,
11709,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/RenameColumn.php | RenameColumn.getRenamedDiff | protected static function getRenamedDiff(Grammar $grammar, Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema)
{
return static::setRenamedColumns(
$grammar->getDoctrineTableDiff($blueprint, $schema), $command, $column
);
} | php | protected static function getRenamedDiff(Grammar $grammar, Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema)
{
return static::setRenamedColumns(
$grammar->getDoctrineTableDiff($blueprint, $schema), $command, $column
);
} | [
"protected",
"static",
"function",
"getRenamedDiff",
"(",
"Grammar",
"$",
"grammar",
",",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
",",
"Column",
"$",
"column",
",",
"SchemaManager",
"$",
"schema",
")",
"{",
"return",
"static",
"::",
"se... | Get a new column instance with the new column name.
@param \Illuminate\Database\Schema\Grammars\Grammar $grammar
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@param \Doctrine\DBAL\Schema\Column $column
@param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
@return \Doctrine\DBAL\Schema\TableDiff | [
"Get",
"a",
"new",
"column",
"instance",
"with",
"the",
"new",
"column",
"name",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/RenameColumn.php#L46-L51 | train | Get renamed columns | [
30522,
5123,
10763,
3853,
2131,
7389,
14074,
14141,
13355,
1006,
8035,
1002,
8035,
1010,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1010,
5930,
1002,
5930,
1010,
8040,
28433,
24805,
4590,
1002,
8040,
28433,
1007,
1063,
2709,
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/Encoder/JsonDecode.php | JsonDecode.decode | public function decode($data, $format, array $context = [])
{
$associative = $context[self::ASSOCIATIVE] ?? $this->defaultContext[self::ASSOCIATIVE];
$recursionDepth = $context[self::RECURSION_DEPTH] ?? $this->defaultContext[self::RECURSION_DEPTH];
$options = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new NotEncodableValueException(json_last_error_msg());
}
return $decodedData;
} | php | public function decode($data, $format, array $context = [])
{
$associative = $context[self::ASSOCIATIVE] ?? $this->defaultContext[self::ASSOCIATIVE];
$recursionDepth = $context[self::RECURSION_DEPTH] ?? $this->defaultContext[self::RECURSION_DEPTH];
$options = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new NotEncodableValueException(json_last_error_msg());
}
return $decodedData;
} | [
"public",
"function",
"decode",
"(",
"$",
"data",
",",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"associative",
"=",
"$",
"context",
"[",
"self",
"::",
"ASSOCIATIVE",
"]",
"??",
"$",
"this",
"->",
"defaultContext",
"[... | Decodes data.
@param string $data The encoded JSON string to decode
@param string $format Must be set to JsonEncoder::FORMAT
@param array $context An optional set of options for the JSON decoder; see below
The $context array is a simple key=>value array, with the following supported keys:
json_decode_associative: boolean
If true, returns the object as an associative array.
If false, returns the object as nested stdClass
If not specified, this method will use the default set in JsonDecode::__construct
json_decode_recursion_depth: integer
Specifies the maximum recursion depth
If not specified, this method will use the default set in JsonDecode::__construct
json_decode_options: integer
Specifies additional options as per documentation for json_decode
@return mixed
@throws NotEncodableValueException
@see http://php.net/json_decode json_decode | [
"Decodes",
"data",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/JsonDecode.php#L89-L102 | train | Decodes the JSON data | [
30522,
2270,
3853,
21933,
3207,
1006,
1002,
2951,
1010,
1002,
4289,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
1002,
4632,
10085,
2401,
6024,
1027,
1002,
6123,
1031,
2969,
1024,
1024,
4632,
10085,
2401,
6024,
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... |
octobercms/october | modules/backend/widgets/ReportContainer.php | ReportContainer.makeReportWidget | protected function makeReportWidget($alias, $widgetInfo)
{
$configuration = $widgetInfo['configuration'];
$configuration['alias'] = $alias;
$className = $widgetInfo['class'];
if (!class_exists($className)) {
return;
}
$widget = new $className($this->controller, $configuration);
$widget->bindToController();
return ['widget' => $widget, 'sortOrder' => $widgetInfo['sortOrder']];
} | php | protected function makeReportWidget($alias, $widgetInfo)
{
$configuration = $widgetInfo['configuration'];
$configuration['alias'] = $alias;
$className = $widgetInfo['class'];
if (!class_exists($className)) {
return;
}
$widget = new $className($this->controller, $configuration);
$widget->bindToController();
return ['widget' => $widget, 'sortOrder' => $widgetInfo['sortOrder']];
} | [
"protected",
"function",
"makeReportWidget",
"(",
"$",
"alias",
",",
"$",
"widgetInfo",
")",
"{",
"$",
"configuration",
"=",
"$",
"widgetInfo",
"[",
"'configuration'",
"]",
";",
"$",
"configuration",
"[",
"'alias'",
"]",
"=",
"$",
"alias",
";",
"$",
"class... | Makes a single report widget object, returned array index:
- widget: The widget object (Backend\Classes\ReportWidgetBase)
- sortOrder: The current sort order
@param string $alias
@param array $widgetInfo
@return array | [
"Makes",
"a",
"single",
"report",
"widget",
"object",
"returned",
"array",
"index",
":",
"-",
"widget",
":",
"The",
"widget",
"object",
"(",
"Backend",
"\\",
"Classes",
"\\",
"ReportWidgetBase",
")",
"-",
"sortOrder",
":",
"The",
"current",
"sort",
"order"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/ReportContainer.php#L333-L347 | train | Create a report widget | [
30522,
5123,
3853,
9338,
13699,
11589,
9148,
24291,
1006,
1002,
14593,
1010,
1002,
15536,
24291,
2378,
14876,
1007,
1063,
1002,
9563,
1027,
1002,
15536,
24291,
2378,
14876,
1031,
1005,
9563,
1005,
1033,
1025,
1002,
9563,
1031,
1005,
14593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Pgsql.php | Zend_Db_Adapter_Pdo_Pgsql._connect | protected function _connect()
{
if ($this->_connection) {
return;
}
parent::_connect();
if (!empty($this->_config['charset'])) {
$sql = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_connection->exec($sql);
}
} | php | protected function _connect()
{
if ($this->_connection) {
return;
}
parent::_connect();
if (!empty($this->_config['charset'])) {
$sql = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_connection->exec($sql);
}
} | [
"protected",
"function",
"_connect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_connection",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"_connect",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_config",
"[",
"'charset'",
... | Creates a PDO object and connects to the database.
@return void
@throws Zend_Db_Adapter_Exception | [
"Creates",
"a",
"PDO",
"object",
"and",
"connects",
"to",
"the",
"database",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Pgsql.php#L81-L93 | train | Connect to the database and set the charset | [
30522,
5123,
3853,
1035,
7532,
30524,
1006,
1002,
2023,
1011,
1028,
1035,
4434,
1007,
1063,
2709,
1025,
1065,
6687,
1024,
1024,
1035,
7532,
1006,
1007,
1025,
2065,
1006,
999,
4064,
1006,
1002,
2023,
1011,
1028,
1035,
9530,
8873,
2290,
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... |
matomo-org/matomo | plugins/DBStats/MySQLMetadataProvider.php | MySQLMetadataProvider.getAllTablesStatus | public function getAllTablesStatus($matchingRegex = null)
{
if (is_null($this->tableStatuses)) {
$tablesPiwik = DbHelper::getTablesInstalled();
$this->tableStatuses = array();
foreach ($this->dataAccess->getAllTablesStatus() as $t) {
if (in_array($t['Name'], $tablesPiwik)) {
$this->tableStatuses[$t['Name']] = $t;
}
}
}
if (is_null($matchingRegex)) {
return $this->tableStatuses;
}
$result = array();
foreach ($this->tableStatuses as $status) {
if (preg_match($matchingRegex, $status['Name'])) {
$result[] = $status;
}
}
return $result;
} | php | public function getAllTablesStatus($matchingRegex = null)
{
if (is_null($this->tableStatuses)) {
$tablesPiwik = DbHelper::getTablesInstalled();
$this->tableStatuses = array();
foreach ($this->dataAccess->getAllTablesStatus() as $t) {
if (in_array($t['Name'], $tablesPiwik)) {
$this->tableStatuses[$t['Name']] = $t;
}
}
}
if (is_null($matchingRegex)) {
return $this->tableStatuses;
}
$result = array();
foreach ($this->tableStatuses as $status) {
if (preg_match($matchingRegex, $status['Name'])) {
$result[] = $status;
}
}
return $result;
} | [
"public",
"function",
"getAllTablesStatus",
"(",
"$",
"matchingRegex",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"tableStatuses",
")",
")",
"{",
"$",
"tablesPiwik",
"=",
"DbHelper",
"::",
"getTablesInstalled",
"(",
")",
";",
"$",... | Gets the result of a SHOW TABLE STATUS query for every Piwik table in the DB.
Non-piwik tables are ignored.
@param string $matchingRegex Regex used to filter out tables whose name doesn't
match it.
@return array The table information. See http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html
for specifics. | [
"Gets",
"the",
"result",
"of",
"a",
"SHOW",
"TABLE",
"STATUS",
"query",
"for",
"every",
"Piwik",
"table",
"in",
"the",
"DB",
".",
"Non",
"-",
"piwik",
"tables",
"are",
"ignored",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DBStats/MySQLMetadataProvider.php#L85-L109 | train | Get all tables status | [
30522,
2270,
3853,
2131,
8095,
10880,
4757,
29336,
2271,
1006,
1002,
9844,
2890,
3351,
2595,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2023,
1011,
1028,
7251,
29336,
25581,
1007,
1007,
1063,
1002,
7251,
8197,
9148,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Kernel/Traits/Observable.php | Observable.callHandler | protected function callHandler(callable $handler, $payload)
{
try {
return $handler($payload);
} catch (\Exception $e) {
if (property_exists($this, 'app') && $this->app instanceof ServiceContainer) {
$this->app['logger']->error($e->getCode().': '.$e->getMessage(), [
'code' => $e->getCode(),
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
}
}
} | php | protected function callHandler(callable $handler, $payload)
{
try {
return $handler($payload);
} catch (\Exception $e) {
if (property_exists($this, 'app') && $this->app instanceof ServiceContainer) {
$this->app['logger']->error($e->getCode().': '.$e->getMessage(), [
'code' => $e->getCode(),
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
}
}
} | [
"protected",
"function",
"callHandler",
"(",
"callable",
"$",
"handler",
",",
"$",
"payload",
")",
"{",
"try",
"{",
"return",
"$",
"handler",
"(",
"$",
"payload",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"propert... | @param callable $handler
@param mixed $payload
@return mixed | [
"@param",
"callable",
"$handler",
"@param",
"mixed",
"$payload"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Traits/Observable.php#L180-L194 | train | Call the handler with the payload | [
30522,
5123,
3853,
2655,
11774,
3917,
1006,
2655,
3085,
1002,
28213,
1010,
1002,
18093,
1007,
1063,
3046,
1063,
2709,
1002,
28213,
1006,
1002,
18093,
1007,
1025,
1065,
4608,
1006,
1032,
6453,
1002,
1041,
1007,
1063,
2065,
1006,
3200,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Scheduler/Scheduler.php | Scheduler.getTaskList | public function getTaskList()
{
$tasks = $this->loader->loadTasks();
return array_map(function (Task $task) {
return $task->getName();
}, $tasks);
} | php | public function getTaskList()
{
$tasks = $this->loader->loadTasks();
return array_map(function (Task $task) {
return $task->getName();
}, $tasks);
} | [
"public",
"function",
"getTaskList",
"(",
")",
"{",
"$",
"tasks",
"=",
"$",
"this",
"->",
"loader",
"->",
"loadTasks",
"(",
")",
";",
"return",
"array_map",
"(",
"function",
"(",
"Task",
"$",
"task",
")",
"{",
"return",
"$",
"task",
"->",
"getName",
... | Returns the list of the task names.
@return string[] | [
"Returns",
"the",
"list",
"of",
"the",
"task",
"names",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Scheduler/Scheduler.php#L230-L237 | train | Get the list of all tasks | [
30522,
2270,
3853,
2131,
10230,
2243,
9863,
1006,
1007,
1063,
1002,
8518,
1027,
1002,
2023,
1011,
1028,
7170,
2121,
1011,
1028,
7170,
10230,
5705,
1006,
1007,
1025,
2709,
9140,
1035,
4949,
1006,
3853,
1006,
4708,
1002,
4708,
1007,
1063,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/SessionGuard.php | SessionGuard.updateSession | protected function updateSession($id)
{
$this->session->put($this->getName(), $id);
$this->session->migrate(true);
} | php | protected function updateSession($id)
{
$this->session->put($this->getName(), $id);
$this->session->migrate(true);
} | [
"protected",
"function",
"updateSession",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"put",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
",",
"$",
"id",
")",
";",
"$",
"this",
"->",
"session",
"->",
"migrate",
"(",
"true",
")",
... | Update the session with the given ID.
@param string $id
@return void | [
"Update",
"the",
"session",
"with",
"the",
"given",
"ID",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L432-L437 | train | Update the session with the new id | [
30522,
5123,
3853,
14409,
7971,
3258,
1006,
1002,
8909,
1007,
1063,
1002,
2023,
1011,
1028,
5219,
1011,
1028,
2404,
1006,
1002,
2023,
1011,
1028,
2131,
18442,
1006,
1007,
1010,
1002,
8909,
1007,
1025,
1002,
2023,
1011,
1028,
5219,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Controllers/RoleController.php | RoleController.form | public function form()
{
$permissionModel = config('admin.database.permissions_model');
$roleModel = config('admin.database.roles_model');
$form = new Form(new $roleModel());
$form->display('id', 'ID');
$form->text('slug', trans('admin.slug'))->rules('required');
$form->text('name', trans('admin.name'))->rules('required');
$form->listbox('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));
$form->display('created_at', trans('admin.created_at'));
$form->display('updated_at', trans('admin.updated_at'));
return $form;
} | php | public function form()
{
$permissionModel = config('admin.database.permissions_model');
$roleModel = config('admin.database.roles_model');
$form = new Form(new $roleModel());
$form->display('id', 'ID');
$form->text('slug', trans('admin.slug'))->rules('required');
$form->text('name', trans('admin.name'))->rules('required');
$form->listbox('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));
$form->display('created_at', trans('admin.created_at'));
$form->display('updated_at', trans('admin.updated_at'));
return $form;
} | [
"public",
"function",
"form",
"(",
")",
"{",
"$",
"permissionModel",
"=",
"config",
"(",
"'admin.database.permissions_model'",
")",
";",
"$",
"roleModel",
"=",
"config",
"(",
"'admin.database.roles_model'",
")",
";",
"$",
"form",
"=",
"new",
"Form",
"(",
"new"... | Make a form builder.
@return Form | [
"Make",
"a",
"form",
"builder",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/RoleController.php#L142-L159 | train | Form for the role | [
30522,
2270,
3853,
2433,
1006,
1007,
1063,
1002,
6656,
5302,
9247,
1027,
9530,
8873,
2290,
1006,
1005,
4748,
10020,
1012,
7809,
1012,
6656,
2015,
1035,
2944,
1005,
1007,
1025,
1002,
2535,
5302,
9247,
1027,
9530,
8873,
2290,
1006,
1005,
47... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractNormalizer.php | AbstractNormalizer.createChildContext | protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
{
if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
$parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
} else {
unset($parentContext[self::ATTRIBUTES]);
}
return $parentContext;
} | php | protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
{
if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
$parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
} else {
unset($parentContext[self::ATTRIBUTES]);
}
return $parentContext;
} | [
"protected",
"function",
"createChildContext",
"(",
"array",
"$",
"parentContext",
",",
"$",
"attribute",
"/*, string $format = null */",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parentContext",
"[",
"self",
"::",
"ATTRIBUTES",
"]",
"[",
"$",
"attribute",
"]",
... | @param array $parentContext
@param string $attribute Attribute name
@param string|null $format
@return array
@internal | [
"@param",
"array",
"$parentContext",
"@param",
"string",
"$attribute",
"Attribute",
"name",
"@param",
"string|null",
"$format"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L558-L567 | train | Create child context | [
30522,
5123,
3853,
3443,
19339,
8663,
18209,
1006,
9140,
1002,
6687,
8663,
18209,
1010,
1002,
17961,
1013,
1008,
1010,
5164,
1002,
4289,
1027,
19701,
1008,
1013,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
6687,
8663,
18209,
1031,
2969... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Profiler.php | Zend_Db_Profiler.setFilterElapsedSecs | public function setFilterElapsedSecs($minimumSeconds = null)
{
if (null === $minimumSeconds) {
$this->_filterElapsedSecs = null;
} else {
$this->_filterElapsedSecs = (integer) $minimumSeconds;
}
return $this;
} | php | public function setFilterElapsedSecs($minimumSeconds = null)
{
if (null === $minimumSeconds) {
$this->_filterElapsedSecs = null;
} else {
$this->_filterElapsedSecs = (integer) $minimumSeconds;
}
return $this;
} | [
"public",
"function",
"setFilterElapsedSecs",
"(",
"$",
"minimumSeconds",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"minimumSeconds",
")",
"{",
"$",
"this",
"->",
"_filterElapsedSecs",
"=",
"null",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_... | Sets a minimum number of seconds for saving query profiles. If this
is set, only those queries whose elapsed time is equal or greater than
$minimumSeconds will be saved. To save all queries regardless of
elapsed time, set $minimumSeconds to null.
@param integer $minimumSeconds OPTIONAL
@return Zend_Db_Profiler Provides a fluent interface | [
"Sets",
"a",
"minimum",
"number",
"of",
"seconds",
"for",
"saving",
"query",
"profiles",
".",
"If",
"this",
"is",
"set",
"only",
"those",
"queries",
"whose",
"elapsed",
"time",
"is",
"equal",
"or",
"greater",
"than",
"$minimumSeconds",
"will",
"be",
"saved",... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Profiler.php#L163-L172 | train | Set the minimum number of seconds the filter should be applied to the result | [
30522,
2270,
3853,
2275,
8873,
21928,
10581,
29251,
5104,
8586,
2015,
1006,
1002,
6263,
3366,
8663,
5104,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
6263,
3366,
8663,
5104,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/MorphMany.php | MorphMany.getResults | public function getResults()
{
return ! is_null($this->getParentKey())
? $this->query->get()
: $this->related->newCollection();
} | php | public function getResults()
{
return ! is_null($this->getParentKey())
? $this->query->get()
: $this->related->newCollection();
} | [
"public",
"function",
"getResults",
"(",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getParentKey",
"(",
")",
")",
"?",
"$",
"this",
"->",
"query",
"->",
"get",
"(",
")",
":",
"$",
"this",
"->",
"related",
"->",
"newCollection",
"(",... | Get the results of the relationship.
@return mixed | [
"Get",
"the",
"results",
"of",
"the",
"relationship",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphMany.php#L14-L19 | train | Get the results of the query | [
30522,
2270,
3853,
2131,
6072,
11314,
2015,
1006,
1007,
1063,
2709,
999,
2003,
1035,
19701,
1006,
1002,
2023,
1011,
1028,
2131,
19362,
4765,
14839,
1006,
1007,
1007,
1029,
1002,
2023,
1011,
1028,
23032,
1011,
1028,
2131,
1006,
1007,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Core.php | Zend_Cache_Core._log | protected function _log($message, $priority = 4)
{
if (!$this->_options['logging']) {
return;
}
if (!(isset($this->_options['logger']) || $this->_options['logger'] instanceof Zend_Log)) {
Zend_Cache::throwException('Logging is enabled but logger is not set');
}
$logger = $this->_options['logger'];
$logger->log($message, $priority);
} | php | protected function _log($message, $priority = 4)
{
if (!$this->_options['logging']) {
return;
}
if (!(isset($this->_options['logger']) || $this->_options['logger'] instanceof Zend_Log)) {
Zend_Cache::throwException('Logging is enabled but logger is not set');
}
$logger = $this->_options['logger'];
$logger->log($message, $priority);
} | [
"protected",
"function",
"_log",
"(",
"$",
"message",
",",
"$",
"priority",
"=",
"4",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_options",
"[",
"'logging'",
"]",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"(",
"isset",
"(",
"$",
"this",
... | Log a message at the WARN (4) priority.
@param string $message
@throws Zend_Cache_Exception
@return void | [
"Log",
"a",
"message",
"at",
"the",
"WARN",
"(",
"4",
")",
"priority",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L736-L746 | train | Log message to the logger | [
30522,
5123,
3853,
1035,
8833,
1006,
1002,
4471,
1010,
1002,
9470,
1027,
1018,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
7047,
1031,
1005,
15899,
1005,
1033,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
999,
1006,
26354,
338... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php | TransTokenParser.parse | public function parse(Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$count = null;
$vars = new ArrayExpression([], $lineno);
$domain = null;
$locale = null;
if (!$stream->test(Token::BLOCK_END_TYPE)) {
if ($stream->test('count')) {
// {% trans count 5 %}
$stream->next();
$count = $this->parser->getExpressionParser()->parseExpression();
}
if ($stream->test('with')) {
// {% trans with vars %}
$stream->next();
$vars = $this->parser->getExpressionParser()->parseExpression();
}
if ($stream->test('from')) {
// {% trans from "messages" %}
$stream->next();
$domain = $this->parser->getExpressionParser()->parseExpression();
}
if ($stream->test('into')) {
// {% trans into "fr" %}
$stream->next();
$locale = $this->parser->getExpressionParser()->parseExpression();
} elseif (!$stream->test(Token::BLOCK_END_TYPE)) {
throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
}
}
// {% trans %}message{% endtrans %}
$stream->expect(Token::BLOCK_END_TYPE);
$body = $this->parser->subparse([$this, 'decideTransFork'], true);
if (!$body instanceof TextNode && !$body instanceof AbstractExpression) {
throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext());
}
$stream->expect(Token::BLOCK_END_TYPE);
return new TransNode($body, $domain, $count, $vars, $locale, $lineno, $this->getTag());
} | php | public function parse(Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$count = null;
$vars = new ArrayExpression([], $lineno);
$domain = null;
$locale = null;
if (!$stream->test(Token::BLOCK_END_TYPE)) {
if ($stream->test('count')) {
// {% trans count 5 %}
$stream->next();
$count = $this->parser->getExpressionParser()->parseExpression();
}
if ($stream->test('with')) {
// {% trans with vars %}
$stream->next();
$vars = $this->parser->getExpressionParser()->parseExpression();
}
if ($stream->test('from')) {
// {% trans from "messages" %}
$stream->next();
$domain = $this->parser->getExpressionParser()->parseExpression();
}
if ($stream->test('into')) {
// {% trans into "fr" %}
$stream->next();
$locale = $this->parser->getExpressionParser()->parseExpression();
} elseif (!$stream->test(Token::BLOCK_END_TYPE)) {
throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
}
}
// {% trans %}message{% endtrans %}
$stream->expect(Token::BLOCK_END_TYPE);
$body = $this->parser->subparse([$this, 'decideTransFork'], true);
if (!$body instanceof TextNode && !$body instanceof AbstractExpression) {
throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext());
}
$stream->expect(Token::BLOCK_END_TYPE);
return new TransNode($body, $domain, $count, $vars, $locale, $lineno, $this->getTag());
} | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"lineno",
"=",
"$",
"token",
"->",
"getLine",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
";",
"$",
"count",
"=",
"null",
"... | Parses a token and returns a node.
@return Node
@throws SyntaxError | [
"Parses",
"a",
"token",
"and",
"returns",
"a",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php#L37-L85 | train | Parses the trans tag | [
30522,
2270,
3853,
11968,
3366,
1006,
19204,
1002,
19204,
1007,
1063,
1002,
17517,
2080,
1027,
1002,
19204,
1011,
1028,
2131,
4179,
1006,
1007,
1025,
1002,
5460,
1027,
1002,
2023,
1011,
1028,
11968,
8043,
1011,
1028,
4152,
25379,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Map.php | Map.getColumn | public function getColumn($name)
{
$values = array();
foreach ($this->getDataTables() as $table) {
$moreValues = $table->getColumn($name);
foreach ($moreValues as &$value) {
$values[] = $value;
}
}
return $values;
} | php | public function getColumn($name)
{
$values = array();
foreach ($this->getDataTables() as $table) {
$moreValues = $table->getColumn($name);
foreach ($moreValues as &$value) {
$values[] = $value;
}
}
return $values;
} | [
"public",
"function",
"getColumn",
"(",
"$",
"name",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDataTables",
"(",
")",
"as",
"$",
"table",
")",
"{",
"$",
"moreValues",
"=",
"$",
"table",
"->",
"getC... | Returns the array containing all column values in all contained {@link DataTable}s for the requested column.
@param string $name The column name.
@return array | [
"Returns",
"the",
"array",
"containing",
"all",
"column",
"values",
"in",
"all",
"contained",
"{",
"@link",
"DataTable",
"}",
"s",
"for",
"the",
"requested",
"column",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Map.php#L328-L340 | train | Get all values of a column | [
30522,
2270,
3853,
2131,
25778,
2819,
2078,
1006,
1002,
2171,
1007,
1063,
1002,
5300,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
2850,
29336,
3085,
2015,
1006,
1007,
2004,
1002,
2795,
1007,
1063,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Uri/UriFactory.php | UriFactory.parseUrl | public static function parseUrl($url)
{
if (!\is_string($url)) {
throw new \InvalidArgumentException('URL must be a string');
}
$encodedUrl = preg_replace_callback(
'%[^:/@?&=#]+%u',
function ($matches) { return rawurlencode($matches[0]); },
$url
);
$parts = \is_string($encodedUrl) ? parse_url($encodedUrl) : false;
if ($parts === false) {
throw new \InvalidArgumentException("Malformed URL: {$url}");
}
return $parts;
} | php | public static function parseUrl($url)
{
if (!\is_string($url)) {
throw new \InvalidArgumentException('URL must be a string');
}
$encodedUrl = preg_replace_callback(
'%[^:/@?&=#]+%u',
function ($matches) { return rawurlencode($matches[0]); },
$url
);
$parts = \is_string($encodedUrl) ? parse_url($encodedUrl) : false;
if ($parts === false) {
throw new \InvalidArgumentException("Malformed URL: {$url}");
}
return $parts;
} | [
"public",
"static",
"function",
"parseUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'URL must be a string'",
")",
";",
"}",
"$",
"encodedUrl",
"... | UTF-8 aware parse_url() implementation.
@param string $url
@return array
@throws \InvalidArgumentException | [
"UTF",
"-",
"8",
"aware",
"parse_url",
"()",
"implementation",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Uri/UriFactory.php#L117-L135 | train | Parse URL into array | [
30522,
2270,
10763,
3853,
11968,
3366,
3126,
2140,
1006,
1002,
24471,
2140,
1007,
1063,
2065,
1006,
999,
1032,
2003,
1035,
5164,
1006,
1002,
24471,
2140,
1007,
1007,
1063,
5466,
2047,
1032,
19528,
2906,
22850,
15781,
2595,
24422,
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/FormFactory.php | FormFactory.createForProperty | public function createForProperty($class, $property, $data = null, array $options = [])
{
return $this->createBuilderForProperty($class, $property, $data, $options)->getForm();
} | php | public function createForProperty($class, $property, $data = null, array $options = [])
{
return $this->createBuilderForProperty($class, $property, $data, $options)->getForm();
} | [
"public",
"function",
"createForProperty",
"(",
"$",
"class",
",",
"$",
"property",
",",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createBuilderForProperty",
"(",
"$",
"class",
",",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormFactory.php#L44-L47 | train | Create form for property | [
30522,
2270,
3853,
3443,
29278,
21572,
4842,
3723,
1006,
1002,
2465,
1010,
1002,
3200,
1010,
1002,
2951,
1027,
19701,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3443,
8569,
23891,
12881,
2953,
21572,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.get | public function get($key)
{
if (! isset($this->storage[$key])) {
return;
}
$item = $this->storage[$key];
$expiresAt = $item['expiresAt'] ?? 0;
if ($expiresAt !== 0 && $this->currentTime() > $expiresAt) {
$this->forget($key);
return;
}
return $item['value'];
} | php | public function get($key)
{
if (! isset($this->storage[$key])) {
return;
}
$item = $this->storage[$key];
$expiresAt = $item['expiresAt'] ?? 0;
if ($expiresAt !== 0 && $this->currentTime() > $expiresAt) {
$this->forget($key);
return;
}
return $item['value'];
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"item",
"=",
"$",
"this",
"->",
"storage",
"[",
"$",
"key",
"]",... | Retrieve an item from the cache by key.
@param string|array $key
@return mixed | [
"Retrieve",
"an",
"item",
"from",
"the",
"cache",
"by",
"key",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/ArrayStore.php#L24-L41 | train | Get the value of a key | [
30522,
2270,
3853,
2131,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
5527,
1031,
1002,
3145,
1033,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
8875,
1027,
1002,
2023,
1011,
1028,
5527,
1031,
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/Form/Extension/Core/Type/BaseType.php | BaseType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setDisabled($options['disabled']);
$builder->setAutoInitialize($options['auto_initialize']);
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setDisabled($options['disabled']);
$builder->setAutoInitialize($options['auto_initialize']);
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"setDisabled",
"(",
"$",
"options",
"[",
"'disabled'",
"]",
")",
";",
"$",
"builder",
"->",
"setAutoInitialize",
"("... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php#L33-L37 | train | This method is called by the FormBuilder to build the form. | [
30522,
2270,
3853,
3857,
14192,
1006,
2433,
8569,
23891,
6657,
3334,
12172,
1002,
12508,
1010,
9140,
1002,
7047,
1007,
1063,
1002,
12508,
1011,
1028,
2275,
10521,
3085,
2094,
1006,
1002,
7047,
1031,
1005,
9776,
1005,
1033,
1007,
1025,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Debug/DebugClassLoader.php | DebugClassLoader.loadClass | public function loadClass($class)
{
$e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
try {
if ($this->isFinder && !isset($this->loaded[$class])) {
$this->loaded[$class] = true;
if (!$file = $this->classLoader[0]->findFile($class) ?: false) {
// no-op
} elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
require $file;
return;
} else {
require $file;
}
} else {
($this->classLoader)($class);
$file = false;
}
} finally {
error_reporting($e);
}
$this->checkClass($class, $file);
} | php | public function loadClass($class)
{
$e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
try {
if ($this->isFinder && !isset($this->loaded[$class])) {
$this->loaded[$class] = true;
if (!$file = $this->classLoader[0]->findFile($class) ?: false) {
// no-op
} elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
require $file;
return;
} else {
require $file;
}
} else {
($this->classLoader)($class);
$file = false;
}
} finally {
error_reporting($e);
}
$this->checkClass($class, $file);
} | [
"public",
"function",
"loadClass",
"(",
"$",
"class",
")",
"{",
"$",
"e",
"=",
"error_reporting",
"(",
"error_reporting",
"(",
")",
"|",
"E_PARSE",
"|",
"E_ERROR",
"|",
"E_CORE_ERROR",
"|",
"E_COMPILE_ERROR",
")",
";",
"try",
"{",
"if",
"(",
"$",
"this",... | Loads the given class or interface.
@param string $class The name of the class
@throws \RuntimeException | [
"Loads",
"the",
"given",
"class",
"or",
"interface",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/DebugClassLoader.php#L146-L171 | train | Load a class | [
30522,
2270,
3853,
7170,
26266,
1006,
1002,
2465,
1007,
1063,
1002,
1041,
1027,
7561,
1035,
7316,
1006,
7561,
1035,
7316,
1006,
1007,
1064,
1041,
1035,
11968,
3366,
1064,
1041,
1035,
7561,
1064,
1041,
1035,
4563,
1035,
7561,
1064,
1041,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php | TimeDataCollector.getDuration | public function getDuration()
{
if (!isset($this->data['events']['__section__'])) {
return 0;
}
$lastEvent = $this->data['events']['__section__'];
return $lastEvent->getOrigin() + $lastEvent->getDuration() - $this->getStartTime();
} | php | public function getDuration()
{
if (!isset($this->data['events']['__section__'])) {
return 0;
}
$lastEvent = $this->data['events']['__section__'];
return $lastEvent->getOrigin() + $lastEvent->getDuration() - $this->getStartTime();
} | [
"public",
"function",
"getDuration",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'events'",
"]",
"[",
"'__section__'",
"]",
")",
")",
"{",
"return",
"0",
";",
"}",
"$",
"lastEvent",
"=",
"$",
"this",
"->",
"data",
... | Gets the request elapsed time.
@return float The elapsed time | [
"Gets",
"the",
"request",
"elapsed",
"time",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php#L106-L115 | train | Returns the duration of the last event in seconds | [
30522,
2270,
3853,
2131,
24979,
3370,
1006,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
2951,
1031,
1005,
2824,
1005,
1033,
1031,
1005,
1035,
1035,
2930,
1035,
1035,
1005,
1033,
1007,
1007,
1063,
2709,
1014,
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/Queue/Console/RetryCommand.php | RetryCommand.handle | public function handle()
{
foreach ($this->getJobIds() as $id) {
$job = $this->laravel['queue.failer']->find($id);
if (is_null($job)) {
$this->error("Unable to find failed job with ID [{$id}].");
} else {
$this->retryJob($job);
$this->info("The failed job [{$id}] has been pushed back onto the queue!");
$this->laravel['queue.failer']->forget($id);
}
}
} | php | public function handle()
{
foreach ($this->getJobIds() as $id) {
$job = $this->laravel['queue.failer']->find($id);
if (is_null($job)) {
$this->error("Unable to find failed job with ID [{$id}].");
} else {
$this->retryJob($job);
$this->info("The failed job [{$id}] has been pushed back onto the queue!");
$this->laravel['queue.failer']->forget($id);
}
}
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getJobIds",
"(",
")",
"as",
"$",
"id",
")",
"{",
"$",
"job",
"=",
"$",
"this",
"->",
"laravel",
"[",
"'queue.failer'",
"]",
"->",
"find",
"(",
"$",
"id",
")",
";",... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Console/RetryCommand.php#L29-L44 | train | Handle all failed jobs | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
5558,
17062,
2015,
1006,
1007,
2004,
1002,
8909,
1007,
1063,
1002,
3105,
1027,
1002,
2023,
1011,
1028,
13679,
15985,
1031,
1005,
24240,
1012,
8246,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FontMetrics.php | FontMetrics.getTextWidth | public function getTextWidth($text, $font, $size, $wordSpacing = 0.0, $charSpacing = 0.0)
{
// @todo Make sure this cache is efficient before enabling it
static $cache = array();
if ($text === "") {
return 0;
}
// Don't cache long strings
$useCache = !isset($text[50]); // Faster than strlen
$key = "$font/$size/$wordSpacing/$charSpacing";
if ($useCache && isset($cache[$key][$text])) {
return $cache[$key]["$text"];
}
$width = $this->getCanvas()->get_text_width($text, $font, $size, $wordSpacing, $charSpacing);
if ($useCache) {
$cache[$key][$text] = $width;
}
return $width;
} | php | public function getTextWidth($text, $font, $size, $wordSpacing = 0.0, $charSpacing = 0.0)
{
// @todo Make sure this cache is efficient before enabling it
static $cache = array();
if ($text === "") {
return 0;
}
// Don't cache long strings
$useCache = !isset($text[50]); // Faster than strlen
$key = "$font/$size/$wordSpacing/$charSpacing";
if ($useCache && isset($cache[$key][$text])) {
return $cache[$key]["$text"];
}
$width = $this->getCanvas()->get_text_width($text, $font, $size, $wordSpacing, $charSpacing);
if ($useCache) {
$cache[$key][$text] = $width;
}
return $width;
} | [
"public",
"function",
"getTextWidth",
"(",
"$",
"text",
",",
"$",
"font",
",",
"$",
"size",
",",
"$",
"wordSpacing",
"=",
"0.0",
",",
"$",
"charSpacing",
"=",
"0.0",
")",
"{",
"// @todo Make sure this cache is efficient before enabling it",
"static",
"$",
"cache... | Calculates text size, in points
@param string $text the text to be sized
@param string $font the desired font
@param float $size the desired font size
@param float $wordSpacing
@param float $charSpacing
@internal param float $spacing word spacing, if any
@return float | [
"Calculates",
"text",
"size",
"in",
"points"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FontMetrics.php#L262-L287 | train | Returns the width of a text in the font | [
30522,
2270,
3853,
2131,
18209,
9148,
11927,
2232,
1006,
1002,
3793,
1010,
1002,
15489,
1010,
1002,
2946,
1010,
1002,
2616,
19498,
2075,
1027,
1014,
1012,
1014,
1010,
1002,
25869,
13102,
26217,
1027,
1014,
1012,
1014,
1007,
1063,
1013,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpClient/CurlHttpClient.php | CurlHttpClient.createRedirectResolver | private static function createRedirectResolver(array $options, string $host): \Closure
{
$redirectHeaders = [];
if (0 < $options['max_redirects']) {
$redirectHeaders['host'] = $host;
$redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = array_filter($options['request_headers'], static function ($h) {
return 0 !== stripos($h, 'Host:');
});
if (isset($options['headers']['authorization']) || isset($options['headers']['cookie'])) {
$redirectHeaders['no_auth'] = array_filter($options['request_headers'], static function ($h) {
return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:');
});
}
}
return static function ($ch, string $location) use ($redirectHeaders) {
if ($redirectHeaders && $host = parse_url($location, PHP_URL_HOST)) {
$requestHeaders = $redirectHeaders['host'] === $host ? $redirectHeaders['with_auth'] : $redirectHeaders['no_auth'];
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
}
$url = self::parseUrl(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
return implode('', self::resolveUrl(self::parseUrl($location), $url));
};
} | php | private static function createRedirectResolver(array $options, string $host): \Closure
{
$redirectHeaders = [];
if (0 < $options['max_redirects']) {
$redirectHeaders['host'] = $host;
$redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = array_filter($options['request_headers'], static function ($h) {
return 0 !== stripos($h, 'Host:');
});
if (isset($options['headers']['authorization']) || isset($options['headers']['cookie'])) {
$redirectHeaders['no_auth'] = array_filter($options['request_headers'], static function ($h) {
return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:');
});
}
}
return static function ($ch, string $location) use ($redirectHeaders) {
if ($redirectHeaders && $host = parse_url($location, PHP_URL_HOST)) {
$requestHeaders = $redirectHeaders['host'] === $host ? $redirectHeaders['with_auth'] : $redirectHeaders['no_auth'];
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
}
$url = self::parseUrl(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
return implode('', self::resolveUrl(self::parseUrl($location), $url));
};
} | [
"private",
"static",
"function",
"createRedirectResolver",
"(",
"array",
"$",
"options",
",",
"string",
"$",
"host",
")",
":",
"\\",
"Closure",
"{",
"$",
"redirectHeaders",
"=",
"[",
"]",
";",
"if",
"(",
"0",
"<",
"$",
"options",
"[",
"'max_redirects'",
... | Resolves relative URLs on redirects and deals with authentication headers.
Work around CVE-2018-1000007: Authorization and Cookie headers should not follow redirects - fixed in Curl 7.64 | [
"Resolves",
"relative",
"URLs",
"on",
"redirects",
"and",
"deals",
"with",
"authentication",
"headers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/CurlHttpClient.php#L376-L402 | train | Create redirect resolver | [
30522,
2797,
10763,
3853,
3443,
5596,
7442,
6593,
6072,
4747,
6299,
1006,
9140,
1002,
7047,
1010,
5164,
1002,
3677,
1007,
1024,
1032,
8503,
1063,
1002,
2417,
7442,
6593,
4974,
2545,
1027,
1031,
1033,
1025,
2065,
1006,
1014,
1026,
1002,
70... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Row.php | Row.sumRowMetadata | public function sumRowMetadata($rowToSum, $aggregationOperations = array())
{
if (!empty($rowToSum->metadata)
&& !$this->isSummaryRow()
) {
$aggregatedMetadata = array();
if (is_array($aggregationOperations)) {
// we need to aggregate value before value is overwritten by maybe another row
foreach ($aggregationOperations as $column => $operation) {
$thisMetadata = $this->getMetadata($column);
$sumMetadata = $rowToSum->getMetadata($column);
if ($thisMetadata === false && $sumMetadata === false) {
continue;
}
$aggregatedMetadata[$column] = $this->getColumnValuesMerged($operation, $thisMetadata, $sumMetadata, $this, $rowToSum, $column);
}
}
// We shall update metadata, and keep the metadata with the _most visits or pageviews_, rather than first or last seen
$visits = max($rowToSum->getColumn(Metrics::INDEX_PAGE_NB_HITS) || $rowToSum->getColumn(Metrics::INDEX_NB_VISITS),
// Old format pre-1.2, @see also method doSumVisitsMetrics()
$rowToSum->getColumn('nb_actions') || $rowToSum->getColumn('nb_visits'));
if (($visits && $visits > $this->maxVisitsSummed)
|| empty($this->metadata)
) {
$this->maxVisitsSummed = $visits;
$this->metadata = $rowToSum->metadata;
}
foreach ($aggregatedMetadata as $column => $value) {
// we need to make sure aggregated value is used, and not metadata from $rowToSum
$this->setMetadata($column, $value);
}
}
} | php | public function sumRowMetadata($rowToSum, $aggregationOperations = array())
{
if (!empty($rowToSum->metadata)
&& !$this->isSummaryRow()
) {
$aggregatedMetadata = array();
if (is_array($aggregationOperations)) {
// we need to aggregate value before value is overwritten by maybe another row
foreach ($aggregationOperations as $column => $operation) {
$thisMetadata = $this->getMetadata($column);
$sumMetadata = $rowToSum->getMetadata($column);
if ($thisMetadata === false && $sumMetadata === false) {
continue;
}
$aggregatedMetadata[$column] = $this->getColumnValuesMerged($operation, $thisMetadata, $sumMetadata, $this, $rowToSum, $column);
}
}
// We shall update metadata, and keep the metadata with the _most visits or pageviews_, rather than first or last seen
$visits = max($rowToSum->getColumn(Metrics::INDEX_PAGE_NB_HITS) || $rowToSum->getColumn(Metrics::INDEX_NB_VISITS),
// Old format pre-1.2, @see also method doSumVisitsMetrics()
$rowToSum->getColumn('nb_actions') || $rowToSum->getColumn('nb_visits'));
if (($visits && $visits > $this->maxVisitsSummed)
|| empty($this->metadata)
) {
$this->maxVisitsSummed = $visits;
$this->metadata = $rowToSum->metadata;
}
foreach ($aggregatedMetadata as $column => $value) {
// we need to make sure aggregated value is used, and not metadata from $rowToSum
$this->setMetadata($column, $value);
}
}
} | [
"public",
"function",
"sumRowMetadata",
"(",
"$",
"rowToSum",
",",
"$",
"aggregationOperations",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"rowToSum",
"->",
"metadata",
")",
"&&",
"!",
"$",
"this",
"->",
"isSummaryRow",
"(",
... | Sums the metadata in `$rowToSum` with the metadata in `$this` row.
@param Row $rowToSum
@param array $aggregationOperations | [
"Sums",
"the",
"metadata",
"in",
"$rowToSum",
"with",
"the",
"metadata",
"in",
"$this",
"row",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Row.php#L543-L580 | train | Sums the metadata of the row | [
30522,
2270,
3853,
7680,
10524,
11368,
8447,
2696,
1006,
1002,
5216,
13122,
2819,
1010,
1002,
28041,
25918,
10708,
1027,
9140,
1006,
1007,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
5216,
13122,
2819,
1011,
1028,
27425,
1007,
1004,
1004... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Cellmap.php | Cellmap.get_frame_width | public function get_frame_width(Frame $frame)
{
$key = $frame->get_id();
if (!isset($this->_frames[$key])) {
throw new Exception("Frame not found in cellmap");
}
$cols = $this->_frames[$key]["columns"];
$w = 0;
foreach ($cols as $i) {
$w += $this->_columns[$i]["used-width"];
}
return $w;
} | php | public function get_frame_width(Frame $frame)
{
$key = $frame->get_id();
if (!isset($this->_frames[$key])) {
throw new Exception("Frame not found in cellmap");
}
$cols = $this->_frames[$key]["columns"];
$w = 0;
foreach ($cols as $i) {
$w += $this->_columns[$i]["used-width"];
}
return $w;
} | [
"public",
"function",
"get_frame_width",
"(",
"Frame",
"$",
"frame",
")",
"{",
"$",
"key",
"=",
"$",
"frame",
"->",
"get_id",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_frames",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",... | @param Frame $frame
@return int
@throws Exception | [
"@param",
"Frame",
"$frame"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Cellmap.php#L379-L394 | train | Returns the width of a Frame | [
30522,
2270,
3853,
2131,
30524,
1002,
3145,
1033,
1007,
1007,
1063,
5466,
2047,
6453,
1006,
1000,
4853,
2025,
2179,
1999,
3526,
2863,
2361,
1000,
1007,
1025,
1065,
1002,
8902,
2015,
1027,
1002,
2023,
1011,
1028,
1035,
11048,
1031,
1002,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ChangeColumn.php | ChangeColumn.getTableWithColumnChanges | protected static function getTableWithColumnChanges(Blueprint $blueprint, Table $table)
{
$table = clone $table;
foreach ($blueprint->getChangedColumns() as $fluent) {
$column = static::getDoctrineColumn($table, $fluent);
// Here we will spin through each fluent column definition and map it to the proper
// Doctrine column definitions - which is necessary because Laravel and Doctrine
// use some different terminology for various column attributes on the tables.
foreach ($fluent->getAttributes() as $key => $value) {
if (! is_null($option = static::mapFluentOptionToDoctrine($key))) {
if (method_exists($column, $method = 'set'.ucfirst($option))) {
$column->{$method}(static::mapFluentValueToDoctrine($option, $value));
}
}
}
}
return $table;
} | php | protected static function getTableWithColumnChanges(Blueprint $blueprint, Table $table)
{
$table = clone $table;
foreach ($blueprint->getChangedColumns() as $fluent) {
$column = static::getDoctrineColumn($table, $fluent);
// Here we will spin through each fluent column definition and map it to the proper
// Doctrine column definitions - which is necessary because Laravel and Doctrine
// use some different terminology for various column attributes on the tables.
foreach ($fluent->getAttributes() as $key => $value) {
if (! is_null($option = static::mapFluentOptionToDoctrine($key))) {
if (method_exists($column, $method = 'set'.ucfirst($option))) {
$column->{$method}(static::mapFluentValueToDoctrine($option, $value));
}
}
}
}
return $table;
} | [
"protected",
"static",
"function",
"getTableWithColumnChanges",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Table",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"clone",
"$",
"table",
";",
"foreach",
"(",
"$",
"blueprint",
"->",
"getChangedColumns",
"(",
")",
"a... | Get a copy of the given Doctrine table after making the column changes.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Doctrine\DBAL\Schema\Table $table
@return \Doctrine\DBAL\Schema\Table | [
"Get",
"a",
"copy",
"of",
"the",
"given",
"Doctrine",
"table",
"after",
"making",
"the",
"column",
"changes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php#L71-L91 | train | Get the table with column changes | [
30522,
5123,
10763,
3853,
2131,
10880,
24415,
25778,
2819,
12680,
22043,
2015,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
2795,
1002,
2795,
1007,
1063,
1002,
2795,
1027,
17598,
1002,
2795,
1025,
18921,
6776,
1006,
1002,
2630,
16550,
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... |
laravel/framework | src/Illuminate/Database/Schema/PostgresBuilder.php | PostgresBuilder.dropAllViews | public function dropAllViews()
{
$views = [];
foreach ($this->getAllViews() as $row) {
$row = (array) $row;
$views[] = reset($row);
}
if (empty($views)) {
return;
}
$this->connection->statement(
$this->grammar->compileDropAllViews($views)
);
} | php | public function dropAllViews()
{
$views = [];
foreach ($this->getAllViews() as $row) {
$row = (array) $row;
$views[] = reset($row);
}
if (empty($views)) {
return;
}
$this->connection->statement(
$this->grammar->compileDropAllViews($views)
);
} | [
"public",
"function",
"dropAllViews",
"(",
")",
"{",
"$",
"views",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAllViews",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"row",
"=",
"(",
"array",
")",
"$",
"row",
";",
"$",
"views",
"[... | Drop all views from the database.
@return void | [
"Drop",
"all",
"views",
"from",
"the",
"database",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/PostgresBuilder.php#L59-L76 | train | Drop all views | [
30522,
2270,
3853,
4530,
8095,
8584,
2015,
1006,
1007,
1063,
1002,
5328,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
8095,
8584,
2015,
1006,
1007,
2004,
1002,
5216,
1007,
1063,
1002,
5216,
1027,
1006,
9140,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Twig/Node/TwigNodeRender.php | TwigNodeRender.compile | public function compile(Compiler $compiler)
{
$compiler->addDebugInfo($this);
$compiler->write('$object = ')->subcompile($this->getNode('object'))->raw(';' . PHP_EOL);
$layout = $this->getNode('layout');
if ($layout) {
$compiler->write('$layout = ')->subcompile($layout)->raw(';' . PHP_EOL);
} else {
$compiler->write('$layout = null;' . PHP_EOL);
}
$context = $this->getNode('context');
if ($context) {
$compiler->write('$attributes = ')->subcompile($context)->raw(';' . PHP_EOL);
} else {
$compiler->write('$attributes = null;' . PHP_EOL);
}
$compiler
->write('$html = $object->render($layout, $attributes ?? []);' . PHP_EOL)
->write('$block = $context[\'block\'] ?? null;' . PHP_EOL)
->write('if ($block instanceof \Grav\Framework\ContentBlock\ContentBlock && $html instanceof \Grav\Framework\ContentBlock\ContentBlock) {' . PHP_EOL)
->indent()
->write('$block->addBlock($html);' . PHP_EOL)
->write('echo $html->getToken();' . PHP_EOL)
->outdent()
->write('} else {' . PHP_EOL)
->indent()
->write('echo (string)$html;' . PHP_EOL)
->outdent()
->write('}' . PHP_EOL)
;
} | php | public function compile(Compiler $compiler)
{
$compiler->addDebugInfo($this);
$compiler->write('$object = ')->subcompile($this->getNode('object'))->raw(';' . PHP_EOL);
$layout = $this->getNode('layout');
if ($layout) {
$compiler->write('$layout = ')->subcompile($layout)->raw(';' . PHP_EOL);
} else {
$compiler->write('$layout = null;' . PHP_EOL);
}
$context = $this->getNode('context');
if ($context) {
$compiler->write('$attributes = ')->subcompile($context)->raw(';' . PHP_EOL);
} else {
$compiler->write('$attributes = null;' . PHP_EOL);
}
$compiler
->write('$html = $object->render($layout, $attributes ?? []);' . PHP_EOL)
->write('$block = $context[\'block\'] ?? null;' . PHP_EOL)
->write('if ($block instanceof \Grav\Framework\ContentBlock\ContentBlock && $html instanceof \Grav\Framework\ContentBlock\ContentBlock) {' . PHP_EOL)
->indent()
->write('$block->addBlock($html);' . PHP_EOL)
->write('echo $html->getToken();' . PHP_EOL)
->outdent()
->write('} else {' . PHP_EOL)
->indent()
->write('echo (string)$html;' . PHP_EOL)
->outdent()
->write('}' . PHP_EOL)
;
} | [
"public",
"function",
"compile",
"(",
"Compiler",
"$",
"compiler",
")",
"{",
"$",
"compiler",
"->",
"addDebugInfo",
"(",
"$",
"this",
")",
";",
"$",
"compiler",
"->",
"write",
"(",
"'$object = '",
")",
"->",
"subcompile",
"(",
"$",
"this",
"->",
"getNode... | Compiles the node to PHP.
@param Compiler $compiler A Twig_Compiler instance
@throws \LogicException | [
"Compiles",
"the",
"node",
"to",
"PHP",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/Node/TwigNodeRender.php#L44-L77 | train | Compiles the node into the output buffer | [
30522,
2270,
3853,
4012,
22090,
1006,
21624,
1002,
21624,
1007,
1063,
1002,
21624,
1011,
1028,
5587,
3207,
8569,
11528,
14876,
1006,
1002,
2023,
1007,
1025,
1002,
21624,
1011,
1028,
4339,
1006,
1005,
1002,
4874,
1027,
1005,
1007,
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/Console/Descriptor/MarkdownDescriptor.php | MarkdownDescriptor.describeContainerParameter | protected function describeContainerParameter($parameter, array $options = [])
{
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', \strlen($options['parameter'])), $this->formatParameter($parameter)) : $parameter);
} | php | protected function describeContainerParameter($parameter, array $options = [])
{
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', \strlen($options['parameter'])), $this->formatParameter($parameter)) : $parameter);
} | [
"protected",
"function",
"describeContainerParameter",
"(",
"$",
"parameter",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"write",
"(",
"isset",
"(",
"$",
"options",
"[",
"'parameter'",
"]",
")",
"?",
"sprintf",
"(",
"\"%s\\... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php#L272-L275 | train | Describes container parameter | [
30522,
5123,
3853,
6235,
8663,
18249,
2121,
28689,
22828,
1006,
1002,
16381,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
4339,
1006,
26354,
3388,
1006,
1002,
7047,
1031,
1005,
16381,
1005,
1033,
1007,
1029,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/ScheduledReports/ScheduledReports.php | ScheduledReports.getPeriodToFrequency | public static function getPeriodToFrequency()
{
return array(
Schedule::PERIOD_NEVER => Piwik::translate('General_Never'),
Schedule::PERIOD_DAY => Piwik::translate('General_Daily'),
Schedule::PERIOD_WEEK => Piwik::translate('General_Weekly'),
Schedule::PERIOD_MONTH => Piwik::translate('General_Monthly'),
);
} | php | public static function getPeriodToFrequency()
{
return array(
Schedule::PERIOD_NEVER => Piwik::translate('General_Never'),
Schedule::PERIOD_DAY => Piwik::translate('General_Daily'),
Schedule::PERIOD_WEEK => Piwik::translate('General_Weekly'),
Schedule::PERIOD_MONTH => Piwik::translate('General_Monthly'),
);
} | [
"public",
"static",
"function",
"getPeriodToFrequency",
"(",
")",
"{",
"return",
"array",
"(",
"Schedule",
"::",
"PERIOD_NEVER",
"=>",
"Piwik",
"::",
"translate",
"(",
"'General_Never'",
")",
",",
"Schedule",
"::",
"PERIOD_DAY",
"=>",
"Piwik",
"::",
"translate",... | Used in the Report Listing
@ignore | [
"Used",
"in",
"the",
"Report",
"Listing"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ScheduledReports/ScheduledReports.php#L596-L604 | train | Returns an array of translated frequency periods | [
30522,
2270,
10763,
3853,
2131,
4842,
3695,
11927,
11253,
2890,
4226,
9407,
1006,
1007,
1063,
2709,
9140,
1006,
6134,
1024,
1024,
2558,
1035,
2196,
1027,
1028,
14255,
9148,
2243,
1024,
1024,
17637,
1006,
1005,
2236,
1035,
2196,
1005,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/controllers/Files.php | Files.thumb | public function thumb($code = null, $width = 100, $height = 100, $mode = 'auto', $extension = 'auto')
{
try {
return $this->findFileObject($code)->outputThumb(
$width,
$height,
compact('mode', 'extension'),
true
);
}
catch (Exception $ex) {}
return Response::make(View::make('backend::404'), 404);
} | php | public function thumb($code = null, $width = 100, $height = 100, $mode = 'auto', $extension = 'auto')
{
try {
return $this->findFileObject($code)->outputThumb(
$width,
$height,
compact('mode', 'extension'),
true
);
}
catch (Exception $ex) {}
return Response::make(View::make('backend::404'), 404);
} | [
"public",
"function",
"thumb",
"(",
"$",
"code",
"=",
"null",
",",
"$",
"width",
"=",
"100",
",",
"$",
"height",
"=",
"100",
",",
"$",
"mode",
"=",
"'auto'",
",",
"$",
"extension",
"=",
"'auto'",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",... | Output thumbnail, or fall back on the 404 page | [
"Output",
"thumbnail",
"or",
"fall",
"back",
"on",
"the",
"404",
"page"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L39-L52 | train | Output thumb of file | [
30522,
2270,
3853,
7639,
1006,
1002,
3642,
1027,
19701,
1010,
1002,
9381,
1027,
2531,
1010,
1002,
4578,
1027,
2531,
1010,
1002,
5549,
1027,
1005,
8285,
1005,
1010,
1002,
5331,
1027,
1005,
8285,
1005,
1007,
1063,
3046,
1063,
2709,
1002,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php | ObjectToPopulateTrait.extractObjectToPopulate | protected function extractObjectToPopulate($class, array $context, $key = null)
{
$key = $key ?? AbstractNormalizer::OBJECT_TO_POPULATE;
if (isset($context[$key]) && \is_object($context[$key]) && $context[$key] instanceof $class) {
return $context[$key];
}
return null;
} | php | protected function extractObjectToPopulate($class, array $context, $key = null)
{
$key = $key ?? AbstractNormalizer::OBJECT_TO_POPULATE;
if (isset($context[$key]) && \is_object($context[$key]) && $context[$key] instanceof $class) {
return $context[$key];
}
return null;
} | [
"protected",
"function",
"extractObjectToPopulate",
"(",
"$",
"class",
",",
"array",
"$",
"context",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"key",
"=",
"$",
"key",
"??",
"AbstractNormalizer",
"::",
"OBJECT_TO_POPULATE",
";",
"if",
"(",
"isset",
"(",
... | Extract the `object_to_populate` field from the context if it exists
and is an instance of the provided $class.
@param string $class The class the object should be
@param $context The denormalization context
@param string $key They in which to look for the object to populate.
Keeps backwards compatibility with `AbstractNormalizer`.
@return object|null an object if things check out, null otherwise | [
"Extract",
"the",
"object_to_populate",
"field",
"from",
"the",
"context",
"if",
"it",
"exists",
"and",
"is",
"an",
"instance",
"of",
"the",
"provided",
"$class",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php#L27-L36 | train | Extract object to populate | [
30522,
5123,
3853,
14817,
16429,
20614,
14399,
7361,
9869,
1006,
1002,
2465,
1010,
9140,
1002,
6123,
1010,
1002,
3145,
1027,
19701,
1007,
1063,
1002,
3145,
1027,
1002,
3145,
1029,
1029,
10061,
12131,
9067,
17629,
1024,
1024,
4874,
1035,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.compileCreate | public function compileCreate(Blueprint $blueprint, Fluent $command)
{
return sprintf('%s table %s (%s%s%s)',
$blueprint->temporary ? 'create temporary' : 'create',
$this->wrapTable($blueprint),
implode(', ', $this->getColumns($blueprint)),
(string) $this->addForeignKeys($blueprint),
(string) $this->addPrimaryKeys($blueprint)
);
} | php | public function compileCreate(Blueprint $blueprint, Fluent $command)
{
return sprintf('%s table %s (%s%s%s)',
$blueprint->temporary ? 'create temporary' : 'create',
$this->wrapTable($blueprint),
implode(', ', $this->getColumns($blueprint)),
(string) $this->addForeignKeys($blueprint),
(string) $this->addPrimaryKeys($blueprint)
);
} | [
"public",
"function",
"compileCreate",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"return",
"sprintf",
"(",
"'%s table %s (%s%s%s)'",
",",
"$",
"blueprint",
"->",
"temporary",
"?",
"'create temporary'",
":",
"'create'",
",",
"$"... | Compile a create table command.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@return string | [
"Compile",
"a",
"create",
"table",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php#L56-L65 | train | Compiles create statement | [
30522,
2270,
3853,
4012,
22090,
16748,
3686,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1007,
1063,
2709,
9043,
2546,
1006,
1005,
1003,
1055,
2795,
1003,
1055,
1006,
1003,
1055,
1003,
1055,
1003,
1055,
1007,
1005,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | XmlEncoder.createDomDocument | private function createDomDocument(array $context): \DOMDocument
{
$document = new \DOMDocument();
// Set an attribute on the DOM document specifying, as part of the XML declaration,
$xmlOptions = [
// nicely formats output with indentation and extra space
self::FORMAT_OUTPUT => 'formatOutput',
// the version number of the document
self::VERSION => 'xmlVersion',
// the encoding of the document
self::ENCODING => 'encoding',
// whether the document is standalone
self::STANDALONE => 'xmlStandalone',
];
foreach ($xmlOptions as $xmlOption => $documentProperty) {
if ($contextOption = $context[$xmlOption] ?? $this->defaultContext[$xmlOption] ?? false) {
$document->$documentProperty = $contextOption;
}
}
return $document;
} | php | private function createDomDocument(array $context): \DOMDocument
{
$document = new \DOMDocument();
// Set an attribute on the DOM document specifying, as part of the XML declaration,
$xmlOptions = [
// nicely formats output with indentation and extra space
self::FORMAT_OUTPUT => 'formatOutput',
// the version number of the document
self::VERSION => 'xmlVersion',
// the encoding of the document
self::ENCODING => 'encoding',
// whether the document is standalone
self::STANDALONE => 'xmlStandalone',
];
foreach ($xmlOptions as $xmlOption => $documentProperty) {
if ($contextOption = $context[$xmlOption] ?? $this->defaultContext[$xmlOption] ?? false) {
$document->$documentProperty = $contextOption;
}
}
return $document;
} | [
"private",
"function",
"createDomDocument",
"(",
"array",
"$",
"context",
")",
":",
"\\",
"DOMDocument",
"{",
"$",
"document",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"// Set an attribute on the DOM document specifying, as part of the XML declaration,",
"$",
"xm... | Create a DOM document, taking serializer options into account. | [
"Create",
"a",
"DOM",
"document",
"taking",
"serializer",
"options",
"into",
"account",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L537-L559 | train | Create the DOM document | [
30522,
2797,
3853,
2580,
5358,
3527,
24894,
4765,
1006,
9140,
1002,
6123,
1007,
1024,
1032,
14383,
3527,
24894,
4765,
1063,
1002,
6254,
1027,
2047,
1032,
30524,
1010,
2004,
2112,
1997,
1996,
20950,
8170,
1010,
1002,
20950,
7361,
9285,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Mssql.php | Zend_Db_Adapter_Pdo_Mssql._dsn | protected function _dsn()
{
// baseline of DSN parts
$dsn = $this->_config;
// don't pass the username and password in the DSN
unset($dsn['username']);
unset($dsn['password']);
unset($dsn['options']);
unset($dsn['persistent']);
unset($dsn['driver_options']);
if (isset($dsn['port'])) {
$seperator = ':';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$seperator = ',';
}
$dsn['host'] .= $seperator . $dsn['port'];
unset($dsn['port']);
}
// this driver supports multiple DSN prefixes
// @see http://www.php.net/manual/en/ref.pdo-dblib.connection.php
if (isset($dsn['pdoType'])) {
switch (strtolower($dsn['pdoType'])) {
case 'freetds':
case 'sybase':
$this->_pdoType = 'sybase';
break;
case 'mssql':
$this->_pdoType = 'mssql';
break;
case 'dblib':
default:
$this->_pdoType = 'dblib';
break;
}
unset($dsn['pdoType']);
}
// use all remaining parts in the DSN
foreach ($dsn as $key => $val) {
$dsn[$key] = "$key=$val";
}
$dsn = $this->_pdoType . ':' . implode(';', $dsn);
return $dsn;
} | php | protected function _dsn()
{
// baseline of DSN parts
$dsn = $this->_config;
// don't pass the username and password in the DSN
unset($dsn['username']);
unset($dsn['password']);
unset($dsn['options']);
unset($dsn['persistent']);
unset($dsn['driver_options']);
if (isset($dsn['port'])) {
$seperator = ':';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$seperator = ',';
}
$dsn['host'] .= $seperator . $dsn['port'];
unset($dsn['port']);
}
// this driver supports multiple DSN prefixes
// @see http://www.php.net/manual/en/ref.pdo-dblib.connection.php
if (isset($dsn['pdoType'])) {
switch (strtolower($dsn['pdoType'])) {
case 'freetds':
case 'sybase':
$this->_pdoType = 'sybase';
break;
case 'mssql':
$this->_pdoType = 'mssql';
break;
case 'dblib':
default:
$this->_pdoType = 'dblib';
break;
}
unset($dsn['pdoType']);
}
// use all remaining parts in the DSN
foreach ($dsn as $key => $val) {
$dsn[$key] = "$key=$val";
}
$dsn = $this->_pdoType . ':' . implode(';', $dsn);
return $dsn;
} | [
"protected",
"function",
"_dsn",
"(",
")",
"{",
"// baseline of DSN parts",
"$",
"dsn",
"=",
"$",
"this",
"->",
"_config",
";",
"// don't pass the username and password in the DSN",
"unset",
"(",
"$",
"dsn",
"[",
"'username'",
"]",
")",
";",
"unset",
"(",
"$",
... | Creates a PDO DSN for the adapter from $this->_config settings.
@return string | [
"Creates",
"a",
"PDO",
"DSN",
"for",
"the",
"adapter",
"from",
"$this",
"-",
">",
"_config",
"settings",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Mssql.php#L80-L127 | train | Returns the DSN string | [
30522,
5123,
3853,
1035,
16233,
2078,
1006,
1007,
1063,
1013,
1013,
26163,
1997,
16233,
2078,
3033,
1002,
16233,
2078,
1027,
1002,
2023,
1011,
1028,
1035,
9530,
8873,
2290,
1025,
1013,
1013,
2123,
1005,
1056,
3413,
1996,
5310,
18442,
1998,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php | ContainerDebugCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('show-private')) {
@trigger_error('The "--show-private" option no longer has any effect and is deprecated since Symfony 4.1.', E_USER_DEPRECATED);
}
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
$this->validateInput($input);
$object = $this->getContainerBuilder();
if ($input->getOption('env-vars')) {
$options = ['env-vars' => true];
} elseif ($envVar = $input->getOption('env-var')) {
$options = ['env-vars' => true, 'name' => $envVar];
} elseif ($input->getOption('types')) {
$options = [];
$options['filter'] = [$this, 'filterToServiceTypes'];
} elseif ($input->getOption('parameters')) {
$parameters = [];
foreach ($object->getParameterBag()->all() as $k => $v) {
$parameters[$k] = $object->resolveEnvPlaceholders($v);
}
$object = new ParameterBag($parameters);
$options = [];
} elseif ($parameter = $input->getOption('parameter')) {
$options = ['parameter' => $parameter];
} elseif ($input->getOption('tags')) {
$options = ['group_by' => 'tags'];
} elseif ($tag = $input->getOption('tag')) {
$options = ['tag' => $tag];
} elseif ($name = $input->getArgument('name')) {
$name = $this->findProperServiceName($input, $errorIo, $object, $name, $input->getOption('show-hidden'));
$options = ['id' => $name];
} else {
$options = [];
}
$helper = new DescriptorHelper();
$options['format'] = $input->getOption('format');
$options['show_arguments'] = $input->getOption('show-arguments');
$options['show_hidden'] = $input->getOption('show-hidden');
$options['raw_text'] = $input->getOption('raw');
$options['output'] = $io;
try {
$helper->describe($io, $object, $options);
} catch (ServiceNotFoundException $e) {
if ('' !== $e->getId() && '@' === $e->getId()[0]) {
throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, [substr($e->getId(), 1)]);
}
throw $e;
}
if (!$input->getArgument('name') && !$input->getOption('tag') && !$input->getOption('parameter') && !$input->getOption('env-vars') && !$input->getOption('env-var') && $input->isInteractive()) {
if ($input->getOption('tags')) {
$errorIo->comment('To search for a specific tag, re-run this command with a search term. (e.g. <comment>debug:container --tag=form.type</comment>)');
} elseif ($input->getOption('parameters')) {
$errorIo->comment('To search for a specific parameter, re-run this command with a search term. (e.g. <comment>debug:container --parameter=kernel.debug</comment>)');
} else {
$errorIo->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
}
}
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('show-private')) {
@trigger_error('The "--show-private" option no longer has any effect and is deprecated since Symfony 4.1.', E_USER_DEPRECATED);
}
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
$this->validateInput($input);
$object = $this->getContainerBuilder();
if ($input->getOption('env-vars')) {
$options = ['env-vars' => true];
} elseif ($envVar = $input->getOption('env-var')) {
$options = ['env-vars' => true, 'name' => $envVar];
} elseif ($input->getOption('types')) {
$options = [];
$options['filter'] = [$this, 'filterToServiceTypes'];
} elseif ($input->getOption('parameters')) {
$parameters = [];
foreach ($object->getParameterBag()->all() as $k => $v) {
$parameters[$k] = $object->resolveEnvPlaceholders($v);
}
$object = new ParameterBag($parameters);
$options = [];
} elseif ($parameter = $input->getOption('parameter')) {
$options = ['parameter' => $parameter];
} elseif ($input->getOption('tags')) {
$options = ['group_by' => 'tags'];
} elseif ($tag = $input->getOption('tag')) {
$options = ['tag' => $tag];
} elseif ($name = $input->getArgument('name')) {
$name = $this->findProperServiceName($input, $errorIo, $object, $name, $input->getOption('show-hidden'));
$options = ['id' => $name];
} else {
$options = [];
}
$helper = new DescriptorHelper();
$options['format'] = $input->getOption('format');
$options['show_arguments'] = $input->getOption('show-arguments');
$options['show_hidden'] = $input->getOption('show-hidden');
$options['raw_text'] = $input->getOption('raw');
$options['output'] = $io;
try {
$helper->describe($io, $object, $options);
} catch (ServiceNotFoundException $e) {
if ('' !== $e->getId() && '@' === $e->getId()[0]) {
throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, [substr($e->getId(), 1)]);
}
throw $e;
}
if (!$input->getArgument('name') && !$input->getOption('tag') && !$input->getOption('parameter') && !$input->getOption('env-vars') && !$input->getOption('env-var') && $input->isInteractive()) {
if ($input->getOption('tags')) {
$errorIo->comment('To search for a specific tag, re-run this command with a search term. (e.g. <comment>debug:container --tag=form.type</comment>)');
} elseif ($input->getOption('parameters')) {
$errorIo->comment('To search for a specific parameter, re-run this command with a search term. (e.g. <comment>debug:container --parameter=kernel.debug</comment>)');
} else {
$errorIo->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
}
}
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"if",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'show-private'",
")",
")",
"{",
"@",
"trigger_error",
"(",
"'The \"--show-private\" option... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php#L117-L182 | train | Execute the command. | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
2065,
1006,
1002,
7953,
1011,
1028,
2131,
7361,
3508,
1006,
1005,
2265,
1011,
2797,
1005,
1007,
1007,
1063,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Core.php | Zend_Cache_Core.getFillingPercentage | public function getFillingPercentage()
{
if (!$this->_extendedBackend) {
Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
return $this->_backend->getFillingPercentage();
} | php | public function getFillingPercentage()
{
if (!$this->_extendedBackend) {
Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
return $this->_backend->getFillingPercentage();
} | [
"public",
"function",
"getFillingPercentage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_extendedBackend",
")",
"{",
"Zend_Cache",
"::",
"throwException",
"(",
"self",
"::",
"BACKEND_NOT_IMPLEMENTS_EXTENDED_IF",
")",
";",
"}",
"return",
"$",
"this",
"... | Return the filling percentage of the backend storage
@return int integer between 0 and 100 | [
"Return",
"the",
"filling",
"percentage",
"of",
"the",
"backend",
"storage"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L614-L620 | train | Returns the percentage of the current filling area | [
30522,
2270,
3853,
2131,
8873,
13112,
4842,
13013,
4270,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
3668,
5963,
10497,
1007,
1063,
16729,
2094,
1035,
17053,
1024,
1024,
5466,
10288,
24422,
1006,
2969,
1024,
1024,
2067,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Controller/ControllerTrait.php | ControllerTrait.render | protected function render(string $view, array $parameters = [], Response $response = null): Response
{
if ($this->container->has('templating')) {
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
$content = $this->container->get('templating')->render($view, $parameters);
} elseif ($this->container->has('twig')) {
$content = $this->container->get('twig')->render($view, $parameters);
} else {
throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
}
if (null === $response) {
$response = new Response();
}
$response->setContent($content);
return $response;
} | php | protected function render(string $view, array $parameters = [], Response $response = null): Response
{
if ($this->container->has('templating')) {
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
$content = $this->container->get('templating')->render($view, $parameters);
} elseif ($this->container->has('twig')) {
$content = $this->container->get('twig')->render($view, $parameters);
} else {
throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
}
if (null === $response) {
$response = new Response();
}
$response->setContent($content);
return $response;
} | [
"protected",
"function",
"render",
"(",
"string",
"$",
"view",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"Response",
"$",
"response",
"=",
"null",
")",
":",
"Response",
"{",
"if",
"(",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"'te... | Renders a view.
@final | [
"Renders",
"a",
"view",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php#L226-L245 | train | Render the view with the given parameters and return the response | [
30522,
5123,
3853,
17552,
1006,
5164,
1002,
3193,
1010,
9140,
1002,
11709,
1027,
1031,
1033,
1010,
3433,
1002,
3433,
1027,
19701,
1007,
1024,
3433,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2038,
1006,
1005,
8915,
8737,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Widget.php | Widget.renderTemplate | protected function renderTemplate($template, array $variables = array())
{
if (false === strpos($template, '@') || false === strpos($template, '/')) {
$aPluginName = explode('\\', get_class($this));
$aPluginName = $aPluginName[2];
$template = '@' . $aPluginName . '/' . $template;
}
$view = new View($template);
foreach ($variables as $key => $value) {
$view->$key = $value;
}
return $view->render();
} | php | protected function renderTemplate($template, array $variables = array())
{
if (false === strpos($template, '@') || false === strpos($template, '/')) {
$aPluginName = explode('\\', get_class($this));
$aPluginName = $aPluginName[2];
$template = '@' . $aPluginName . '/' . $template;
}
$view = new View($template);
foreach ($variables as $key => $value) {
$view->$key = $value;
}
return $view->render();
} | [
"protected",
"function",
"renderTemplate",
"(",
"$",
"template",
",",
"array",
"$",
"variables",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"template",
",",
"'@'",
")",
"||",
"false",
"===",
"strpos",
"(",
"$",
"... | Assigns the given variables to the template and renders it.
Example:
public function myControllerAction () {
return $this->renderTemplate('index', array(
'answerToLife' => '42'
));
}
This will render the 'index.twig' file within the plugin templates folder and assign the view variable
`answerToLife` to `42`.
@param string $template The name of the template file. If only a name is given it will automatically use
the template within the plugin folder. For instance 'myTemplate' will result in
'@$pluginName/myTemplate.twig'. Alternatively you can include the full path:
'@anyOtherFolder/otherTemplate'. The trailing '.twig' is not needed.
@param array $variables For instance array('myViewVar' => 'myValue'). In template you can use {{ myViewVar }}
@return string
@api | [
"Assigns",
"the",
"given",
"variables",
"to",
"the",
"template",
"and",
"renders",
"it",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Widget/Widget.php#L60-L75 | train | Render a template | [
30522,
5123,
3853,
17552,
18532,
15725,
1006,
1002,
23561,
1010,
9140,
1002,
10857,
1027,
9140,
1006,
1007,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
2358,
14536,
2891,
1006,
1002,
23561,
1010,
1005,
1030,
1005,
1007,
1064,
1064,
6270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.getDirectory | public function getDirectory()
{
if ($this->directory instanceof \Closure) {
return call_user_func($this->directory, $this->form);
}
return $this->directory ?: $this->defaultDirectory();
} | php | public function getDirectory()
{
if ($this->directory instanceof \Closure) {
return call_user_func($this->directory, $this->form);
}
return $this->directory ?: $this->defaultDirectory();
} | [
"public",
"function",
"getDirectory",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"directory",
"instanceof",
"\\",
"Closure",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"directory",
",",
"$",
"this",
"->",
"form",
")",
";",
"}",
"re... | Get directory for store file.
@return mixed|string | [
"Get",
"directory",
"for",
"store",
"file",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L279-L286 | train | Get directory of the file | [
30522,
2270,
3853,
2131,
4305,
2890,
16761,
2100,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
14176,
6013,
11253,
1032,
8503,
1007,
1063,
2709,
2655,
1035,
5310,
1035,
4569,
2278,
1006,
1002,
2023,
1011,
1028,
14176,
1010,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Util/ServerParams.php | ServerParams.hasPostMaxSizeBeenExceeded | public function hasPostMaxSizeBeenExceeded()
{
$contentLength = $this->getContentLength();
$maxContentLength = $this->getPostMaxSize();
return $maxContentLength && $contentLength > $maxContentLength;
} | php | public function hasPostMaxSizeBeenExceeded()
{
$contentLength = $this->getContentLength();
$maxContentLength = $this->getPostMaxSize();
return $maxContentLength && $contentLength > $maxContentLength;
} | [
"public",
"function",
"hasPostMaxSizeBeenExceeded",
"(",
")",
"{",
"$",
"contentLength",
"=",
"$",
"this",
"->",
"getContentLength",
"(",
")",
";",
"$",
"maxContentLength",
"=",
"$",
"this",
"->",
"getPostMaxSize",
"(",
")",
";",
"return",
"$",
"maxContentLeng... | Returns true if the POST max size has been exceeded in the request.
@return bool | [
"Returns",
"true",
"if",
"the",
"POST",
"max",
"size",
"has",
"been",
"exceeded",
"in",
"the",
"request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Util/ServerParams.php#L33-L39 | train | Has post size exceeded? | [
30522,
2270,
3853,
2038,
19894,
17848,
5332,
4371,
11306,
2638,
2595,
3401,
19082,
1006,
1007,
1063,
1002,
4180,
7770,
13512,
2232,
1027,
1002,
2023,
1011,
1028,
2131,
8663,
6528,
9286,
3070,
2705,
1006,
1007,
1025,
1002,
4098,
8663,
6528,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RouteSignatureParameters.php | RouteSignatureParameters.fromClassMethodString | protected static function fromClassMethodString($uses)
{
[$class, $method] = Str::parseCallback($uses);
if (! method_exists($class, $method) && is_callable($class, $method)) {
return [];
}
return (new ReflectionMethod($class, $method))->getParameters();
} | php | protected static function fromClassMethodString($uses)
{
[$class, $method] = Str::parseCallback($uses);
if (! method_exists($class, $method) && is_callable($class, $method)) {
return [];
}
return (new ReflectionMethod($class, $method))->getParameters();
} | [
"protected",
"static",
"function",
"fromClassMethodString",
"(",
"$",
"uses",
")",
"{",
"[",
"$",
"class",
",",
"$",
"method",
"]",
"=",
"Str",
"::",
"parseCallback",
"(",
"$",
"uses",
")",
";",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"class",
",",
... | Get the parameters for the given class / method by string.
@param string $uses
@return array | [
"Get",
"the",
"parameters",
"for",
"the",
"given",
"class",
"/",
"method",
"by",
"string",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteSignatureParameters.php#L35-L44 | train | Get the parameters from a class method string | [
30522,
5123,
10763,
3853,
2013,
26266,
11368,
6806,
5104,
18886,
3070,
1006,
1002,
3594,
1007,
1063,
1031,
1002,
2465,
1010,
1002,
4118,
1033,
1027,
2358,
2099,
1024,
1024,
11968,
3366,
9289,
20850,
8684,
1006,
1002,
3594,
1007,
1025,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php | EnvPlaceholderParameterBag.resolve | public function resolve()
{
if ($this->resolved) {
return;
}
parent::resolve();
foreach ($this->envPlaceholders as $env => $placeholders) {
if (!$this->has($name = "env($env)")) {
continue;
}
if (is_numeric($default = $this->parameters[$name])) {
if (!\is_string($default)) {
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
}
$this->parameters[$name] = (string) $default;
} elseif (null !== $default && !is_scalar($default)) { // !is_string in 5.0
//throw new RuntimeException(sprintf('The default value of env parameter "%s" must be a string or null, %s given.', $env, \gettype($default)));
throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, \gettype($default)));
} elseif (is_scalar($default) && !\is_string($default)) {
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
}
}
} | php | public function resolve()
{
if ($this->resolved) {
return;
}
parent::resolve();
foreach ($this->envPlaceholders as $env => $placeholders) {
if (!$this->has($name = "env($env)")) {
continue;
}
if (is_numeric($default = $this->parameters[$name])) {
if (!\is_string($default)) {
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
}
$this->parameters[$name] = (string) $default;
} elseif (null !== $default && !is_scalar($default)) { // !is_string in 5.0
//throw new RuntimeException(sprintf('The default value of env parameter "%s" must be a string or null, %s given.', $env, \gettype($default)));
throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, \gettype($default)));
} elseif (is_scalar($default) && !\is_string($default)) {
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
}
}
} | [
"public",
"function",
"resolve",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"resolved",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"resolve",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"envPlaceholders",
"as",
"$",
"env",
"=>",
"$",
"pl... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php#L141-L164 | train | Resolves the parameters and returns the result. | [
30522,
2270,
3853,
10663,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
10395,
1007,
1063,
2709,
1025,
1065,
6687,
1024,
1024,
10663,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
4372,
2615,
24759,
10732,
17794,
2004... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.refreshPlugin | public function refreshPlugin($id)
{
$manager = UpdateManager::instance();
$manager->rollbackPlugin($id);
$manager->updatePlugin($id);
} | php | public function refreshPlugin($id)
{
$manager = UpdateManager::instance();
$manager->rollbackPlugin($id);
$manager->updatePlugin($id);
} | [
"public",
"function",
"refreshPlugin",
"(",
"$",
"id",
")",
"{",
"$",
"manager",
"=",
"UpdateManager",
"::",
"instance",
"(",
")",
";",
"$",
"manager",
"->",
"rollbackPlugin",
"(",
"$",
"id",
")",
";",
"$",
"manager",
"->",
"updatePlugin",
"(",
"$",
"i... | Tears down a plugin's database tables and rebuilds them.
@param string $id Plugin code/namespace
@return void | [
"Tears",
"down",
"a",
"plugin",
"s",
"database",
"tables",
"and",
"rebuilds",
"them",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L783-L788 | train | Refreshes a plugin | [
30522,
2270,
3853,
25416,
21898,
24759,
15916,
2378,
1006,
1002,
8909,
1007,
1063,
1002,
3208,
1027,
10651,
24805,
4590,
1024,
1024,
6013,
1006,
1007,
1025,
1002,
3208,
1011,
1028,
4897,
5963,
24759,
15916,
2378,
1006,
1002,
8909,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Middleware/Authenticate.php | Authenticate.handle | public function handle($request, Closure $next)
{
$redirectTo = admin_base_path(config('admin.auth.redirect_to', 'auth/login'));
if (Auth::guard('admin')->guest() && !$this->shouldPassThrough($request)) {
return redirect()->guest($redirectTo);
}
return $next($request);
} | php | public function handle($request, Closure $next)
{
$redirectTo = admin_base_path(config('admin.auth.redirect_to', 'auth/login'));
if (Auth::guard('admin')->guest() && !$this->shouldPassThrough($request)) {
return redirect()->guest($redirectTo);
}
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"$",
"redirectTo",
"=",
"admin_base_path",
"(",
"config",
"(",
"'admin.auth.redirect_to'",
",",
"'auth/login'",
")",
")",
";",
"if",
"(",
"Auth",
"::",
"guard",
"("... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Middleware/Authenticate.php#L19-L28 | train | Handle the request | [
30522,
2270,
3853,
5047,
1006,
1002,
5227,
1010,
8503,
1002,
2279,
1007,
1063,
1002,
2417,
7442,
6593,
3406,
1027,
4748,
10020,
1035,
2918,
1035,
4130,
1006,
9530,
8873,
2290,
1006,
1005,
4748,
10020,
1012,
8740,
2705,
1012,
2417,
7442,
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/Component/HttpKernel/HttpCache/Store.php | Store.write | public function write(Request $request, Response $response)
{
$key = $this->getCacheKey($request);
$storedEnv = $this->persistRequest($request);
// write the response body to the entity store if this is the original response
if (!$response->headers->has('X-Content-Digest')) {
$digest = $this->generateContentDigest($response);
if (false === $this->save($digest, $response->getContent())) {
throw new \RuntimeException('Unable to store the entity.');
}
$response->headers->set('X-Content-Digest', $digest);
if (!$response->headers->has('Transfer-Encoding')) {
$response->headers->set('Content-Length', \strlen($response->getContent()));
}
}
// read existing cache entries, remove non-varying, and add this one to the list
$entries = [];
$vary = $response->headers->get('vary');
foreach ($this->getMetadata($key) as $entry) {
if (!isset($entry[1]['vary'][0])) {
$entry[1]['vary'] = [''];
}
if ($entry[1]['vary'][0] != $vary || !$this->requestsMatch($vary, $entry[0], $storedEnv)) {
$entries[] = $entry;
}
}
$headers = $this->persistResponse($response);
unset($headers['age']);
array_unshift($entries, [$storedEnv, $headers]);
if (false === $this->save($key, serialize($entries))) {
throw new \RuntimeException('Unable to store the metadata.');
}
return $key;
} | php | public function write(Request $request, Response $response)
{
$key = $this->getCacheKey($request);
$storedEnv = $this->persistRequest($request);
// write the response body to the entity store if this is the original response
if (!$response->headers->has('X-Content-Digest')) {
$digest = $this->generateContentDigest($response);
if (false === $this->save($digest, $response->getContent())) {
throw new \RuntimeException('Unable to store the entity.');
}
$response->headers->set('X-Content-Digest', $digest);
if (!$response->headers->has('Transfer-Encoding')) {
$response->headers->set('Content-Length', \strlen($response->getContent()));
}
}
// read existing cache entries, remove non-varying, and add this one to the list
$entries = [];
$vary = $response->headers->get('vary');
foreach ($this->getMetadata($key) as $entry) {
if (!isset($entry[1]['vary'][0])) {
$entry[1]['vary'] = [''];
}
if ($entry[1]['vary'][0] != $vary || !$this->requestsMatch($vary, $entry[0], $storedEnv)) {
$entries[] = $entry;
}
}
$headers = $this->persistResponse($response);
unset($headers['age']);
array_unshift($entries, [$storedEnv, $headers]);
if (false === $this->save($key, serialize($entries))) {
throw new \RuntimeException('Unable to store the metadata.');
}
return $key;
} | [
"public",
"function",
"write",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCacheKey",
"(",
"$",
"request",
")",
";",
"$",
"storedEnv",
"=",
"$",
"this",
"->",
"persistRequest",
"("... | Writes a cache entry to the store for the given Request and Response.
Existing entries are read and any that match the response are removed. This
method calls write with the new list of cache entries.
@return string The key under which the response is stored
@throws \RuntimeException | [
"Writes",
"a",
"cache",
"entry",
"to",
"the",
"store",
"for",
"the",
"given",
"Request",
"and",
"Response",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L172-L215 | train | Write the cache entry for the request and the response | [
30522,
2270,
3853,
4339,
1006,
5227,
1002,
5227,
1010,
3433,
1002,
3433,
1007,
1063,
1002,
3145,
1027,
1002,
2023,
1011,
1028,
2131,
3540,
5403,
14839,
1006,
1002,
5227,
1007,
1025,
1002,
8250,
2368,
2615,
1027,
1002,
2023,
1011,
1028,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExpressionLanguage/Compiler.php | Compiler.repr | public function repr($value)
{
if (\is_int($value) || \is_float($value)) {
if (false !== $locale = setlocale(LC_NUMERIC, 0)) {
setlocale(LC_NUMERIC, 'C');
}
$this->raw($value);
if (false !== $locale) {
setlocale(LC_NUMERIC, $locale);
}
} elseif (null === $value) {
$this->raw('null');
} elseif (\is_bool($value)) {
$this->raw($value ? 'true' : 'false');
} elseif (\is_array($value)) {
$this->raw('[');
$first = true;
foreach ($value as $key => $value) {
if (!$first) {
$this->raw(', ');
}
$first = false;
$this->repr($key);
$this->raw(' => ');
$this->repr($value);
}
$this->raw(']');
} else {
$this->string($value);
}
return $this;
} | php | public function repr($value)
{
if (\is_int($value) || \is_float($value)) {
if (false !== $locale = setlocale(LC_NUMERIC, 0)) {
setlocale(LC_NUMERIC, 'C');
}
$this->raw($value);
if (false !== $locale) {
setlocale(LC_NUMERIC, $locale);
}
} elseif (null === $value) {
$this->raw('null');
} elseif (\is_bool($value)) {
$this->raw($value ? 'true' : 'false');
} elseif (\is_array($value)) {
$this->raw('[');
$first = true;
foreach ($value as $key => $value) {
if (!$first) {
$this->raw(', ');
}
$first = false;
$this->repr($key);
$this->raw(' => ');
$this->repr($value);
}
$this->raw(']');
} else {
$this->string($value);
}
return $this;
} | [
"public",
"function",
"repr",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"is_int",
"(",
"$",
"value",
")",
"||",
"\\",
"is_float",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"locale",
"=",
"setlocale",
"(",
"LC_NUMERIC",
... | Returns a PHP representation of a given value.
@param mixed $value The value to convert
@return $this | [
"Returns",
"a",
"PHP",
"representation",
"of",
"a",
"given",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/ExpressionLanguage/Compiler.php#L113-L147 | train | Reprueba de un valor | [
30522,
2270,
3853,
16360,
2099,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
1032,
2003,
1035,
20014,
1006,
1002,
3643,
1007,
1064,
1064,
30524,
1010,
1005,
1039,
1005,
1007,
1025,
1065,
1002,
2023,
1011,
1028,
6315,
1006,
1002,
3643,
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/NotBlankValidator.php | NotBlankValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof NotBlank) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\NotBlank');
}
if ($constraint->allowNull && null === $value) {
return;
}
if (\is_string($value) && null !== $constraint->normalizer) {
$value = ($constraint->normalizer)($value);
}
if (false === $value || (empty($value) && '0' != $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(NotBlank::IS_BLANK_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof NotBlank) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\NotBlank');
}
if ($constraint->allowNull && null === $value) {
return;
}
if (\is_string($value) && null !== $constraint->normalizer) {
$value = ($constraint->normalizer)($value);
}
if (false === $value || (empty($value) && '0' != $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(NotBlank::IS_BLANK_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"NotBlank",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php#L27-L47 | train | Checks if the value is not blank | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
2025,
28522,
8950,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
341... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Form/Traits/FormTrait.php | FormTrait.validateUploads | protected function validateUploads(array $files): void
{
foreach ($files as $file) {
if (null === $file) {
continue;
}
if ($file instanceof UploadedFileInterface) {
$this->validateUpload($file);
} else {
$this->validateUploads($file);
}
}
} | php | protected function validateUploads(array $files): void
{
foreach ($files as $file) {
if (null === $file) {
continue;
}
if ($file instanceof UploadedFileInterface) {
$this->validateUpload($file);
} else {
$this->validateUploads($file);
}
}
} | [
"protected",
"function",
"validateUploads",
"(",
"array",
"$",
"files",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"file",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"$",
"file",... | Validate all uploaded files.
@param array $files | [
"Validate",
"all",
"uploaded",
"files",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L516-L528 | train | Validate uploads. | [
30522,
5123,
3853,
9398,
3686,
6279,
11066,
2015,
1006,
9140,
1002,
6764,
1007,
1024,
11675,
1063,
18921,
6776,
1006,
1002,
6764,
2004,
1002,
5371,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
5371,
1007,
1063,
3613,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php | AnnotationClassLoader.supports | public function supports($resource, $type = null)
{
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
} | php | public function supports($resource, $type = null)
{
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
} | [
"public",
"function",
"supports",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"return",
"\\",
"is_string",
"(",
"$",
"resource",
")",
"&&",
"preg_match",
"(",
"'/^(?:\\\\\\\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)+$/'",
",",
"$",
"resourc... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php#L222-L225 | train | Returns true if the resource supports the given type | [
30522,
2270,
3853,
6753,
1006,
1002,
7692,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
2709,
1032,
2003,
1035,
5164,
1006,
1002,
7692,
1007,
1004,
1004,
3653,
2290,
1035,
2674,
1006,
1005,
1013,
1034,
1006,
1029,
1024,
1032,
1032,
1032,
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/DependencyInjection/ContainerBuilder.php | ContainerBuilder.hasExtension | public function hasExtension($name)
{
return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]);
} | php | public function hasExtension($name)
{
return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]);
} | [
"public",
"function",
"hasExtension",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"extensions",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"extensionsByNs",
"[",
"$",
"name",
"]",
")",
";",
"}"
] | Checks if we have an extension.
@param string $name The name of the extension
@return bool If the extension exists | [
"Checks",
"if",
"we",
"have",
"an",
"extension",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L237-L240 | train | Checks if a specific extension exists | [
30522,
2270,
3853,
2038,
10288,
29048,
1006,
1002,
2171,
1007,
1063,
2709,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
14305,
1031,
1002,
2171,
1033,
1007,
1064,
1064,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
14305,
3762,
3619,
1031,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Translation/Dumper/PoFileDumper.php | PoFileDumper.formatCatalogue | public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = [])
{
$output = 'msgid ""'."\n";
$output .= 'msgstr ""'."\n";
$output .= '"Content-Type: text/plain; charset=UTF-8\n"'."\n";
$output .= '"Content-Transfer-Encoding: 8bit\n"'."\n";
$output .= '"Language: '.$messages->getLocale().'\n"'."\n";
$output .= "\n";
$newLine = false;
foreach ($messages->all($domain) as $source => $target) {
if ($newLine) {
$output .= "\n";
} else {
$newLine = true;
}
$metadata = $messages->getMetadata($source, $domain);
if (isset($metadata['comments'])) {
$output .= $this->formatComments($metadata['comments']);
}
if (isset($metadata['flags'])) {
$output .= $this->formatComments(implode(',', (array) $metadata['flags']), ',');
}
if (isset($metadata['sources'])) {
$output .= $this->formatComments(implode(' ', (array) $metadata['sources']), ':');
}
$output .= sprintf('msgid "%s"'."\n", $this->escape($source));
$output .= sprintf('msgstr "%s"'."\n", $this->escape($target));
}
return $output;
} | php | public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = [])
{
$output = 'msgid ""'."\n";
$output .= 'msgstr ""'."\n";
$output .= '"Content-Type: text/plain; charset=UTF-8\n"'."\n";
$output .= '"Content-Transfer-Encoding: 8bit\n"'."\n";
$output .= '"Language: '.$messages->getLocale().'\n"'."\n";
$output .= "\n";
$newLine = false;
foreach ($messages->all($domain) as $source => $target) {
if ($newLine) {
$output .= "\n";
} else {
$newLine = true;
}
$metadata = $messages->getMetadata($source, $domain);
if (isset($metadata['comments'])) {
$output .= $this->formatComments($metadata['comments']);
}
if (isset($metadata['flags'])) {
$output .= $this->formatComments(implode(',', (array) $metadata['flags']), ',');
}
if (isset($metadata['sources'])) {
$output .= $this->formatComments(implode(' ', (array) $metadata['sources']), ':');
}
$output .= sprintf('msgid "%s"'."\n", $this->escape($source));
$output .= sprintf('msgstr "%s"'."\n", $this->escape($target));
}
return $output;
} | [
"public",
"function",
"formatCatalogue",
"(",
"MessageCatalogue",
"$",
"messages",
",",
"$",
"domain",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"output",
"=",
"'msgid \"\"'",
".",
"\"\\n\"",
";",
"$",
"output",
".=",
"'msgstr \"\"'",
"."... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Dumper/PoFileDumper.php#L26-L59 | train | Format a MessageCatalogue | [
30522,
2270,
3853,
4289,
11266,
23067,
9077,
1006,
4471,
11266,
23067,
9077,
1002,
7696,
1010,
1002,
5884,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
6434,
1027,
1005,
5796,
5856,
2094,
1000,
1000,
1005,
1012,
1000,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CmsObject.php | CmsObject.getTwigCacheKey | public function getTwigCacheKey()
{
$key = $this->getFilePath();
if ($event = $this->fireEvent('cmsObject.getTwigCacheKey', compact('key'), true)) {
$key = $event;
}
return $key;
} | php | public function getTwigCacheKey()
{
$key = $this->getFilePath();
if ($event = $this->fireEvent('cmsObject.getTwigCacheKey', compact('key'), true)) {
$key = $event;
}
return $key;
} | [
"public",
"function",
"getTwigCacheKey",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
")",
";",
"if",
"(",
"$",
"event",
"=",
"$",
"this",
"->",
"fireEvent",
"(",
"'cmsObject.getTwigCacheKey'",
",",
"compact",
"(",
"'key'",
")",... | Returns the key used by the Twig cache.
@return string | [
"Returns",
"the",
"key",
"used",
"by",
"the",
"Twig",
"cache",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsObject.php#L288-L297 | train | Returns the Twig cache key. | [
30522,
2270,
3853,
2131,
2102,
16279,
3540,
5403,
14839,
1006,
1007,
1063,
1002,
3145,
1027,
1002,
2023,
1011,
1028,
2131,
8873,
2571,
15069,
1006,
1007,
1025,
2065,
1006,
1002,
2724,
1027,
1002,
2023,
1011,
1028,
2543,
18697,
3372,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/FrameReflower/Inline.php | Inline.calculate_auto_width | public function calculate_auto_width()
{
$width = 0;
foreach ($this->_frame->get_children() as $child) {
if ($child->get_original_style()->width == 'auto') {
$width += $child->calculate_auto_width();
} else {
$width += $child->get_margin_width();
}
}
$this->_frame->get_style()->width = $width;
return $this->_frame->get_margin_width();
} | php | public function calculate_auto_width()
{
$width = 0;
foreach ($this->_frame->get_children() as $child) {
if ($child->get_original_style()->width == 'auto') {
$width += $child->calculate_auto_width();
} else {
$width += $child->get_margin_width();
}
}
$this->_frame->get_style()->width = $width;
return $this->_frame->get_margin_width();
} | [
"public",
"function",
"calculate_auto_width",
"(",
")",
"{",
"$",
"width",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"_frame",
"->",
"get_children",
"(",
")",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"->",
"get_original_style",
"(... | Determine current frame width based on contents
@return float | [
"Determine",
"current",
"frame",
"width",
"based",
"on",
"contents"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameReflower/Inline.php#L87-L102 | train | Calculates the auto width of the frame | [
30522,
2270,
3853,
18422,
1035,
8285,
1035,
9381,
1006,
1007,
1063,
1002,
9381,
1027,
1014,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
1035,
4853,
1011,
1028,
2131,
1035,
2336,
1006,
1007,
2004,
1002,
2775,
1007,
1063,
2065,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Loader.php | HTML_QuickForm2_Loader.fileExists | public static function fileExists($fileName)
{
$fp = @fopen($fileName, 'r', true);
if (is_resource($fp)) {
fclose($fp);
return true;
}
return false;
} | php | public static function fileExists($fileName)
{
$fp = @fopen($fileName, 'r', true);
if (is_resource($fp)) {
fclose($fp);
return true;
}
return false;
} | [
"public",
"static",
"function",
"fileExists",
"(",
"$",
"fileName",
")",
"{",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"fileName",
",",
"'r'",
",",
"true",
")",
";",
"if",
"(",
"is_resource",
"(",
"$",
"fp",
")",
")",
"{",
"fclose",
"(",
"$",
"fp"... | Checks whether the file exists in the include path
@param string file name
@return bool | [
"Checks",
"whether",
"the",
"file",
"exists",
"in",
"the",
"include",
"path"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Loader.php#L106-L114 | train | Check if file exists | [
30522,
2270,
10763,
3853,
5371,
10288,
5130,
1006,
1002,
5371,
18442,
1007,
1063,
1002,
1042,
2361,
1027,
1030,
1042,
26915,
1006,
1002,
5371,
18442,
1010,
1005,
1054,
1005,
1010,
2995,
1007,
1025,
2065,
1006,
2003,
1035,
7692,
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 | libs/HTML/QuickForm2/Element.php | HTML_QuickForm2_Element.render | public function render(HTML_QuickForm2_Renderer $renderer)
{
foreach ($this->rules as $rule) {
if ($rule[1] & HTML_QuickForm2_Rule::RUNAT_CLIENT) {
$renderer->getJavascriptBuilder()->addRule($rule[0]);
}
}
$renderer->renderElement($this);
return $renderer;
} | php | public function render(HTML_QuickForm2_Renderer $renderer)
{
foreach ($this->rules as $rule) {
if ($rule[1] & HTML_QuickForm2_Rule::RUNAT_CLIENT) {
$renderer->getJavascriptBuilder()->addRule($rule[0]);
}
}
$renderer->renderElement($this);
return $renderer;
} | [
"public",
"function",
"render",
"(",
"HTML_QuickForm2_Renderer",
"$",
"renderer",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"rule",
")",
"{",
"if",
"(",
"$",
"rule",
"[",
"1",
"]",
"&",
"HTML_QuickForm2_Rule",
"::",
"RUNAT_CLIENT",
... | Renders the element using the given renderer
@param HTML_QuickForm2_Renderer Renderer instance
@return HTML_QuickForm2_Renderer | [
"Renders",
"the",
"element",
"using",
"the",
"given",
"renderer"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element.php#L112-L121 | train | Renders the element | [
30522,
2270,
3853,
17552,
1006,
16129,
1035,
4248,
14192,
2475,
1035,
17552,
2121,
1002,
17552,
2121,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
3513,
2004,
1002,
3627,
1007,
1063,
2065,
1006,
1002,
3627,
1031,
1015,
1033,
1004,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.denormalize | public function denormalize($data, $class, $format = null, array $context = [])
{
if (!isset($context['cache_key'])) {
$context['cache_key'] = $this->getCacheKey($format, $context);
}
$allowedAttributes = $this->getAllowedAttributes($class, $context, true);
$normalizedData = $this->prepareForDenormalization($data);
$extraAttributes = [];
$reflectionClass = new \ReflectionClass($class);
$object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format);
foreach ($normalizedData as $attribute => $value) {
if ($this->nameConverter) {
$attribute = $this->nameConverter->denormalize($attribute, $class, $format, $context);
}
if ((false !== $allowedAttributes && !\in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($class, $attribute, $format, $context)) {
if (!($context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES])) {
$extraAttributes[] = $attribute;
}
continue;
}
if ($context[self::DEEP_OBJECT_TO_POPULATE] ?? $this->defaultContext[self::DEEP_OBJECT_TO_POPULATE] ?? false) {
try {
$context[self::OBJECT_TO_POPULATE] = $this->getAttributeValue($object, $attribute, $format, $context);
} catch (NoSuchPropertyException $e) {
}
}
$value = $this->validateAndDenormalize($class, $attribute, $value, $format, $context);
try {
$this->setAttributeValue($object, $attribute, $value, $format, $context);
} catch (InvalidArgumentException $e) {
throw new NotNormalizableValueException(sprintf('Failed to denormalize attribute "%s" value for class "%s": %s.', $attribute, $class, $e->getMessage()), $e->getCode(), $e);
}
}
if (!empty($extraAttributes)) {
throw new ExtraAttributesException($extraAttributes);
}
return $object;
} | php | public function denormalize($data, $class, $format = null, array $context = [])
{
if (!isset($context['cache_key'])) {
$context['cache_key'] = $this->getCacheKey($format, $context);
}
$allowedAttributes = $this->getAllowedAttributes($class, $context, true);
$normalizedData = $this->prepareForDenormalization($data);
$extraAttributes = [];
$reflectionClass = new \ReflectionClass($class);
$object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format);
foreach ($normalizedData as $attribute => $value) {
if ($this->nameConverter) {
$attribute = $this->nameConverter->denormalize($attribute, $class, $format, $context);
}
if ((false !== $allowedAttributes && !\in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($class, $attribute, $format, $context)) {
if (!($context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES])) {
$extraAttributes[] = $attribute;
}
continue;
}
if ($context[self::DEEP_OBJECT_TO_POPULATE] ?? $this->defaultContext[self::DEEP_OBJECT_TO_POPULATE] ?? false) {
try {
$context[self::OBJECT_TO_POPULATE] = $this->getAttributeValue($object, $attribute, $format, $context);
} catch (NoSuchPropertyException $e) {
}
}
$value = $this->validateAndDenormalize($class, $attribute, $value, $format, $context);
try {
$this->setAttributeValue($object, $attribute, $value, $format, $context);
} catch (InvalidArgumentException $e) {
throw new NotNormalizableValueException(sprintf('Failed to denormalize attribute "%s" value for class "%s": %s.', $attribute, $class, $e->getMessage()), $e->getCode(), $e);
}
}
if (!empty($extraAttributes)) {
throw new ExtraAttributesException($extraAttributes);
}
return $object;
} | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"context",
"[",
"'cache_key'",
"]",
")",
")",
"{"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L321-L367 | train | Denormalizes a string to a class | [
30522,
2270,
3853,
7939,
2953,
9067,
4697,
1006,
1002,
2951,
1010,
1002,
2465,
1010,
1002,
4289,
1027,
19701,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
6123,
1031,
1005,
17053,
1035,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/ProgressIndicator.php | ProgressIndicator.start | public function start($message)
{
if ($this->started) {
throw new LogicException('Progress indicator already started.');
}
$this->message = $message;
$this->started = true;
$this->startTime = time();
$this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
$this->indicatorCurrent = 0;
$this->display();
} | php | public function start($message)
{
if ($this->started) {
throw new LogicException('Progress indicator already started.');
}
$this->message = $message;
$this->started = true;
$this->startTime = time();
$this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
$this->indicatorCurrent = 0;
$this->display();
} | [
"public",
"function",
"start",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Progress indicator already started.'",
")",
";",
"}",
"$",
"this",
"->",
"message",
"=",
"$",
"message... | Starts the indicator output.
@param $message | [
"Starts",
"the",
"indicator",
"output",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/ProgressIndicator.php#L83-L96 | train | Start the indicator | [
30522,
2270,
3853,
2707,
1006,
1002,
4471,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2318,
1007,
1063,
5466,
2047,
7961,
10288,
24422,
1006,
1005,
5082,
17245,
2525,
2318,
1012,
1005,
1007,
1025,
1065,
1002,
2023,
1011,
1028,
4471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CorePluginsAdmin/Controller.php | Controller.isAllowedToTroubleshootAsSuperUser | protected function isAllowedToTroubleshootAsSuperUser()
{
$isAllowedToTroubleshootAsSuperUser = false;
$salt = SettingsPiwik::getSalt();
if (!empty($salt)) {
$saltFromRequest = Common::getRequestVar('i_am_super_user', '', 'string');
$isAllowedToTroubleshootAsSuperUser = ($salt == $saltFromRequest);
}
return $isAllowedToTroubleshootAsSuperUser;
} | php | protected function isAllowedToTroubleshootAsSuperUser()
{
$isAllowedToTroubleshootAsSuperUser = false;
$salt = SettingsPiwik::getSalt();
if (!empty($salt)) {
$saltFromRequest = Common::getRequestVar('i_am_super_user', '', 'string');
$isAllowedToTroubleshootAsSuperUser = ($salt == $saltFromRequest);
}
return $isAllowedToTroubleshootAsSuperUser;
} | [
"protected",
"function",
"isAllowedToTroubleshootAsSuperUser",
"(",
")",
"{",
"$",
"isAllowedToTroubleshootAsSuperUser",
"=",
"false",
";",
"$",
"salt",
"=",
"SettingsPiwik",
"::",
"getSalt",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"salt",
")",
")",
... | Let Super User troubleshoot in safe mode, even when Login is broken, with this special trick
@return bool
@throws Exception | [
"Let",
"Super",
"User",
"troubleshoot",
"in",
"safe",
"mode",
"even",
"when",
"Login",
"is",
"broken",
"with",
"this",
"special",
"trick"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CorePluginsAdmin/Controller.php#L588-L597 | train | Check if the current user is allowed to troubleshoot as a super user | [
30522,
5123,
3853,
18061,
7174,
15557,
3406,
13181,
12083,
4244,
23416,
12054,
6279,
21608,
2121,
1006,
1007,
1063,
1002,
18061,
7174,
15557,
3406,
13181,
12083,
4244,
23416,
12054,
6279,
21608,
2121,
1027,
6270,
1025,
1002,
5474,
1027,
10906... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Renderer/Default.php | HTML_QuickForm2_Renderer_Default.renderHidden | public function renderHidden(HTML_QuickForm2_Node $element)
{
if ($this->options['group_hiddens']) {
$this->hiddenHtml .= $element->__toString();
} else {
$this->html[count($this->html) - 1][] = str_replace('{element}', $element,
$this->findTemplate($element));
}
} | php | public function renderHidden(HTML_QuickForm2_Node $element)
{
if ($this->options['group_hiddens']) {
$this->hiddenHtml .= $element->__toString();
} else {
$this->html[count($this->html) - 1][] = str_replace('{element}', $element,
$this->findTemplate($element));
}
} | [
"public",
"function",
"renderHidden",
"(",
"HTML_QuickForm2_Node",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
"'group_hiddens'",
"]",
")",
"{",
"$",
"this",
"->",
"hiddenHtml",
".=",
"$",
"element",
"->",
"__toString",
"(",
")"... | Renders a hidden element
@param HTML_QuickForm2_Node Hidden element being rendered | [
"Renders",
"a",
"hidden",
"element"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Default.php#L299-L307 | train | Render hidden elements | [
30522,
2270,
3853,
17552,
27511,
4181,
1006,
16129,
1035,
4248,
14192,
2475,
1035,
13045,
1002,
5783,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7047,
1031,
1005,
2177,
1035,
5023,
2015,
1005,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Filesystem/Filesystem.php | Filesystem.toString | protected function toString(?string $scheme, string $path): string
{
if ($scheme) {
return $scheme . '://' . $path;
}
return $path;
} | php | protected function toString(?string $scheme, string $path): string
{
if ($scheme) {
return $scheme . '://' . $path;
}
return $path;
} | [
"protected",
"function",
"toString",
"(",
"?",
"string",
"$",
"scheme",
",",
"string",
"$",
"path",
")",
":",
"string",
"{",
"if",
"(",
"$",
"scheme",
")",
"{",
"return",
"$",
"scheme",
".",
"'://'",
".",
"$",
"path",
";",
"}",
"return",
"$",
"path... | @param string|null $scheme
@param string $path
@return string | [
"@param",
"string|null",
"$scheme",
"@param",
"string",
"$path"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Filesystem/Filesystem.php#L227-L234 | train | Returns the string representation of the url | [
30522,
5123,
3853,
2000,
3367,
4892,
1006,
1029,
5164,
1002,
5679,
1010,
5164,
1002,
4130,
1007,
1024,
5164,
1063,
2065,
1006,
1002,
5679,
1007,
1063,
2709,
1002,
5679,
1012,
1005,
1024,
1013,
1013,
1005,
1012,
1002,
4130,
1025,
1065,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.getMailMIME | public function getMailMIME()
{
$result = '';
$ismultipart = true;
switch ($this->message_type) {
case 'inline':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'attach':
case 'inline_attach':
case 'alt_attach':
case 'alt_inline_attach':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED . ';');
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'alt':
case 'alt_inline':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
default:
// Catches case 'plain': and case '':
$result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
$ismultipart = false;
break;
}
// RFC1341 part 5 says 7bit is assumed if not specified
if (static::ENCODING_7BIT != $this->Encoding) {
// RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
if ($ismultipart) {
if (static::ENCODING_8BIT == $this->Encoding) {
$result .= $this->headerLine('Content-Transfer-Encoding', static::ENCODING_8BIT);
}
// The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
} else {
$result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
}
}
if ('mail' != $this->Mailer) {
$result .= static::$LE;
}
return $result;
} | php | public function getMailMIME()
{
$result = '';
$ismultipart = true;
switch ($this->message_type) {
case 'inline':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'attach':
case 'inline_attach':
case 'alt_attach':
case 'alt_inline_attach':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED . ';');
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
case 'alt':
case 'alt_inline':
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
break;
default:
// Catches case 'plain': and case '':
$result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
$ismultipart = false;
break;
}
// RFC1341 part 5 says 7bit is assumed if not specified
if (static::ENCODING_7BIT != $this->Encoding) {
// RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
if ($ismultipart) {
if (static::ENCODING_8BIT == $this->Encoding) {
$result .= $this->headerLine('Content-Transfer-Encoding', static::ENCODING_8BIT);
}
// The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
} else {
$result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
}
}
if ('mail' != $this->Mailer) {
$result .= static::$LE;
}
return $result;
} | [
"public",
"function",
"getMailMIME",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"ismultipart",
"=",
"true",
";",
"switch",
"(",
"$",
"this",
"->",
"message_type",
")",
"{",
"case",
"'inline'",
":",
"$",
"result",
".=",
"$",
"this",
"->",
"hea... | Get the message MIME type headers.
@return string | [
"Get",
"the",
"message",
"MIME",
"type",
"headers",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L2419-L2464 | train | Returns the MIME part of the message | [
30522,
2270,
3853,
2131,
21397,
4328,
4168,
1006,
1007,
1063,
1002,
2765,
1027,
1005,
1005,
1025,
1002,
2003,
12274,
7096,
11514,
8445,
1027,
2995,
1025,
6942,
1006,
1002,
2023,
1011,
1028,
4471,
1035,
2828,
1007,
1063,
2553,
1005,
23881,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Actions/Archiver.php | Archiver.archiveDayActionsTime | protected function archiveDayActionsTime($rankingQueryLimit)
{
$rankingQuery = false;
if ($rankingQueryLimit > 0) {
$rankingQuery = new RankingQuery($rankingQueryLimit);
$rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW);
$rankingQuery->addLabelColumn('idaction');
$rankingQuery->addColumn(PiwikMetrics::INDEX_PAGE_SUM_TIME_SPENT, 'sum');
$rankingQuery->partitionResultIntoMultipleGroups('type', array_keys($this->actionsTablesByType));
$extraSelects = "log_action.type, log_action.name, count(*) as `" . PiwikMetrics::INDEX_PAGE_NB_HITS . "`,";
$from = array(
"log_link_visit_action",
array(
"table" => "log_action",
"joinOn" => "log_link_visit_action.%s = log_action.idaction"
)
);
$orderBy = "`" . PiwikMetrics::INDEX_PAGE_NB_HITS . "` DESC, log_action.name ASC";
} else {
$extraSelects = false;
$from = "log_link_visit_action";
$orderBy = false;
}
$select = "log_link_visit_action.%s as idaction, $extraSelects
sum(log_link_visit_action.time_spent_ref_action) as `" . PiwikMetrics::INDEX_PAGE_SUM_TIME_SPENT . "`";
$where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time');
$where .= " AND log_link_visit_action.time_spent_ref_action > 0
AND log_link_visit_action.%s > 0"
. $this->getWhereClauseActionIsNotEvent();
$groupBy = "log_link_visit_action.%s";
$this->archiveDayQueryProcess($select, $from, $where, $groupBy, $orderBy, "idaction_url_ref", $rankingQuery);
$this->archiveDayQueryProcess($select, $from, $where, $groupBy, $orderBy, "idaction_name_ref", $rankingQuery);
} | php | protected function archiveDayActionsTime($rankingQueryLimit)
{
$rankingQuery = false;
if ($rankingQueryLimit > 0) {
$rankingQuery = new RankingQuery($rankingQueryLimit);
$rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW);
$rankingQuery->addLabelColumn('idaction');
$rankingQuery->addColumn(PiwikMetrics::INDEX_PAGE_SUM_TIME_SPENT, 'sum');
$rankingQuery->partitionResultIntoMultipleGroups('type', array_keys($this->actionsTablesByType));
$extraSelects = "log_action.type, log_action.name, count(*) as `" . PiwikMetrics::INDEX_PAGE_NB_HITS . "`,";
$from = array(
"log_link_visit_action",
array(
"table" => "log_action",
"joinOn" => "log_link_visit_action.%s = log_action.idaction"
)
);
$orderBy = "`" . PiwikMetrics::INDEX_PAGE_NB_HITS . "` DESC, log_action.name ASC";
} else {
$extraSelects = false;
$from = "log_link_visit_action";
$orderBy = false;
}
$select = "log_link_visit_action.%s as idaction, $extraSelects
sum(log_link_visit_action.time_spent_ref_action) as `" . PiwikMetrics::INDEX_PAGE_SUM_TIME_SPENT . "`";
$where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time');
$where .= " AND log_link_visit_action.time_spent_ref_action > 0
AND log_link_visit_action.%s > 0"
. $this->getWhereClauseActionIsNotEvent();
$groupBy = "log_link_visit_action.%s";
$this->archiveDayQueryProcess($select, $from, $where, $groupBy, $orderBy, "idaction_url_ref", $rankingQuery);
$this->archiveDayQueryProcess($select, $from, $where, $groupBy, $orderBy, "idaction_name_ref", $rankingQuery);
} | [
"protected",
"function",
"archiveDayActionsTime",
"(",
"$",
"rankingQueryLimit",
")",
"{",
"$",
"rankingQuery",
"=",
"false",
";",
"if",
"(",
"$",
"rankingQueryLimit",
">",
"0",
")",
"{",
"$",
"rankingQuery",
"=",
"new",
"RankingQuery",
"(",
"$",
"rankingQuery... | Time per action | [
"Time",
"per",
"action"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/Archiver.php#L372-L410 | train | Archives day actions time | [
30522,
5123,
3853,
9749,
12186,
22014,
7292,
1006,
1002,
5464,
4226,
23320,
27605,
2102,
1007,
1063,
1002,
5464,
4226,
2854,
1027,
6270,
1025,
2065,
1006,
1002,
5464,
4226,
23320,
27605,
2102,
1028,
1014,
1007,
1063,
1002,
5464,
4226,
2854,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Loader/XmlFileLoader.php | XmlFileLoader.parseImports | private function parseImports(\DOMDocument $xml, $file)
{
$xpath = new \DOMXPath($xml);
$xpath->registerNamespace('container', self::NS);
if (false === $imports = $xpath->query('//container:imports/container:import')) {
return;
}
$defaultDirectory = \dirname($file);
foreach ($imports as $import) {
$this->setCurrentDir($defaultDirectory);
$this->import($import->getAttribute('resource'), XmlUtils::phpize($import->getAttribute('type')) ?: null, (bool) XmlUtils::phpize($import->getAttribute('ignore-errors')), $file);
}
} | php | private function parseImports(\DOMDocument $xml, $file)
{
$xpath = new \DOMXPath($xml);
$xpath->registerNamespace('container', self::NS);
if (false === $imports = $xpath->query('//container:imports/container:import')) {
return;
}
$defaultDirectory = \dirname($file);
foreach ($imports as $import) {
$this->setCurrentDir($defaultDirectory);
$this->import($import->getAttribute('resource'), XmlUtils::phpize($import->getAttribute('type')) ?: null, (bool) XmlUtils::phpize($import->getAttribute('ignore-errors')), $file);
}
} | [
"private",
"function",
"parseImports",
"(",
"\\",
"DOMDocument",
"$",
"xml",
",",
"$",
"file",
")",
"{",
"$",
"xpath",
"=",
"new",
"\\",
"DOMXPath",
"(",
"$",
"xml",
")",
";",
"$",
"xpath",
"->",
"registerNamespace",
"(",
"'container'",
",",
"self",
":... | Parses imports.
@param \DOMDocument $xml
@param string $file | [
"Parses",
"imports",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php#L107-L121 | train | Parse the imports from the container. xml | [
30522,
2797,
3853,
11968,
20240,
8737,
11589,
2015,
1006,
1032,
14383,
3527,
24894,
4765,
1002,
20950,
1010,
1002,
5371,
1007,
1063,
1002,
26726,
8988,
1027,
2047,
1032,
14383,
2595,
15069,
1006,
1002,
20950,
1007,
1025,
1002,
26726,
8988,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
barryvdh/laravel-debugbar | src/Middleware/DebugbarEnabled.php | DebugbarEnabled.handle | public function handle($request, Closure $next)
{
if (!$this->debugbar->isEnabled()) {
abort(404);
}
return $next($request);
} | php | public function handle($request, Closure $next)
{
if (!$this->debugbar->isEnabled()) {
abort(404);
}
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"debugbar",
"->",
"isEnabled",
"(",
")",
")",
"{",
"abort",
"(",
"404",
")",
";",
"}",
"return",
"$",
"next",
"(",
"$",... | Handle an incoming request.
@param Request $request
@param Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/Middleware/DebugbarEnabled.php#L33-L41 | train | Handle the request | [
30522,
2270,
3853,
5047,
1006,
1002,
5227,
1010,
8503,
1002,
2279,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2139,
8569,
18259,
2906,
1011,
1028,
2003,
8189,
23242,
1006,
1007,
1007,
1063,
11113,
11589,
1006,
24837,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Insights/Model.php | Model.getRelevantTotalValue | public function getRelevantTotalValue(DataTable $currentReport, $metric, $totalValue)
{
$totalMetric = $this->getMetricTotalValue($currentReport, $metric);
if ($totalMetric > $totalValue) {
return $totalMetric;
}
if (($totalMetric * 2) < $totalValue) {
return $totalMetric;
}
return $totalValue;
} | php | public function getRelevantTotalValue(DataTable $currentReport, $metric, $totalValue)
{
$totalMetric = $this->getMetricTotalValue($currentReport, $metric);
if ($totalMetric > $totalValue) {
return $totalMetric;
}
if (($totalMetric * 2) < $totalValue) {
return $totalMetric;
}
return $totalValue;
} | [
"public",
"function",
"getRelevantTotalValue",
"(",
"DataTable",
"$",
"currentReport",
",",
"$",
"metric",
",",
"$",
"totalValue",
")",
"{",
"$",
"totalMetric",
"=",
"$",
"this",
"->",
"getMetricTotalValue",
"(",
"$",
"currentReport",
",",
"$",
"metric",
")",
... | Returns either the $totalValue (eg 5500 visits) or the total value of the report
(eg 2500 visits of 5500 total visits as for instance only 2500 visits came to the website using a search engine).
If the metric total (2500) is much lower than $totalValue, the metric total will be returned, otherwise the
$totalValue | [
"Returns",
"either",
"the",
"$totalValue",
"(",
"eg",
"5500",
"visits",
")",
"or",
"the",
"total",
"value",
"of",
"the",
"report",
"(",
"eg",
"2500",
"visits",
"of",
"5500",
"total",
"visits",
"as",
"for",
"instance",
"only",
"2500",
"visits",
"came",
"t... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Insights/Model.php#L78-L91 | train | Returns the relevant total value for a given metric | [
30522,
2270,
3853,
2131,
16570,
13331,
3372,
3406,
9080,
10175,
5657,
1006,
2951,
10880,
1002,
2783,
2890,
6442,
1010,
1002,
12046,
1010,
1002,
2561,
10175,
5657,
1007,
1063,
1002,
2561,
12589,
1027,
1002,
2023,
1011,
1028,
2131,
12589,
340... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AdminServiceProvider.php | AdminServiceProvider.boot | public function boot()
{
$this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
if (config('admin.https') || config('admin.secure')) {
\URL::forceScheme('https');
$this->app['request']->server->set('HTTPS', true);
}
if (file_exists($routes = admin_path('routes.php'))) {
$this->loadRoutesFrom($routes);
}
if ($this->app->runningInConsole()) {
$this->publishes([__DIR__.'/../config' => config_path()], 'laravel-admin-config');
$this->publishes([__DIR__.'/../resources/lang' => resource_path('lang')], 'laravel-admin-lang');
// $this->publishes([__DIR__.'/../resources/views' => resource_path('views/vendor/admin')], 'laravel-admin-views');
$this->publishes([__DIR__.'/../database/migrations' => database_path('migrations')], 'laravel-admin-migrations');
$this->publishes([__DIR__.'/../resources/assets' => public_path('vendor/laravel-admin')], 'laravel-admin-assets');
}
//remove default feature of double encoding enable in laravel 5.6 or later.
$bladeReflectionClass = new \ReflectionClass('\Illuminate\View\Compilers\BladeCompiler');
if ($bladeReflectionClass->hasMethod('withoutDoubleEncoding')) {
Blade::withoutDoubleEncoding();
}
} | php | public function boot()
{
$this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
if (config('admin.https') || config('admin.secure')) {
\URL::forceScheme('https');
$this->app['request']->server->set('HTTPS', true);
}
if (file_exists($routes = admin_path('routes.php'))) {
$this->loadRoutesFrom($routes);
}
if ($this->app->runningInConsole()) {
$this->publishes([__DIR__.'/../config' => config_path()], 'laravel-admin-config');
$this->publishes([__DIR__.'/../resources/lang' => resource_path('lang')], 'laravel-admin-lang');
// $this->publishes([__DIR__.'/../resources/views' => resource_path('views/vendor/admin')], 'laravel-admin-views');
$this->publishes([__DIR__.'/../database/migrations' => database_path('migrations')], 'laravel-admin-migrations');
$this->publishes([__DIR__.'/../resources/assets' => public_path('vendor/laravel-admin')], 'laravel-admin-assets');
}
//remove default feature of double encoding enable in laravel 5.6 or later.
$bladeReflectionClass = new \ReflectionClass('\Illuminate\View\Compilers\BladeCompiler');
if ($bladeReflectionClass->hasMethod('withoutDoubleEncoding')) {
Blade::withoutDoubleEncoding();
}
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"loadViewsFrom",
"(",
"__DIR__",
".",
"'/../resources/views'",
",",
"'admin'",
")",
";",
"if",
"(",
"config",
"(",
"'admin.https'",
")",
"||",
"config",
"(",
"'admin.secure'",
")",
")",
"{",
... | Boot the service provider.
@return void | [
"Boot",
"the",
"service",
"provider",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/AdminServiceProvider.php#L64-L90 | train | Boots the admin. | [
30522,
2270,
3853,
9573,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
7170,
8584,
22747,
21716,
1006,
1035,
1035,
16101,
1035,
1035,
1012,
1005,
1013,
1012,
1012,
1013,
4219,
1013,
5328,
1005,
1010,
1005,
4748,
10020,
1005,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/CustomerService/SessionClient.php | SessionClient.create | public function create(string $account, string $openid)
{
$params = [
'kf_account' => $account,
'openid' => $openid,
];
return $this->httpPostJson('customservice/kfsession/create', $params);
} | php | public function create(string $account, string $openid)
{
$params = [
'kf_account' => $account,
'openid' => $openid,
];
return $this->httpPostJson('customservice/kfsession/create', $params);
} | [
"public",
"function",
"create",
"(",
"string",
"$",
"account",
",",
"string",
"$",
"openid",
")",
"{",
"$",
"params",
"=",
"[",
"'kf_account'",
"=>",
"$",
"account",
",",
"'openid'",
"=>",
"$",
"openid",
",",
"]",
";",
"return",
"$",
"this",
"->",
"h... | Create a session.
@param string $account
@param string $openid
@return mixed
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"Create",
"a",
"session",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/CustomerService/SessionClient.php#L59-L67 | train | Create a new session | [
30522,
2270,
3853,
3443,
1006,
5164,
1002,
4070,
1010,
5164,
1002,
2330,
3593,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
1047,
2546,
1035,
4070,
1005,
1027,
1028,
1002,
4070,
1010,
1005,
2330,
3593,
1005,
1027,
1028,
1002,
2330,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Core/Type/FileType.php | FileType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$dataClass = null;
if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
$dataClass = function (Options $options) {
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
};
}
$emptyData = function (Options $options) {
return $options['multiple'] ? [] : null;
};
$resolver->setDefaults([
'compound' => false,
'data_class' => $dataClass,
'empty_data' => $emptyData,
'multiple' => false,
'allow_file_upload' => true,
]);
} | php | public function configureOptions(OptionsResolver $resolver)
{
$dataClass = null;
if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
$dataClass = function (Options $options) {
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
};
}
$emptyData = function (Options $options) {
return $options['multiple'] ? [] : null;
};
$resolver->setDefaults([
'compound' => false,
'data_class' => $dataClass,
'empty_data' => $emptyData,
'multiple' => false,
'allow_file_upload' => true,
]);
} | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"dataClass",
"=",
"null",
";",
"if",
"(",
"class_exists",
"(",
"'Symfony\\Component\\HttpFoundation\\File\\File'",
")",
")",
"{",
"$",
"dataClass",
"=",
"function",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/FileType.php#L114-L134 | train | Configure the options for the request. | [
30522,
2270,
3853,
9530,
8873,
27390,
8780,
16790,
2015,
1006,
7047,
6072,
4747,
6299,
1002,
10663,
2099,
1007,
1063,
1002,
2951,
26266,
1027,
19701,
1025,
2065,
1006,
2465,
1035,
6526,
1006,
1005,
25353,
2213,
14876,
4890,
1032,
6922,
1032... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Renderer/Php.php | Php.render | public function render($dataTable = null)
{
if (is_null($dataTable)) {
$dataTable = $this->table;
}
$toReturn = $this->flatRender($dataTable);
if ($this->prettyDisplay) {
if (!is_array($toReturn)) {
$toReturn = Common::safe_unserialize($toReturn);
}
$toReturn = "<pre>" . var_export($toReturn, true) . "</pre>";
}
return $toReturn;
} | php | public function render($dataTable = null)
{
if (is_null($dataTable)) {
$dataTable = $this->table;
}
$toReturn = $this->flatRender($dataTable);
if ($this->prettyDisplay) {
if (!is_array($toReturn)) {
$toReturn = Common::safe_unserialize($toReturn);
}
$toReturn = "<pre>" . var_export($toReturn, true) . "</pre>";
}
return $toReturn;
} | [
"public",
"function",
"render",
"(",
"$",
"dataTable",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"dataTable",
")",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"table",
";",
"}",
"$",
"toReturn",
"=",
"$",
"this",
"->",
"flatRen... | Computes the dataTable output and returns the string/binary
@param null|DataTable|DataTable\Map|Simple $dataTable
@return string | [
"Computes",
"the",
"dataTable",
"output",
"and",
"returns",
"the",
"string",
"/",
"binary"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Php.php#L72-L86 | train | Render the table | [
30522,
2270,
3853,
17552,
1006,
1002,
2951,
10880,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2951,
10880,
1007,
1007,
1063,
1002,
2951,
10880,
1027,
1002,
2023,
1011,
1028,
2795,
1025,
1065,
1002,
9538,
22299,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form.php | Form.handleEditable | protected function handleEditable(array $input = [])
{
if (array_key_exists('_editable', $input)) {
$name = $input['name'];
$value = $input['value'];
Arr::forget($input, ['pk', 'value', 'name']);
Arr::set($input, $name, $value);
}
return $input;
} | php | protected function handleEditable(array $input = [])
{
if (array_key_exists('_editable', $input)) {
$name = $input['name'];
$value = $input['value'];
Arr::forget($input, ['pk', 'value', 'name']);
Arr::set($input, $name, $value);
}
return $input;
} | [
"protected",
"function",
"handleEditable",
"(",
"array",
"$",
"input",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'_editable'",
",",
"$",
"input",
")",
")",
"{",
"$",
"name",
"=",
"$",
"input",
"[",
"'name'",
"]",
";",
"$",
"value"... | Handle editable update.
@param array $input
@return array | [
"Handle",
"editable",
"update",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L663-L674 | train | Handle editable input | [
30522,
5123,
3853,
5047,
2098,
6590,
3468,
1006,
9140,
1002,
7953,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
9140,
1035,
3145,
1035,
6526,
1006,
1005,
1035,
10086,
3085,
1005,
1010,
1002,
7953,
1007,
1007,
1063,
1002,
2171,
1027,
1002,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Kernel/Providers/LogServiceProvider.php | LogServiceProvider.register | public function register(Container $pimple)
{
$pimple['logger'] = $pimple['log'] = function ($app) {
$config = $this->formatLogConfig($app);
if (!empty($config)) {
$app->rebind('config', $app['config']->merge($config));
}
return new LogManager($app);
};
} | php | public function register(Container $pimple)
{
$pimple['logger'] = $pimple['log'] = function ($app) {
$config = $this->formatLogConfig($app);
if (!empty($config)) {
$app->rebind('config', $app['config']->merge($config));
}
return new LogManager($app);
};
} | [
"public",
"function",
"register",
"(",
"Container",
"$",
"pimple",
")",
"{",
"$",
"pimple",
"[",
"'logger'",
"]",
"=",
"$",
"pimple",
"[",
"'log'",
"]",
"=",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"formatLogConf... | Registers services on the given container.
This method should only be used to configure services and parameters.
It should not get services.
@param Container $pimple A container instance | [
"Registers",
"services",
"on",
"the",
"given",
"container",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Providers/LogServiceProvider.php#L33-L44 | train | Register the LogManager into the Container | [
30522,
2270,
3853,
4236,
1006,
11661,
1002,
14255,
23344,
1007,
1063,
1002,
14255,
23344,
1031,
1005,
8833,
4590,
1005,
1033,
1027,
1002,
14255,
23344,
1031,
1005,
8833,
1005,
1033,
1027,
3853,
1006,
1002,
10439,
1007,
1063,
1002,
9530,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/twig/PutNode.php | PutNode.compile | public function compile(Twig_Compiler $compiler)
{
$compiler
->addDebugInfo($this)
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->startBlock(")
->raw("'".$this->getAttribute('name')."'")
->write(");\n")
;
$isOverwrite = strtolower($this->getAttribute('endType')) == 'overwrite';
$compiler->subcompile($this->getNode('body'));
$compiler
->addDebugInfo($this)
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->endBlock(")
->raw($isOverwrite ? 'false' : 'true')
->write(");\n")
;
} | php | public function compile(Twig_Compiler $compiler)
{
$compiler
->addDebugInfo($this)
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->startBlock(")
->raw("'".$this->getAttribute('name')."'")
->write(");\n")
;
$isOverwrite = strtolower($this->getAttribute('endType')) == 'overwrite';
$compiler->subcompile($this->getNode('body'));
$compiler
->addDebugInfo($this)
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->endBlock(")
->raw($isOverwrite ? 'false' : 'true')
->write(");\n")
;
} | [
"public",
"function",
"compile",
"(",
"Twig_Compiler",
"$",
"compiler",
")",
"{",
"$",
"compiler",
"->",
"addDebugInfo",
"(",
"$",
"this",
")",
"->",
"write",
"(",
"\"echo \\$this->env->getExtension('Cms\\Twig\\Extension')->startBlock(\"",
")",
"->",
"raw",
"(",
"\"... | Compiles the node to PHP.
@param Twig_Compiler $compiler A Twig_Compiler instance | [
"Compiles",
"the",
"node",
"to",
"PHP",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/PutNode.php#L24-L43 | train | Compiles the block into PHP code | [
30522,
2270,
3853,
4012,
22090,
1006,
1056,
16279,
1035,
21624,
1002,
21624,
1007,
1063,
1002,
21624,
1011,
1028,
5587,
3207,
8569,
11528,
14876,
1006,
1002,
2023,
1007,
1011,
1028,
4339,
1006,
1000,
9052,
1032,
1002,
2023,
1011,
1028,
4372... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail.php | Zend_Mail.clearHeader | public function clearHeader($headerName)
{
if (isset($this->_headers[$headerName])){
unset($this->_headers[$headerName]);
}
return $this;
} | php | public function clearHeader($headerName)
{
if (isset($this->_headers[$headerName])){
unset($this->_headers[$headerName]);
}
return $this;
} | [
"public",
"function",
"clearHeader",
"(",
"$",
"headerName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_headers",
"[",
"$",
"headerName",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_headers",
"[",
"$",
"headerName",
"]",
")",
... | Clear header from the message
@param string $headerName
@return Zend_Mail Provides fluent inter | [
"Clear",
"header",
"from",
"the",
"message"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L640-L646 | train | Clear the header | [
30522,
2270,
3853,
3154,
4974,
2121,
1006,
1002,
20346,
18442,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
1035,
20346,
2015,
1031,
1002,
20346,
18442,
1033,
1007,
1007,
1063,
4895,
13462,
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... |
octobercms/october | modules/cms/classes/Controller.php | Controller.runAjaxHandler | protected function runAjaxHandler($handler)
{
/**
* @event cms.ajax.beforeRunHandler
* Provides an opportunity to modify an AJAX request
*
* The parameter provided is `$handler` (the requested AJAX handler to be run)
*
* Example usage (forwards AJAX handlers to a backend widget):
*
* Event::listen('cms.ajax.beforeRunHandler', function((\Cms\Classes\Controller) $controller, (string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
* Or
*
* $this->controller->bindEvent('ajax.beforeRunHandler', function ((string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.ajax.beforeRunHandler', [$handler])) {
return $event;
}
/*
* Process Component handler
*/
if (strpos($handler, '::')) {
list($componentName, $handlerName) = explode('::', $handler);
$componentObj = $this->findComponentByName($componentName);
if ($componentObj && $componentObj->methodExists($handlerName)) {
$this->componentContext = $componentObj;
$result = $componentObj->runAjaxHandler($handlerName);
return $result ?: true;
}
}
/*
* Process code section handler
*/
else {
if (method_exists($this->pageObj, $handler)) {
$result = $this->pageObj->$handler();
return $result ?: true;
}
if (!$this->layout->isFallBack() && method_exists($this->layoutObj, $handler)) {
$result = $this->layoutObj->$handler();
return $result ?: true;
}
/*
* Cycle each component to locate a usable handler
*/
if (($componentObj = $this->findComponentByHandler($handler)) !== null) {
$this->componentContext = $componentObj;
$result = $componentObj->runAjaxHandler($handler);
return $result ?: true;
}
}
/*
* Generic handler that does nothing
*/
if ($handler == 'onAjax') {
return true;
}
return false;
} | php | protected function runAjaxHandler($handler)
{
/**
* @event cms.ajax.beforeRunHandler
* Provides an opportunity to modify an AJAX request
*
* The parameter provided is `$handler` (the requested AJAX handler to be run)
*
* Example usage (forwards AJAX handlers to a backend widget):
*
* Event::listen('cms.ajax.beforeRunHandler', function((\Cms\Classes\Controller) $controller, (string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
* Or
*
* $this->controller->bindEvent('ajax.beforeRunHandler', function ((string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.ajax.beforeRunHandler', [$handler])) {
return $event;
}
/*
* Process Component handler
*/
if (strpos($handler, '::')) {
list($componentName, $handlerName) = explode('::', $handler);
$componentObj = $this->findComponentByName($componentName);
if ($componentObj && $componentObj->methodExists($handlerName)) {
$this->componentContext = $componentObj;
$result = $componentObj->runAjaxHandler($handlerName);
return $result ?: true;
}
}
/*
* Process code section handler
*/
else {
if (method_exists($this->pageObj, $handler)) {
$result = $this->pageObj->$handler();
return $result ?: true;
}
if (!$this->layout->isFallBack() && method_exists($this->layoutObj, $handler)) {
$result = $this->layoutObj->$handler();
return $result ?: true;
}
/*
* Cycle each component to locate a usable handler
*/
if (($componentObj = $this->findComponentByHandler($handler)) !== null) {
$this->componentContext = $componentObj;
$result = $componentObj->runAjaxHandler($handler);
return $result ?: true;
}
}
/*
* Generic handler that does nothing
*/
if ($handler == 'onAjax') {
return true;
}
return false;
} | [
"protected",
"function",
"runAjaxHandler",
"(",
"$",
"handler",
")",
"{",
"/**\n * @event cms.ajax.beforeRunHandler\n * Provides an opportunity to modify an AJAX request\n *\n * The parameter provided is `$handler` (the requested AJAX handler to be run)\n *\n ... | Tries to find and run an AJAX handler in the page, layout, components and plugins.
The method stops as soon as the handler is found.
@param string $handler name of the ajax handler
@return boolean Returns true if the handler was found. Returns false otherwise. | [
"Tries",
"to",
"find",
"and",
"run",
"an",
"AJAX",
"handler",
"in",
"the",
"page",
"layout",
"components",
"and",
"plugins",
".",
"The",
"method",
"stops",
"as",
"soon",
"as",
"the",
"handler",
"is",
"found",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L805-L886 | train | Runs an AJAX handler | [
30522,
5123,
3853,
2448,
22734,
2595,
11774,
3917,
1006,
1002,
28213,
1007,
1063,
1013,
1008,
1008,
1008,
1030,
2724,
4642,
2015,
1012,
18176,
1012,
2077,
15532,
11774,
3917,
1008,
3640,
2019,
4495,
2000,
19933,
2019,
18176,
5227,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Pipeline.php | Pipeline.handleException | protected function handleException($passable, Exception $e)
{
if (! $this->container->bound(ExceptionHandler::class) ||
! $passable instanceof Request) {
throw $e;
}
$handler = $this->container->make(ExceptionHandler::class);
$handler->report($e);
$response = $handler->render($passable, $e);
if (method_exists($response, 'withException')) {
$response->withException($e);
}
return $response;
} | php | protected function handleException($passable, Exception $e)
{
if (! $this->container->bound(ExceptionHandler::class) ||
! $passable instanceof Request) {
throw $e;
}
$handler = $this->container->make(ExceptionHandler::class);
$handler->report($e);
$response = $handler->render($passable, $e);
if (method_exists($response, 'withException')) {
$response->withException($e);
}
return $response;
} | [
"protected",
"function",
"handleException",
"(",
"$",
"passable",
",",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"bound",
"(",
"ExceptionHandler",
"::",
"class",
")",
"||",
"!",
"$",
"passable",
"instanceof",
... | Handle the given exception.
@param mixed $passable
@param \Exception $e
@return mixed
@throws \Exception | [
"Handle",
"the",
"given",
"exception",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Pipeline.php#L72-L90 | train | Handle exception and return response | [
30522,
5123,
3853,
5047,
10288,
24422,
1006,
1002,
3413,
3085,
1010,
6453,
1002,
1041,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
5391,
1006,
6453,
11774,
3917,
1024,
1024,
2465,
1007,
1064,
1064,
999,
1002,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Session/Store.php | Store.hasOldInput | public function hasOldInput($key = null)
{
$old = $this->getOldInput($key);
return is_null($key) ? count($old) > 0 : ! is_null($old);
} | php | public function hasOldInput($key = null)
{
$old = $this->getOldInput($key);
return is_null($key) ? count($old) > 0 : ! is_null($old);
} | [
"public",
"function",
"hasOldInput",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"old",
"=",
"$",
"this",
"->",
"getOldInput",
"(",
"$",
"key",
")",
";",
"return",
"is_null",
"(",
"$",
"key",
")",
"?",
"count",
"(",
"$",
"old",
")",
">",
"0",
... | Determine if the session contains old input.
@param string $key
@return bool | [
"Determine",
"if",
"the",
"session",
"contains",
"old",
"input",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L228-L233 | train | Has old input | [
30522,
2270,
3853,
2038,
11614,
2378,
18780,
1006,
1002,
3145,
1027,
19701,
1007,
1063,
1002,
2214,
1027,
1002,
2023,
1011,
1028,
2131,
11614,
2378,
18780,
1006,
1002,
3145,
1007,
1025,
2709,
2003,
1035,
19701,
1006,
1002,
3145,
1007,
1029,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Optional.php | Optional.offsetExists | public function offsetExists($key)
{
return Arr::accessible($this->value) && Arr::exists($this->value, $key);
} | php | public function offsetExists($key)
{
return Arr::accessible($this->value) && Arr::exists($this->value, $key);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"key",
")",
"{",
"return",
"Arr",
"::",
"accessible",
"(",
"$",
"this",
"->",
"value",
")",
"&&",
"Arr",
"::",
"exists",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"key",
")",
";",
"}"
] | Determine if an item exists at an offset.
@param mixed $key
@return bool | [
"Determine",
"if",
"an",
"item",
"exists",
"at",
"an",
"offset",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Optional.php#L70-L73 | train | ArrayAccess Exists Return true if value exists | [
30522,
2270,
3853,
16396,
10288,
5130,
1006,
1002,
3145,
1007,
1063,
2709,
12098,
2099,
1024,
1024,
7801,
1006,
1002,
2023,
1011,
1028,
3643,
1007,
1004,
1004,
12098,
2099,
1024,
1024,
6526,
1006,
1002,
2023,
1011,
1028,
3643,
1010,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/User/FlexUser/User.php | User.set | public function set($name, $value, $separator = null)
{
$this->setNestedProperty($name, $value, $separator);
return $this;
} | php | public function set($name, $value, $separator = null)
{
$this->setNestedProperty($name, $value, $separator);
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"separator",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setNestedProperty",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"separator",
")",
";",
"return",
"$",
"this",
";"... | Set value by using dot notation for nested arrays/objects.
@example $data->set('this.is.my.nested.variable', $value);
@param string $name Dot separated path to the requested value.
@param mixed $value New value.
@param string $separator Separator, defaults to '.'
@return $this | [
"Set",
"value",
"by",
"using",
"dot",
"notation",
"for",
"nested",
"arrays",
"/",
"objects",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L116-L121 | train | Set a nested property of the page | [
30522,
2270,
3853,
2275,
1006,
1002,
2171,
1010,
1002,
3643,
1010,
1002,
19802,
25879,
2953,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
5267,
3064,
21572,
4842,
3723,
1006,
1002,
2171,
1010,
1002,
3643,
1010,
1002,
19802,
25879,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileIntegrity.php | FileIntegrity.getDirectoriesFoundButNotExpected | protected static function getDirectoriesFoundButNotExpected()
{
static $cache = null;
if(!is_null($cache)) {
return $cache;
}
$pluginsInManifest = self::getPluginsFoundInManifest();
$directoriesInManifest = self::getDirectoriesFoundInManifest();
$directoriesFoundButNotExpected = array();
foreach (self::getPathsToInvestigate() as $file) {
$file = substr($file, strlen(PIWIK_DOCUMENT_ROOT)); // remove piwik path to match format in manifest.inc.php
$file = ltrim($file, "\\/");
$directory = dirname($file);
if(in_array($directory, $directoriesInManifest)) {
continue;
}
if (self::isFileNotInManifestButExpectedAnyway($file)) {
continue;
}
if (self::isFileFromPluginNotInManifest($file, $pluginsInManifest)) {
continue;
}
if (!in_array($directory, $directoriesFoundButNotExpected)) {
$directoriesFoundButNotExpected[] = $directory;
}
}
$cache = self::getParentDirectoriesFromListOfDirectories($directoriesFoundButNotExpected);
return $cache;
} | php | protected static function getDirectoriesFoundButNotExpected()
{
static $cache = null;
if(!is_null($cache)) {
return $cache;
}
$pluginsInManifest = self::getPluginsFoundInManifest();
$directoriesInManifest = self::getDirectoriesFoundInManifest();
$directoriesFoundButNotExpected = array();
foreach (self::getPathsToInvestigate() as $file) {
$file = substr($file, strlen(PIWIK_DOCUMENT_ROOT)); // remove piwik path to match format in manifest.inc.php
$file = ltrim($file, "\\/");
$directory = dirname($file);
if(in_array($directory, $directoriesInManifest)) {
continue;
}
if (self::isFileNotInManifestButExpectedAnyway($file)) {
continue;
}
if (self::isFileFromPluginNotInManifest($file, $pluginsInManifest)) {
continue;
}
if (!in_array($directory, $directoriesFoundButNotExpected)) {
$directoriesFoundButNotExpected[] = $directory;
}
}
$cache = self::getParentDirectoriesFromListOfDirectories($directoriesFoundButNotExpected);
return $cache;
} | [
"protected",
"static",
"function",
"getDirectoriesFoundButNotExpected",
"(",
")",
"{",
"static",
"$",
"cache",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"cache",
")",
")",
"{",
"return",
"$",
"cache",
";",
"}",
"$",
"pluginsInManifest",
"=",
... | Look for whole directories which are in the filesystem, but should not be
@return array | [
"Look",
"for",
"whole",
"directories",
"which",
"are",
"in",
"the",
"filesystem",
"but",
"should",
"not",
"be"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/FileIntegrity.php#L161-L195 | train | Returns the directories found but not expected | [
30522,
5123,
10763,
3853,
2131,
4305,
2890,
16761,
3111,
14876,
8630,
8569,
2102,
22074,
2595,
5051,
10985,
1006,
1007,
1063,
10763,
1002,
17053,
1027,
19701,
1025,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
17053,
1007,
1007,
1063,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php | HidesAttributes.addHidden | public function addHidden($attributes = null)
{
$this->hidden = array_merge(
$this->hidden, is_array($attributes) ? $attributes : func_get_args()
);
} | php | public function addHidden($attributes = null)
{
$this->hidden = array_merge(
$this->hidden, is_array($attributes) ? $attributes : func_get_args()
);
} | [
"public",
"function",
"addHidden",
"(",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"hidden",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"hidden",
",",
"is_array",
"(",
"$",
"attributes",
")",
"?",
"$",
"attributes",
":",
"func_get_args... | Add hidden attributes for the model.
@param array|string|null $attributes
@return void | [
"Add",
"hidden",
"attributes",
"for",
"the",
"model",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php#L50-L55 | train | Add hidden attributes to the hidden list | [
30522,
2270,
3853,
5587,
27511,
4181,
1006,
1002,
12332,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
5023,
1027,
9140,
1035,
13590,
1006,
1002,
2023,
1011,
1028,
5023,
1010,
2003,
1035,
9140,
1006,
1002,
12332,
1007,
1029,
1002,
12332,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Work/User/Client.php | Client.getDepartmentUsers | public function getDepartmentUsers(int $departmentId, bool $fetchChild = false)
{
$params = [
'department_id' => $departmentId,
'fetch_child' => (int) $fetchChild,
];
return $this->httpGet('cgi-bin/user/simplelist', $params);
} | php | public function getDepartmentUsers(int $departmentId, bool $fetchChild = false)
{
$params = [
'department_id' => $departmentId,
'fetch_child' => (int) $fetchChild,
];
return $this->httpGet('cgi-bin/user/simplelist', $params);
} | [
"public",
"function",
"getDepartmentUsers",
"(",
"int",
"$",
"departmentId",
",",
"bool",
"$",
"fetchChild",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"[",
"'department_id'",
"=>",
"$",
"departmentId",
",",
"'fetch_child'",
"=>",
"(",
"int",
")",
"$",
"f... | Get simple user list.
@param int $departmentId
@param bool $fetchChild
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string | [
"Get",
"simple",
"user",
"list",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Work/User/Client.php#L96-L104 | train | Get all users of a given department | [
30522,
2270,
3853,
2131,
3207,
19362,
21181,
20330,
2015,
1006,
20014,
1002,
2533,
3593,
1010,
22017,
2140,
1002,
18584,
19339,
1027,
6270,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
2533,
1035,
8909,
1005,
1027,
1028,
1002,
2533,
359... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Session/FileSessionHandler.php | FileSessionHandler.gc | public function gc($lifetime)
{
$files = Finder::create()
->in($this->path)
->files()
->ignoreDotFiles(true)
->date('<= now - '.$lifetime.' seconds');
foreach ($files as $file) {
$this->files->delete($file->getRealPath());
}
} | php | public function gc($lifetime)
{
$files = Finder::create()
->in($this->path)
->files()
->ignoreDotFiles(true)
->date('<= now - '.$lifetime.' seconds');
foreach ($files as $file) {
$this->files->delete($file->getRealPath());
}
} | [
"public",
"function",
"gc",
"(",
"$",
"lifetime",
")",
"{",
"$",
"files",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"in",
"(",
"$",
"this",
"->",
"path",
")",
"->",
"files",
"(",
")",
"->",
"ignoreDotFiles",
"(",
"true",
")",
"->",
"date",
"... | {@inheritdoc} | [
"{"
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/FileSessionHandler.php#L101-L112 | train | Remove all files in the current directory that are older than the given time | [
30522,
2270,
3853,
1043,
2278,
1006,
1002,
6480,
1007,
1063,
1002,
6764,
1027,
2424,
2121,
1024,
1024,
3443,
1006,
1007,
1011,
1028,
1999,
1006,
1002,
2023,
1011,
1028,
4130,
1007,
1011,
1028,
6764,
1006,
1007,
1011,
1028,
6439,
4140,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BasicService/Jssdk/Client.php | Client.getTicketSignature | public function getTicketSignature($ticket, $nonce, $timestamp, $url): string
{
return sha1(sprintf('jsapi_ticket=%s&noncestr=%s×tamp=%s&url=%s', $ticket, $nonce, $timestamp, $url));
} | php | public function getTicketSignature($ticket, $nonce, $timestamp, $url): string
{
return sha1(sprintf('jsapi_ticket=%s&noncestr=%s×tamp=%s&url=%s', $ticket, $nonce, $timestamp, $url));
} | [
"public",
"function",
"getTicketSignature",
"(",
"$",
"ticket",
",",
"$",
"nonce",
",",
"$",
"timestamp",
",",
"$",
"url",
")",
":",
"string",
"{",
"return",
"sha1",
"(",
"sprintf",
"(",
"'jsapi_ticket=%s&noncestr=%s×tamp=%s&url=%s'",
",",
"$",
"ticket",
... | Sign the params.
@param string $ticket
@param string $nonce
@param int $timestamp
@param string $url
@return string | [
"Sign",
"the",
"params",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/BasicService/Jssdk/Client.php#L151-L154 | train | Returns a signature of a JS API ticket | [
30522,
2270,
3853,
2131,
26348,
8454,
23773,
4017,
5397,
1006,
1002,
7281,
1010,
1002,
2512,
3401,
1010,
1002,
2335,
15464,
2361,
1010,
1002,
24471,
2140,
1007,
1024,
5164,
1063,
2709,
21146,
2487,
1006,
9043,
2546,
1006,
1005,
1046,
3736,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.whereNotBetween | public function whereNotBetween($column, array $values, $boolean = 'and')
{
return $this->whereBetween($column, $values, $boolean, true);
} | php | public function whereNotBetween($column, array $values, $boolean = 'and')
{
return $this->whereBetween($column, $values, $boolean, true);
} | [
"public",
"function",
"whereNotBetween",
"(",
"$",
"column",
",",
"array",
"$",
"values",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"return",
"$",
"this",
"->",
"whereBetween",
"(",
"$",
"column",
",",
"$",
"values",
",",
"$",
"boolean",
",",
"true"... | Add a where not between statement to the query.
@param string $column
@param array $values
@param string $boolean
@return \Illuminate\Database\Query\Builder|static | [
"Add",
"a",
"where",
"not",
"between",
"statement",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1076-L1079 | train | Add a where not between clause to the query. | [
30522,
2270,
3853,
2073,
17048,
20915,
28394,
2078,
1006,
1002,
5930,
1010,
9140,
1002,
5300,
1010,
1002,
22017,
20898,
1027,
1005,
1998,
1005,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2073,
20915,
28394,
2078,
1006,
1002,
5930,
1010,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/RouteCompiler.php | RouteCompiler.compile | public static function compile(Route $route)
{
$hostVariables = [];
$variables = [];
$hostRegex = null;
$hostTokens = [];
if ('' !== $host = $route->getHost()) {
$result = self::compilePattern($route, $host, true);
$hostVariables = $result['variables'];
$variables = $hostVariables;
$hostTokens = $result['tokens'];
$hostRegex = $result['regex'];
}
$path = $route->getPath();
$result = self::compilePattern($route, $path, false);
$staticPrefix = $result['staticPrefix'];
$pathVariables = $result['variables'];
foreach ($pathVariables as $pathParam) {
if ('_fragment' === $pathParam) {
throw new \InvalidArgumentException(sprintf('Route pattern "%s" cannot contain "_fragment" as a path parameter.', $route->getPath()));
}
}
$variables = array_merge($variables, $pathVariables);
$tokens = $result['tokens'];
$regex = $result['regex'];
return new CompiledRoute(
$staticPrefix,
$regex,
$tokens,
$pathVariables,
$hostRegex,
$hostTokens,
$hostVariables,
array_unique($variables)
);
} | php | public static function compile(Route $route)
{
$hostVariables = [];
$variables = [];
$hostRegex = null;
$hostTokens = [];
if ('' !== $host = $route->getHost()) {
$result = self::compilePattern($route, $host, true);
$hostVariables = $result['variables'];
$variables = $hostVariables;
$hostTokens = $result['tokens'];
$hostRegex = $result['regex'];
}
$path = $route->getPath();
$result = self::compilePattern($route, $path, false);
$staticPrefix = $result['staticPrefix'];
$pathVariables = $result['variables'];
foreach ($pathVariables as $pathParam) {
if ('_fragment' === $pathParam) {
throw new \InvalidArgumentException(sprintf('Route pattern "%s" cannot contain "_fragment" as a path parameter.', $route->getPath()));
}
}
$variables = array_merge($variables, $pathVariables);
$tokens = $result['tokens'];
$regex = $result['regex'];
return new CompiledRoute(
$staticPrefix,
$regex,
$tokens,
$pathVariables,
$hostRegex,
$hostTokens,
$hostVariables,
array_unique($variables)
);
} | [
"public",
"static",
"function",
"compile",
"(",
"Route",
"$",
"route",
")",
"{",
"$",
"hostVariables",
"=",
"[",
"]",
";",
"$",
"variables",
"=",
"[",
"]",
";",
"$",
"hostRegex",
"=",
"null",
";",
"$",
"hostTokens",
"=",
"[",
"]",
";",
"if",
"(",
... | {@inheritdoc}
@throws \InvalidArgumentException if a path variable is named _fragment
@throws \LogicException if a variable is referenced more than once
@throws \DomainException if a variable name starts with a digit or if it is too long to be successfully used as
a PCRE subpattern | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCompiler.php#L47-L93 | train | Compiles a route into a CompiledRoute object. | [
30522,
2270,
10763,
3853,
4012,
22090,
1006,
2799,
1002,
2799,
1007,
1063,
1002,
3677,
10755,
19210,
2015,
1027,
1031,
1033,
1025,
1002,
10857,
1027,
1031,
1033,
1025,
1002,
3677,
2890,
3351,
2595,
1027,
19701,
1025,
1002,
3677,
18715,
6132... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Select.php | Zend_Db_Select._renderFrom | protected function _renderFrom($sql)
{
/*
* If no table specified, use RDBMS-dependent solution
* for table-less query. e.g. DUAL in Oracle.
*/
if (empty($this->_parts[self::FROM])) {
$this->_parts[self::FROM] = $this->_getDummyTable();
}
$from = array();
foreach ($this->_parts[self::FROM] as $correlationName => $table) {
$tmp = '';
$joinType = ($table['joinType'] == self::FROM) ? self::INNER_JOIN : $table['joinType'];
// Add join clause (if applicable)
if (! empty($from)) {
$tmp .= ' ' . strtoupper($joinType) . ' ';
}
$tmp .= $this->_getQuotedSchema($table['schema']);
$tmp .= $this->_getQuotedTable($table['tableName'], $correlationName);
// Add join conditions (if applicable)
if (!empty($from) && ! empty($table['joinCondition'])) {
$tmp .= ' ' . self::SQL_ON . ' ' . $table['joinCondition'];
}
// Add the table name and condition add to the list
$from[] = $tmp;
}
// Add the list of all joins
if (!empty($from)) {
$sql .= ' ' . self::SQL_FROM . ' ' . implode("\n", $from);
}
return $sql;
} | php | protected function _renderFrom($sql)
{
/*
* If no table specified, use RDBMS-dependent solution
* for table-less query. e.g. DUAL in Oracle.
*/
if (empty($this->_parts[self::FROM])) {
$this->_parts[self::FROM] = $this->_getDummyTable();
}
$from = array();
foreach ($this->_parts[self::FROM] as $correlationName => $table) {
$tmp = '';
$joinType = ($table['joinType'] == self::FROM) ? self::INNER_JOIN : $table['joinType'];
// Add join clause (if applicable)
if (! empty($from)) {
$tmp .= ' ' . strtoupper($joinType) . ' ';
}
$tmp .= $this->_getQuotedSchema($table['schema']);
$tmp .= $this->_getQuotedTable($table['tableName'], $correlationName);
// Add join conditions (if applicable)
if (!empty($from) && ! empty($table['joinCondition'])) {
$tmp .= ' ' . self::SQL_ON . ' ' . $table['joinCondition'];
}
// Add the table name and condition add to the list
$from[] = $tmp;
}
// Add the list of all joins
if (!empty($from)) {
$sql .= ' ' . self::SQL_FROM . ' ' . implode("\n", $from);
}
return $sql;
} | [
"protected",
"function",
"_renderFrom",
"(",
"$",
"sql",
")",
"{",
"/*\n * If no table specified, use RDBMS-dependent solution\n * for table-less query. e.g. DUAL in Oracle.\n */",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_parts",
"[",
"self",
"::",... | Render FROM clause
@param string $sql SQL query
@return string | [
"Render",
"FROM",
"clause"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L1103-L1143 | train | Render from part of query | [
30522,
5123,
3853,
1035,
17552,
19699,
5358,
1006,
1002,
29296,
1007,
1063,
1013,
1008,
1008,
2065,
2053,
2795,
9675,
1010,
2224,
16428,
25526,
2015,
1011,
7790,
5576,
1008,
2005,
2795,
1011,
2625,
23032,
1012,
1041,
1012,
1043,
1012,
7037,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.