_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q254800 | Config.get | test | public static function get(string $name, bool $getShared = true)
{
$class = $name;
if (($pos = strrpos($name, '\\')) !== false)
{
$class = substr($name, $pos + 1);
}
if (! $getShared)
{
| php | {
"resource": ""
} |
q254801 | Config.createClass | test | private static function createClass(string $name)
{
if (class_exists($name))
{
return new $name();
}
$locator = Services::locator();
$file = $locator->locateFile($name, 'Config');
if (empty($file))
{
| php | {
"resource": ""
} |
q254802 | BaseService.getSharedInstance | test | protected static function getSharedInstance(string $key, ...$params)
{
// Returns mock if exists
if (isset(static::$mocks[$key]))
{
return static::$mocks[$key];
}
if (! isset(static::$instances[$key]))
{
// Make sure | php | {
"resource": ""
} |
q254803 | BaseService.autoloader | test | public static function autoloader(bool $getShared = true)
{
if ($getShared)
{
if (empty(static::$instances['autoloader']))
{
static::$instances['autoloader'] | php | {
"resource": ""
} |
q254804 | BaseService.locator | test | public static function locator(bool $getShared = true)
{
if ($getShared)
{
if (empty(static::$instances['locator']))
{
static::$instances['locator'] = new FileLocator(
static::autoloader()
| php | {
"resource": ""
} |
q254805 | BaseService.reset | test | public static function reset(bool $init_autoloader = false)
{
static::$mocks = [];
| php | {
"resource": ""
} |
q254806 | BaseService.injectMock | test | public static function injectMock(string $name, $mock)
{
$name | php | {
"resource": ""
} |
q254807 | BaseService.discoverServices | test | protected static function discoverServices(string $name, array $arguments)
{
if (! static::$discovered)
{
$config = config('Modules');
if ($config->shouldDiscover('services'))
{
$locator = static::locator();
$files = $locator->search('Config/Services');
if (empty($files))
{
// no ... | php | {
"resource": ""
} |
q254808 | CLI.input | test | public static function input(string $prefix = null): string
{
if (static::$readline_support) | php | {
"resource": ""
} |
q254809 | CLI.prompt | test | public static function prompt(string $field, $options = null, string $validation = null): string
{
$extra_output = '';
$default = '';
if (is_string($options))
{
$extra_output = ' [' . static::color($options, 'white') . ']';
$default = $options;
}
if (is_array($options) && $options)
{
... | php | {
"resource": ""
} |
q254810 | CLI.validate | test | protected static function validate(string $field, string $value, string $rules): bool
{
$validation = \Config\Services::validation(null, false);
$validation->setRule($field, null, $rules);
$validation->run([$field => | php | {
"resource": ""
} |
q254811 | CLI.print | test | public static function print(string $text = '', string $foreground = null, string $background = null)
{
if ($foreground || $background)
{
| php | {
"resource": ""
} |
q254812 | CLI.error | test | public static function error(string $text, string $foreground = 'light_red', string $background = null)
| php | {
"resource": ""
} |
q254813 | CLI.wait | test | public static function wait(int $seconds, bool $countdown = false)
{
if ($countdown === true)
{
$time = $seconds;
while ($time > 0)
{
fwrite(STDOUT, $time . '... ');
sleep(1);
$time --;
}
static::write();
}
else
{
if ($seconds > 0)
{
sleep($seconds);
| php | {
"resource": ""
} |
q254814 | CLI.color | test | public static function color(string $text, string $foreground, string $background = null, string $format = null): string
{
if (static::isWindows() && ! isset($_SERVER['ANSICON']))
{
// @codeCoverageIgnoreStart
return $text;
// @codeCoverageIgnoreEnd
}
if (! array_key_exists($foreground, static::$fore... | php | {
"resource": ""
} |
q254815 | CLI.wrap | test | public static function wrap(string $string = null, int $max = 0, int $pad_left = 0): string
{
if (empty($string))
{
return '';
}
if ($max === 0)
{
$max = CLI::getWidth();
}
if (CLI::getWidth() < $max)
{
$max = CLI::getWidth();
}
$max = $max - $pad_left;
$lines = wordwrap($string, $ma... | php | {
"resource": ""
} |
q254816 | CLI.getOption | test | public static function getOption(string $name)
{
if (! array_key_exists($name, static::$options))
{
return null;
}
// If the option didn't have a value, simply return TRUE
// so they know it was set, otherwise | php | {
"resource": ""
} |
q254817 | CLI.table | test | public static function table(array $tbody, array $thead = [])
{
// All the rows in the table will be here until the end
$table_rows = [];
// We need only indexes and not keys
if (! empty($thead))
{
$table_rows[] = array_values($thead);
}
foreach ($tbody as $tr)
{
$table_rows[] = array_values($t... | php | {
"resource": ""
} |
q254818 | ResponseTrait.respond | test | public function respond($data = null, int $status = null, string $message = '')
{
// If data is null and status code not provided, exit and bail
if ($data === null && $status === null)
{
$status = 404;
// Create the output var here in case of $this->response([]);
$output = null;
} // If data is null ... | php | {
"resource": ""
} |
q254819 | ResponseTrait.fail | test | public function fail($messages, int $status = 400, string $code = null, string $customMessage = '')
{
if (! is_array($messages))
{
$messages = ['error' | php | {
"resource": ""
} |
q254820 | ResponseTrait.respondCreated | test | public function respondCreated($data = null, string $message | php | {
"resource": ""
} |
q254821 | ResponseTrait.respondDeleted | test | public function respondDeleted($data = null, string $message | php | {
"resource": ""
} |
q254822 | ResponseTrait.failUnauthorized | test | public function failUnauthorized(string $description = 'Unauthorized', string $code = null, string $message = '')
{
| php | {
"resource": ""
} |
q254823 | ResponseTrait.failServerError | test | public function failServerError(string $description = 'Internal Server Error', string $code = null, string $message = ''): Response
{ | php | {
"resource": ""
} |
q254824 | CSRF.before | test | public function before(RequestInterface $request)
{
if ($request->isCLI())
{
return;
}
$security = Services::security();
try
{
$security->CSRFVerify($request);
}
catch (SecurityException $e)
{
if (config('App')->CSRFRedirect && ! | php | {
"resource": ""
} |
q254825 | Events.initialize | test | public static function initialize()
{
// Don't overwrite anything....
if (static::$initialized)
{
return;
}
$config = config('Modules');
$files = [APPPATH . 'Config/Events.php'];
if ($config->shouldDiscover('events'))
{
$locator = Services::locator();
$files | php | {
"resource": ""
} |
q254826 | Events.listeners | test | public static function listeners($event_name): array
{
if (! isset(static::$listeners[$event_name]))
{
return [];
}
// The list is not sorted
if (! static::$listeners[$event_name][0])
{
// Sort it! | php | {
"resource": ""
} |
q254827 | Events.removeListener | test | public static function removeListener($event_name, callable $listener): bool
{
if (! isset(static::$listeners[$event_name]))
{
return false;
}
foreach (static::$listeners[$event_name][2] as $index => $check)
{
if ($check === $listener)
{ | php | {
"resource": ""
} |
q254828 | UserAgent.isReferral | test | public function isReferral(): bool
{
if (! isset($this->referrer))
{
if (empty($_SERVER['HTTP_REFERER']))
{
$this->referrer = false;
}
else
{
$referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
$own_host | php | {
"resource": ""
} |
q254829 | UserAgent.setPlatform | test | protected function setPlatform(): bool
{
if (is_array($this->config->platforms) && $this->config->platforms)
{
foreach ($this->config->platforms as $key => $val)
{
if (preg_match('|' . preg_quote($key) . '|i', | php | {
"resource": ""
} |
q254830 | UserAgent.setBrowser | test | protected function setBrowser(): bool
{
if (is_array($this->config->browsers) && $this->config->browsers)
{
foreach ($this->config->browsers as $key => $val)
{
if (preg_match('|' . $key . '.*?([0-9\.]+)|i', $this->agent, $match))
{
| php | {
"resource": ""
} |
q254831 | UserAgent.setRobot | test | protected function setRobot(): bool
{
if (is_array($this->config->robots) && $this->config->robots)
{
foreach ($this->config->robots as $key => $val)
{
if (preg_match('|' . preg_quote($key) . '|i', $this->agent))
| php | {
"resource": ""
} |
q254832 | UserAgent.setMobile | test | protected function setMobile(): bool
{
if (is_array($this->config->mobiles) && $this->config->mobiles)
{
foreach ($this->config->mobiles as $key => $val)
{
if (false !== (stripos($this->agent, $key)))
| php | {
"resource": ""
} |
q254833 | Forge._attributeType | test | protected function _attributeType(array &$attributes)
{
// Reset field lengths for data types that don't support it
if (isset($attributes['CONSTRAINT']) && stripos($attributes['TYPE'], 'int') !== false)
{
$attributes['CONSTRAINT'] = null;
}
switch (strtoupper($attributes['TYPE']))
{
case 'TINYINT':
... | php | {
"resource": ""
} |
q254834 | Kernel.initializeConfig | test | private function initializeConfig()
{
if (!is_dir($this->vbot->config['path'])) {
mkdir($this->vbot->config['path'], 0755, true);
}
| php | {
"resource": ""
} |
q254835 | QrCode.show | test | public function show($text)
{
if (!array_get($this->config, 'qrcode', true)) {
return false;
}
$output = new ConsoleOutput();
static::initQrcodeStyle($output);
$pxMap[0] = Console::isWin() ? '<whitec>mm</whitec>' : '<whitec> </whitec>';
| php | {
"resource": ""
} |
q254836 | QrCode.initQrcodeStyle | test | private static function initQrcodeStyle(OutputInterface $output)
{
$style = new OutputFormatterStyle('black', 'black', ['bold']);
$output->getFormatter()->setStyle('blackc', $style);
| php | {
"resource": ""
} |
q254837 | Content.formatContent | test | public static function formatContent($content)
{
$content = self::emojiHandle($content);
$content | php | {
"resource": ""
} |
q254838 | MessageHandler.heartbeat | test | private function heartbeat($time)
{
if (time() - $time > 1800) {
Text::send('filehelper', 'heart beat | php | {
"resource": ""
} |
q254839 | MessageHandler.handleCheckSync | test | public function handleCheckSync($retCode, $selector, $test = false)
{
if (in_array($retCode, [1100, 1101, 1102, 1205])) { // 微信客户端上登出或者其他设备登录
$this->vbot->console->log('vbot exit normally.');
$this->vbot->cache->forget('session.'.$this->vbot->config['session']);
return ... | php | {
"resource": ""
} |
q254840 | MessageHandler.log | test | private function log($message)
{
if ($this->vbot->messageLog && ($message['ModContactList'] || | php | {
"resource": ""
} |
q254841 | Server.getUuid | test | protected function getUuid()
{
$content = $this->vbot->http->get('https://login.weixin.qq.com/jslogin', ['query' => [
'appid' => 'wx782c26e4c19acffb',
'fun' => 'new',
'lang' => 'zh_CN',
'_' => time(),
]]);
| php | {
"resource": ""
} |
q254842 | Server.showQrCode | test | public function showQrCode()
{
$url = 'https://login.weixin.qq.com/l/'.$this->vbot->config['server.uuid'];
| php | {
"resource": ""
} |
q254843 | Server.waitForLogin | test | protected function waitForLogin()
{
$retryTime = 10;
$tip = 1;
$this->vbot->console->log('please scan the qrCode with wechat.');
while ($retryTime > 0) {
$url = sprintf('https://login.weixin.qq.com/cgi-bin/mmwebwx-bin/login?tip=%s&uuid=%s&_=%s', $tip, $this->vbot->config... | php | {
"resource": ""
} |
q254844 | Server.getLogin | test | private function getLogin()
{
$content = $this->vbot->http->get($this->vbot->config['server.uri.redirect']);
$data = (array) simplexml_load_string($content, 'SimpleXMLElement', LIBXML_NOCDATA);
$this->vbot->config['server.skey'] = $data['skey'];
$this->vbot->config['server.sid'] = ... | php | {
"resource": ""
} |
q254845 | Server.saveServer | test | private function saveServer()
{
$this->vbot->cache->forever('session.'.$this->vbot->config['session'], | php | {
"resource": ""
} |
q254846 | Server.beforeInitSuccess | test | private function beforeInitSuccess()
{
$this->vbot->console->log('current session: '.$this->vbot->config['session']); | php | {
"resource": ""
} |
q254847 | Server.afterInitSuccess | test | private function afterInitSuccess($content)
{
$this->vbot->log->info('response:'.json_encode($content));
$this->vbot->console->log('init success.');
| php | {
"resource": ""
} |
q254848 | Server.statusNotify | test | protected function statusNotify()
{
$url = sprintf($this->vbot->config['server.uri.base'].'/webwxstatusnotify?lang=zh_CN&pass_ticket=%s', $this->vbot->config['server.passTicket']);
$this->vbot->http->json($url, [
'BaseRequest' => $this->vbot->config['server.baseRequest'],
'... | php | {
"resource": ""
} |
q254849 | Multimedia.download | test | public static function download($message, $callback = null)
{
if (!$callback) {
static::autoDownload($message['raw'], true);
return true;
}
if ($callback && !is_callable($callback)) {
| php | {
"resource": ""
} |
q254850 | Multimedia.getResource | test | private static function getResource($message)
{
$url = static::getDownloadUrl($message);
$content = vbot('http')->get($url, static::getDownloadOption($message));
if (!$content) {
| php | {
"resource": ""
} |
q254851 | Multimedia.autoDownload | test | protected static function autoDownload($message, $force = false)
{
$isDownload = vbot('config')['download.'.static::TYPE];
if ($isDownload || $force) {
$resource = static::getResource($message);
if ($resource) {
| php | {
"resource": ""
} |
q254852 | Sync.checkSync | test | public function checkSync()
{
$content = $this->vbot->http->get($this->vbot->config['server.uri.push'].'/synccheck', ['timeout' => 35, 'query' => [
'r' => time(),
'sid' => $this->vbot->config['server.sid'],
'uin' => $this->vbot->config['server.uin'],
... | php | {
"resource": ""
} |
q254853 | Sync.sync | test | public function sync()
{
$url = sprintf($this->vbot->config['server.uri.base'].'/webwxsync?sid=%s&skey=%s&lang=zh_CN&pass_ticket=%s',
$this->vbot->config['server.sid'],
$this->vbot->config['server.skey'],
$this->vbot->config['server.passTicket']
);
$resul... | php | {
"resource": ""
} |
q254854 | Sync.generateSyncKey | test | public function generateSyncKey($result)
{
$this->vbot->config['server.syncKey'] = $result['SyncKey'];
$syncKey = [];
if (is_array($this->vbot->config['server.syncKey.List'])) {
foreach ($this->vbot->config['server.syncKey.List'] as $item) {
$syncKey[] = | php | {
"resource": ""
} |
q254855 | Console.log | test | public function log($str, $level = 'INFO', $log = false)
{
if ($this->isOutput()) {
if ($log && in_array($level, array_keys(Logger::getLevels()))) { | php | {
"resource": ""
} |
q254856 | Console.message | test | public function message($str)
{
if (array_get($this->config, 'message', | php | {
"resource": ""
} |
q254857 | Text.send | test | public static function send($username, $word)
{
if (!$word || !$username) {
return false;
}
return static::sendMsg([
'Type' => 1,
'Content' => $word,
| php | {
"resource": ""
} |
q254858 | ContactFactory.fetchAllContacts | test | public function fetchAllContacts($seq = 0)
{
$url = sprintf($this->vbot->config['server.uri.base'].'/webwxgetcontact?pass_ticket=%s&skey=%s&r=%s&seq=%s',
$this->vbot->config['server.passTicket'],
$this->vbot->config['server.skey'],
| php | {
"resource": ""
} |
q254859 | ContactFactory.store | test | public function store($memberList)
{
foreach ($memberList as $contact) {
if (in_array($contact['UserName'], static::SPECIAL_USERS)) {
$this->vbot->specials->put($contact['UserName'], $contact);
} elseif ($this->vbot->officials->isOfficial($contact['VerifyFlag'])) {
... | php | {
"resource": ""
} |
q254860 | ContactFactory.fetchGroupMembers | test | public function fetchGroupMembers()
{
$url = sprintf($this->vbot->config['server.uri.base'].'/webwxbatchgetcontact?type=ex&r=%s&pass_ticket=%s',
time(), $this->vbot->config['server.passTicket']
);
$list = [];
$this->vbot->groups->each(function ($item, $key) use (&$list) ... | php | {
"resource": ""
} |
q254861 | ContactFactory.storeMembers | test | private function storeMembers($array)
{
if (isset($array['ContactList']) && $array['ContactList']) {
foreach ($array['ContactList'] as $group) {
$groupAccount = $this->vbot->groups->get($group['UserName']);
$groupAccount['MemberList'] = $group['MemberList'];
... | php | {
"resource": ""
} |
q254862 | ExceptionHandler.report | test | public function report(Exception $e)
{
if ($this->shouldntReport($e)) {
| php | {
"resource": ""
} |
q254863 | ExceptionHandler.throwFatalException | test | private function throwFatalException(Throwable $e)
{
foreach ($this->fatalException as $exception) {
if ($e instanceof | php | {
"resource": ""
} |
q254864 | OpenSSL.validateKey | test | private function validateKey($key): void
{
if (! is_resource($key)) {
throw new InvalidArgumentException(
'It was not possible to parse your key, reason: ' . openssl_error_string()
);
}
$details = openssl_pkey_get_details($key);
| php | {
"resource": ""
} |
q254865 | Parser.splitJwt | test | private function splitJwt(string $jwt): array
{
$data = explode('.', $jwt);
if (count($data) !== 3) {
throw new | php | {
"resource": ""
} |
q254866 | Parser.parseHeader | test | private function parseHeader(string $data): array
{
$header = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));
if (! is_array($header)) {
throw new InvalidArgumentException('Headers must be an array');
}
if (isset($header['enc'])) {
| php | {
"resource": ""
} |
q254867 | Parser.parseClaims | test | private function parseClaims(string $data): array
{
$claims = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));
if (! is_array($claims)) {
throw new InvalidArgumentException('Claims must be an array');
}
if (isset($claims[RegisteredClaims::AUDIENCE])) ... | php | {
"resource": ""
} |
q254868 | Parser.parseSignature | test | private function parseSignature(array $header, string $data): Signature
{
if ($data === '' || ! isset($header['alg']) || $header['alg'] === 'none') {
return Signature::fromEmptyData();
}
| php | {
"resource": ""
} |
q254869 | LanguageNegotiator.negotiateLanguage | test | public function negotiateLanguage()
{
$matches = $this->getMatchesFromAcceptedLanguages();
foreach ($matches as $key => $q) {
$key = ($this->configRepository->get('laravellocalization.localesMapping')[$key]) ?? $key;
if (!empty($this->supportedLanguages[$key])) {
... | php | {
"resource": ""
} |
q254870 | LanguageNegotiator.getMatchesFromAcceptedLanguages | test | private function getMatchesFromAcceptedLanguages()
{
$matches = [];
if ($acceptLanguages = $this->request->header('Accept-Language')) {
$acceptLanguages = explode(',', $acceptLanguages);
$generic_matches = [];
foreach ($acceptLanguages as $option) {
... | php | {
"resource": ""
} |
q254871 | RouteTranslationsCacheCommand.cacheRoutesPerLocale | test | protected function cacheRoutesPerLocale()
{
// Store the default routes cache,
// this way the Application will detect that routes are cached.
$allLocales = $this->getSupportedLocales();
array_push($allLocales, null);
foreach ($allLocales as $locale) {
$routes ... | php | {
"resource": ""
} |
q254872 | RouteTranslationsCacheCommand.buildRouteCacheFile | test | protected function buildRouteCacheFile(RouteCollection $routes)
{
$stub = $this->files->get(
realpath(
__DIR__
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARA... | php | {
"resource": ""
} |
q254873 | LaravelLocalizationServiceProvider.registerBindings | test | protected function registerBindings()
{
$this->app->singleton(LaravelLocalization::class, function () { | php | {
"resource": ""
} |
q254874 | LaravelLocalizationServiceProvider.registerCommands | test | protected function registerCommands()
{
$this->app->singleton('laravellocalizationroutecache.cache', Commands\RouteTranslationsCacheCommand::class);
$this->app->singleton('laravellocalizationroutecache.clear', Commands\RouteTranslationsClearCommand::class);
$this->app->singleton('laravelloca... | php | {
"resource": ""
} |
q254875 | LaravelLocalization.setLocale | test | public function setLocale($locale = null)
{
if (empty($locale) || !\is_string($locale)) {
// If the locale has not been passed through the function
// it tries to get it from the first segment of the url
$locale = $this->request->segment(1);
// If the locale ... | php | {
"resource": ""
} |
q254876 | LaravelLocalization.getURLFromRouteNameTranslated | test | public function getURLFromRouteNameTranslated($locale, $transKeyName, $attributes = [], $forceDefaultLocation = false)
{
if (!$this->checkLocaleInSupportedLocales($locale)) {
throw new UnsupportedLocaleException('Locale \''.$locale.'\' is not in the list of supported locales.');
}
... | php | {
"resource": ""
} |
q254877 | LaravelLocalization.getSupportedLocales | test | public function getSupportedLocales()
{
if (!empty($this->supportedLocales)) {
return $this->supportedLocales;
}
$locales = $this->configRepository->get('laravellocalization.supportedLocales');
if (empty($locales) || !\is_array($locales)) {
| php | {
"resource": ""
} |
q254878 | LaravelLocalization.getLocalesOrder | test | public function getLocalesOrder()
{
$locales = $this->getSupportedLocales();
$order = $this->configRepository->get('laravellocalization.localesOrder');
uksort($locales, function ($a, $b) use ($order) {
$pos_a = array_search($a, $order);
| php | {
"resource": ""
} |
q254879 | LaravelLocalization.getCurrentLocaleDirection | test | public function getCurrentLocaleDirection()
{
if (!empty($this->supportedLocales[$this->getCurrentLocale()]['dir'])) {
return $this->supportedLocales[$this->getCurrentLocale()]['dir'];
}
switch ($this->getCurrentLocaleScript()) {
// Other (historic) RTL scripts exist... | php | {
"resource": ""
} |
q254880 | LaravelLocalization.getCurrentLocale | test | public function getCurrentLocale()
{
if ($this->currentLocale) {
return $this->currentLocale;
}
if ($this->useAcceptLanguageHeader() && !$this->app->runningInConsole()) {
| php | {
"resource": ""
} |
q254881 | LaravelLocalization.getCurrentLocaleRegional | test | public function getCurrentLocaleRegional()
{
// need to check if it exists, since 'regional' has been added
// after version 1.0.11 and existing users will not have it
if (isset($this->supportedLocales[$this->getCurrentLocale()]['regional'])) {
| php | {
"resource": ""
} |
q254882 | LaravelLocalization.checkLocaleInSupportedLocales | test | public function checkLocaleInSupportedLocales($locale)
{
$locales = $this->getSupportedLocales();
if | php | {
"resource": ""
} |
q254883 | LaravelLocalization.getRouteNameFromAPath | test | public function getRouteNameFromAPath($path)
{
$attributes = $this->extractAttributes($path);
$path = parse_url($path)['path'];
$path = trim(str_replace('/'.$this->currentLocale.'/', '', $path), "/");
foreach ($this->translatedRoutes as $route) {
| php | {
"resource": ""
} |
q254884 | LaravelLocalization.findTranslatedRouteByPath | test | protected function findTranslatedRouteByPath($path, $url_locale)
{
// check if this url is a translated url
foreach ($this->translatedRoutes as $translatedRoute) {
if ($this->translator->trans($translatedRoute, [], | php | {
"resource": ""
} |
q254885 | LaravelLocalization.findTranslatedRouteByUrl | test | protected function findTranslatedRouteByUrl($url, $attributes, $locale)
{
if (empty($url)) {
return false;
}
if (isset($this->cachedTranslatedRoutesByUrl[$locale][$url])) {
return $this->cachedTranslatedRoutesByUrl[$locale][$url];
}
// check if this ... | php | {
"resource": ""
} |
q254886 | LaravelLocalization.createUrlFromUri | test | public function createUrlFromUri($uri)
{
$uri = ltrim($uri, '/');
if (empty($this->baseUrl)) {
| php | {
"resource": ""
} |
q254887 | LaravelLocalization.normalizeAttributes | test | protected function normalizeAttributes($attributes)
{
if (array_key_exists('data', $attributes) && \is_array($attributes['data']) && | php | {
"resource": ""
} |
q254888 | LoadsTranslatedCachedRoutes.loadCachedRoutes | test | protected function loadCachedRoutes()
{
$localization = $this->getLaravelLocalization();
$localization->setLocale();
$locale = $localization->getCurrentLocale();
$localeKeys = $localization->getSupportedLanguagesKeys();
// First, try to load the routes specifically cached... | php | {
"resource": ""
} |
q254889 | LoadsTranslatedCachedRoutes.makeLocaleRoutesPath | test | protected function makeLocaleRoutesPath($locale, $localeKeys)
{
$path = $this->getDefaultCachedRoutePath();
$localeSegment = request()->segment(1);
if ( ! $localeSegment || ! in_array($localeSegment, $localeKeys)) | php | {
"resource": ""
} |
q254890 | Produce.encodeMessageSet | test | protected function encodeMessageSet(array $messages, int $compression = self::COMPRESSION_NONE): string
{
$data = '';
$next = 0;
foreach ($messages as $message) {
$encodedMessage = $this->encodeMessage($message);
$data .= self::pack(self::BIT_B64, (string) $next)
... | php | {
"resource": ""
} |
q254891 | Produce.encodeProducePartition | test | protected function encodeProducePartition(array $values, int $compression): string
{
if (! isset($values['partition_id'])) {
throw new ProtocolException('given produce data invalid. `partition_id` is undefined.');
}
if (! isset($values['messages']) || empty($values['messages']))... | php | {
"resource": ""
} |
q254892 | Produce.encodeProduceTopic | test | protected function encodeProduceTopic(array $values, int $compression): string
{
if (! isset($values['topic_name'])) {
throw new ProtocolException('given produce data invalid. `topic_name` is undefined.');
}
if (! isset($values['partitions']) || empty($values['partitions'])) {
... | php | {
"resource": ""
} |
q254893 | Produce.produceTopicPair | test | protected function produceTopicPair(string $data, int $version): array
{
$offset = 0;
$topicInfo = $this->decodeString($data, self::BIT_B16);
$offset += $topicInfo['length'];
$ret = $this->decodeArray(substr($data, $offset), [$this, 'producePartitionPair'], $version);
... | php | {
"resource": ""
} |
q254894 | Produce.producePartitionPair | test | protected function producePartitionPair(string $data, int $version): array
{
$offset = 0;
$partitionId = self::unpack(self::BIT_B32, substr($data, $offset, 4));
$offset += 4;
$errorCode = self::unpack(self::BIT_B16_SIGNED, substr($data, $offset, 2));
... | php | {
"resource": ""
} |
q254895 | Fetch.decodeMessageSet | test | protected function decodeMessageSet(string $data): ?array
{
if (strlen($data) <= 12) {
return null;
}
$offset = 0;
$roffset = self::unpack(self::BIT_B64, substr($data, $offset, 8));
$offset += 8;
$messageSize = self::unpack(self::BIT_B32, sub... | php | {
"resource": ""
} |
q254896 | Fetch.decodeMessage | test | protected function decodeMessage(string $data, int $messageSize): ?array
{
if ($messageSize === 0 || strlen($data) < $messageSize) {
return null;
}
$offset = 0;
$crc = self::unpack(self::BIT_B32, substr($data, $offset, 4));
$offset += 4;
$magic = se... | php | {
"resource": ""
} |
q254897 | CommonSocket.createSocket | test | protected function createSocket(string $remoteSocket, $context, ?int &$errno, ?string &$errstr)
{
return stream_socket_client(
$remoteSocket,
$errno,
| php | {
"resource": ""
} |
q254898 | CommonSocket.select | test | protected function select(array $sockets, int $timeoutSec, int $timeoutUsec, bool $isRead = true)
{
$null = null;
if ($isRead) {
return @stream_select($sockets, | php | {
"resource": ""
} |
q254899 | Protocol.unpack | test | public static function unpack(string $type, string $bytes)
{
self::checkLen($type, $bytes);
if ($type === self::BIT_B64) {
$set = unpack($type, $bytes);
$result = ($set[1] & 0xFFFFFFFF) << 32 | ($set[2] & 0xFFFFFFFF);
} elseif ($type === self::BIT_B16_SIGNED) {
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.