_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q26700 | Assets.copyTo | train | public function copyTo($destination)
{
foreach ($this as $source_path => $asset_path) {
if (!is_readable($source_path)) {
if ($this->logger) {
$this->logger->error('Asset "' . $source_path . '" could not be found or is not readable');
}
... | php | {
"resource": ""
} |
q26701 | StripInternal.filter | train | public function filter($value)
{
$isInternalAllowed = $this->builder->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL);
if ($isInternalAllowed) {
$value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '$1', $value->getDescription()));
return $value;
}
... | php | {
"resource": ""
} |
q26702 | Creator.getFilename | train | public function getFilename()
{
/** @var BaseConverter $converter */
$converter = $this->getDocument()->getConverter();
return $converter->getDestinationFilenameRelativeToProjectRoot($this->getDocument()->getFile());
} | php | {
"resource": ""
} |
q26703 | Creator.getFilenameWithoutExtension | train | public function getFilenameWithoutExtension()
{
$filename = $this->getDocument()->getFile()->getFilename();
return substr($filename, 0, strrpos($filename, '.'));
} | php | {
"resource": ""
} |
q26704 | Renderer.convertToRootPath | train | public function convertToRootPath($relative_path): ?string
{
// get the path to the root directory
$path_parts = explode(DIRECTORY_SEPARATOR, $this->getDestination());
$path_to_root = (count($path_parts) > 1)
? implode('/', array_fill(0, count($path_parts) - 1, '..')) . '/'
... | php | {
"resource": ""
} |
q26705 | Renderer.renderASeriesOfLinks | train | protected function renderASeriesOfLinks($value, $presentation): array
{
if ($value instanceof Collection) {
$value = $value->getAll();
}
$result = [];
foreach ($value as $path) {
$result[] = $this->render($path, $presentation);
}
return $resu... | php | {
"resource": ""
} |
q26706 | Renderer.renderTypeCollection | train | protected function renderTypeCollection($value, $presentation)
{
$baseType = $this->render($value->getBaseType(), $presentation);
$keyTypes = $this->render($value->getKeyTypes(), $presentation);
$types = $this->render($value->getTypes(), $presentation);
$arguments = [];
if (... | php | {
"resource": ""
} |
q26707 | FlySystemFactory.create | train | public function create(Dsn $dsn)
{
$dsnId = hash('md5', (string) $dsn);
try {
$filesystem = $this->mountManager->getFilesystem($dsnId);
} catch (LogicException $e) {
if ($dsn->getScheme() === 'file') {
$path = $dsn->getPath();
$filesys... | php | {
"resource": ""
} |
q26708 | ElementsIndexBuilder.getSubElements | train | protected function getSubElements(DescriptorAbstract $element): array
{
$subElements = [];
if ($element instanceof ClassInterface) {
$subElements = array_merge(
$element->getMethods()->getAll(),
$element->getConstants()->getAll(),
$element... | php | {
"resource": ""
} |
q26709 | ElementsIndexBuilder.addElementsToIndexes | train | protected function addElementsToIndexes($elements, array $indexes): void
{
if (!is_array($elements)) {
$elements = [$elements];
}
/** @var DescriptorAbstract $element */
foreach ($elements as $element) {
/** @var Collection $collection */
foreach ... | php | {
"resource": ""
} |
q26710 | Application.defineIniSettings | train | protected function defineIniSettings(): void
{
$this->setTimezone();
ini_set('memory_limit', '-1');
if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') && ini_get('opcache.enable_cli')) {
if (ini_get('opcache.save_comments')) {
ini_set('opcache.load... | php | {
"resource": ""
} |
q26711 | FunctionAssembler.addArgumentsToFunctionDescriptor | train | protected function addArgumentsToFunctionDescriptor(array $arguments, FunctionDescriptor $functionDescriptor): void
{
foreach ($arguments as $argument) {
$this->addArgumentDescriptorToFunction(
$functionDescriptor,
$this->createArgumentDescriptor($functionDescript... | php | {
"resource": ""
} |
q26712 | FunctionAssembler.addArgumentDescriptorToFunction | train | protected function addArgumentDescriptorToFunction(
FunctionDescriptor $functionDescriptor,
ArgumentDescriptor $argumentDescriptor
): void {
$functionDescriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor);
} | php | {
"resource": ""
} |
q26713 | QualifiedNameToUrlConverter.fromNamespace | train | public function fromNamespace($fqnn)
{
$name = str_replace('\\', '.', ltrim((string) $fqnn, '\\'));
// convert root namespace to default; default is a keyword and no namespace CAN be named as such
if ($name === '') {
$name = 'default';
}
return $name;
} | php | {
"resource": ""
} |
q26714 | QualifiedNameToUrlConverter.removeFileExtensionFromPath | train | private function removeFileExtensionFromPath($path)
{
if (strrpos($path, '.') !== false) {
$path = substr($path, 0, strrpos($path, '.'));
}
return $path;
} | php | {
"resource": ""
} |
q26715 | CommandlineOptionsMiddleware.disableCache | train | private function disableCache(array $configuration): array
{
if (isset($this->options['force']) && $this->options['force']) {
$configuration['phpdocumentor']['use-cache'] = false;
}
return $configuration;
} | php | {
"resource": ""
} |
q26716 | CommandlineOptionsMiddleware.overwriteTemplates | train | private function overwriteTemplates(array $configuration): array
{
if (isset($this->options['template']) && $this->options['template']) {
$configuration['phpdocumentor']['templates'] = array_map(
function ($templateName) {
return ['name' => $templateName];
... | php | {
"resource": ""
} |
q26717 | Filter.filter | train | public function filter(Filterable $descriptor): ?Filterable
{
$chain = $this->factory->getChainFor(get_class($descriptor));
return $chain->filter($descriptor);
} | php | {
"resource": ""
} |
q26718 | Collection.offsetGet | train | public function offsetGet($index)
{
if (!$this->offsetExists($index)) {
throw new Exception\FormatNotFoundException('Format ' . $index . ' is not known');
}
return parent::offsetGet($index);
} | php | {
"resource": ""
} |
q26719 | Version2.buildArrayFromNode | train | private function buildArrayFromNode(SimpleXMLElement $node): array
{
$array = [];
foreach ($node->children() as $child) {
if ((string) $child !== '') {
$array[] = (string) $child;
}
}
return $array;
} | php | {
"resource": ""
} |
q26720 | Version2.buildExtensions | train | private function buildExtensions(SimpleXMLElement $phpDocumentor): array
{
if ((array) $phpDocumentor->parser === []) {
return $this->extensions;
}
if ((array) $phpDocumentor->parser->extensions === []) {
return $this->extensions;
}
return $this->bui... | php | {
"resource": ""
} |
q26721 | Version2.buildMarkers | train | private function buildMarkers(SimpleXMLElement $phpDocumentor): array
{
if ((array) $phpDocumentor->parser === []) {
return $this->markers;
}
if ((array) $phpDocumentor->parser->markers === []) {
return $this->markers;
}
return $this->buildArrayFromN... | php | {
"resource": ""
} |
q26722 | Version2.buildVisibility | train | private function buildVisibility(SimpleXMLElement $phpDocumentor): array
{
if ((array) $phpDocumentor->parser === []) {
return $this->visibility;
}
if ((string) $phpDocumentor->parser->visibility === '') {
return $this->visibility;
}
return explode('... | php | {
"resource": ""
} |
q26723 | Version2.buildDefaultPackageName | train | private function buildDefaultPackageName(SimpleXMLElement $phpDocumentor): string
{
if ((array) $phpDocumentor->parser === []) {
return $this->defaultPackageName;
}
if ((string) $phpDocumentor->parser->{'default-package-name'} === '') {
return $this->defaultPackageNa... | php | {
"resource": ""
} |
q26724 | Version2.buildIgnoreHidden | train | private function buildIgnoreHidden(SimpleXMLElement $phpDocumentor): bool
{
if ((array) $phpDocumentor->files === []) {
return $this->ignoreHidden;
}
if ((string) $phpDocumentor->files->{'ignore-hidden'} === '') {
return $this->ignoreHidden;
}
return... | php | {
"resource": ""
} |
q26725 | Version2.buildIgnoreSymlinks | train | private function buildIgnoreSymlinks(SimpleXMLElement $phpDocumentor): bool
{
if ((array) $phpDocumentor->files === []) {
return $this->ignoreSymlinks;
}
if ((string) $phpDocumentor->files->{'ignore-symlinks'} === '') {
return $this->ignoreSymlinks;
}
... | php | {
"resource": ""
} |
q26726 | Version2.buildIgnorePaths | train | private function buildIgnorePaths(SimpleXMLElement $phpDocumentor): array
{
if ((array) $phpDocumentor->files === []) {
return $this->ignorePaths;
}
$ignorePaths = [];
foreach ($phpDocumentor->files->children() as $child) {
if ($child->getName() === 'ignore') ... | php | {
"resource": ""
} |
q26727 | Version2.buildOutputDirectory | train | private function buildOutputDirectory(SimpleXMLElement $phpDocumentor): string
{
if ((array) $phpDocumentor->transformer === []) {
return $this->outputDirectory;
}
if ((string) $phpDocumentor->transformer->target === '') {
return $this->outputDirectory;
}
... | php | {
"resource": ""
} |
q26728 | Version2.buildDirectories | train | private function buildDirectories(SimpleXMLElement $phpDocumentor): array
{
if ((array) $phpDocumentor->files === []) {
return $this->directories;
}
if ((string) $phpDocumentor->files->directory === '') {
return $this->directories;
}
return (array) $... | php | {
"resource": ""
} |
q26729 | Version2.buildSourcePaths | train | private function buildSourcePaths(SimpleXMLElement $phpDocumentor): array
{
$sourcePaths = [];
$directories = $this->buildDirectories($phpDocumentor);
foreach ($directories as $directory) {
$sourcePaths[] = (new Dsn($directory))->getPath();
}
return $sourcePaths... | php | {
"resource": ""
} |
q26730 | Version2.validate | train | private function validate(SimpleXMLElement $xml): void
{
if ($xml->getName() !== 'phpdocumentor') {
throw new InvalidArgumentException(
sprintf('Root element name should be phpdocumentor, %s found', $xml->getName())
);
}
} | php | {
"resource": ""
} |
q26731 | Extension.markdown | train | public static function markdown($text)
{
if (!is_string($text)) {
return $text;
}
$markdown = \Parsedown::instance();
return $markdown->parse($text);
} | php | {
"resource": ""
} |
q26732 | Extension.getDocumentedElement | train | private static function getDocumentedElement($fqsen)
{
$projectDescriptor = self::$descriptorBuilder->getProjectDescriptor();
$elementList = $projectDescriptor->getIndexes()->get('elements');
$prefixedLink = '~\\' . $fqsen;
if (isset($elementList[$fqsen])) {
return $elem... | php | {
"resource": ""
} |
q26733 | Client.send | train | public function send(RequestInterface $request): ResponseInterface
{
$this->emit('beforeRequest', [$request]);
$retryCount = 0;
$redirects = 0;
do {
$doRedirect = false;
$retry = false;
try {
$response = $this->doRequest($request... | php | {
"resource": ""
} |
q26734 | Client.sendAsync | train | public function sendAsync(RequestInterface $request, callable $success = null, callable $error = null)
{
$this->emit('beforeRequest', [$request]);
$this->sendAsyncInternal($request, $success, $error);
$this->poll();
} | php | {
"resource": ""
} |
q26735 | Client.poll | train | public function poll(): bool
{
// nothing to do?
if (!$this->curlMultiMap) {
return false;
}
do {
$r = curl_multi_exec(
$this->curlMultiHandle,
$stillRunning
);
} while (CURLM_CALL_MULTI_PERFORM === $r);
... | php | {
"resource": ""
} |
q26736 | Client.doRequest | train | protected function doRequest(RequestInterface $request): ResponseInterface
{
$settings = $this->createCurlSettingsArray($request);
if (!$this->curlHandle) {
$this->curlHandle = curl_init();
} else {
curl_reset($this->curlHandle);
}
curl_setopt_array(... | php | {
"resource": ""
} |
q26737 | Client.createCurlSettingsArray | train | protected function createCurlSettingsArray(RequestInterface $request): array
{
$settings = $this->curlSettings;
switch ($request->getMethod()) {
case 'HEAD':
$settings[CURLOPT_NOBODY] = true;
$settings[CURLOPT_CUSTOMREQUEST] = 'HEAD';
brea... | php | {
"resource": ""
} |
q26738 | Client.sendAsyncInternal | train | protected function sendAsyncInternal(RequestInterface $request, callable $success, callable $error, int $retryCount = 0)
{
if (!$this->curlMultiHandle) {
$this->curlMultiHandle = curl_multi_init();
}
$curl = curl_init();
curl_setopt_array(
$curl,
$... | php | {
"resource": ""
} |
q26739 | Client.curlExec | train | protected function curlExec($curlHandle): string
{
$this->headerLinesMap[(int) $curlHandle] = [];
$result = curl_exec($curlHandle);
if (false === $result) {
$result = '';
}
return $result;
} | php | {
"resource": ""
} |
q26740 | Bearer.getToken | train | public function getToken()
{
$auth = $this->request->getHeader('Authorization');
if (!$auth) {
return null;
}
if ('bearer ' !== strtolower(substr($auth, 0, 7))) {
return null;
}
return substr($auth, 7);
} | php | {
"resource": ""
} |
q26741 | Basic.getCredentials | train | public function getCredentials()
{
$auth = $this->request->getHeader('Authorization');
if (!$auth) {
return null;
}
if ('basic ' !== strtolower(substr($auth, 0, 6))) {
return null;
}
$credentials = explode(':', base64_decode(substr($auth, 6)... | php | {
"resource": ""
} |
q26742 | Sapi.getRequest | train | public static function getRequest(): Request
{
$serverArr = $_SERVER;
if ('cli' === PHP_SAPI) {
// If we're running off the CLI, we're going to set some default
// settings.
$serverArr['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ?? '/';
$serverArr['REQUE... | php | {
"resource": ""
} |
q26743 | Sapi.sendResponse | train | public static function sendResponse(ResponseInterface $response)
{
header('HTTP/'.$response->getHttpVersion().' '.$response->getStatus().' '.$response->getStatusText());
foreach ($response->getHeaders() as $key => $value) {
foreach ($value as $k => $v) {
if (0 === $k) {
... | php | {
"resource": ""
} |
q26744 | Digest.validatePassword | train | public function validatePassword(string $password): bool
{
$this->A1 = md5($this->digestParts['username'].':'.$this->realm.':'.$password);
return $this->validate();
} | php | {
"resource": ""
} |
q26745 | Digest.validate | train | protected function validate(): bool
{
$A2 = $this->request->getMethod().':'.$this->digestParts['uri'];
if ('auth-int' === $this->digestParts['qop']) {
// Making sure we support this qop value
if (!($this->qop & self::QOP_AUTHINT)) {
return false;
... | php | {
"resource": ""
} |
q26746 | Digest.requireLogin | train | public function requireLogin()
{
$qop = '';
switch ($this->qop) {
case self::QOP_AUTH:
$qop = 'auth';
break;
case self::QOP_AUTHINT:
$qop = 'auth-int';
break;
case self::QOP_AUTH | self::QOP_AUTHINT:
... | php | {
"resource": ""
} |
q26747 | Digest.parseDigest | train | protected function parseDigest(string $digest)
{
// protect against missing data
$needed_parts = ['nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1];
$data = [];
preg_match_all('@(\w+)=(?:(?:")([^"]+)"|([^\s,$]+))@', $digest, $matches, ... | php | {
"resource": ""
} |
q26748 | Request.getQueryParameters | train | public function getQueryParameters(): array
{
$url = $this->getUrl();
if (false === ($index = strpos($url, '?'))) {
return [];
}
parse_str(substr($url, $index + 1), $queryParams);
return $queryParams;
} | php | {
"resource": ""
} |
q26749 | Request.getAbsoluteUrl | train | public function getAbsoluteUrl(): string
{
if (!$this->absoluteUrl) {
// Guessing we're a http endpoint.
$this->absoluteUrl = 'http://'.
($this->getHeader('Host') ?? 'localhost').
$this->getUrl();
}
return $this->absoluteUrl;
} | php | {
"resource": ""
} |
q26750 | Request.getPath | train | public function getPath(): string
{
// Removing duplicated slashes.
$uri = str_replace('//', '/', $this->getUrl());
$uri = Uri\normalize($uri);
$baseUri = Uri\normalize($this->getBaseUrl());
if (0 === strpos($uri, $baseUri)) {
// We're not interested in the quer... | php | {
"resource": ""
} |
q26751 | AWS.validate | train | public function validate(string $secretKey): bool
{
$contentMD5 = $this->request->getHeader('Content-MD5');
if ($contentMD5) {
// We need to validate the integrity of the request
$body = $this->request->getBody();
$this->request->setBody($body);
if (... | php | {
"resource": ""
} |
q26752 | AWS.validateRFC2616Date | train | protected function validateRFC2616Date(string $dateHeader): bool
{
$date = HTTP\parseDate($dateHeader);
// Unknown format
if (!$date) {
$this->errorCode = self::ERR_INVALIDDATEFORMAT;
return false;
}
$min = new \DateTime('-15 minutes');
$max... | php | {
"resource": ""
} |
q26753 | AWS.getAmzHeaders | train | protected function getAmzHeaders(): string
{
$amzHeaders = [];
$headers = $this->request->getHeaders();
foreach ($headers as $headerName => $headerValue) {
if (0 === strpos(strtolower($headerName), 'x-amz-')) {
$amzHeaders[strtolower($headerName)] = str_replace(["... | php | {
"resource": ""
} |
q26754 | AWS.hmacsha1 | train | private function hmacsha1(string $key, string $message): string
{
if (function_exists('hash_hmac')) {
return hash_hmac('sha1', $message, $key, true);
}
$blocksize = 64;
if (strlen($key) > $blocksize) {
$key = pack('H*', sha1($key));
}
$key = s... | php | {
"resource": ""
} |
q26755 | Message.getBodyAsStream | train | public function getBodyAsStream()
{
$body = $this->getBody();
if (is_callable($this->body)) {
$body = $this->getBodyAsString();
}
if (is_string($body) || null === $body) {
$stream = fopen('php://temp', 'r+');
fwrite($stream, (string) $body);
... | php | {
"resource": ""
} |
q26756 | Message.getBodyAsString | train | public function getBodyAsString(): string
{
$body = $this->getBody();
if (is_string($body)) {
return $body;
}
if (null === $body) {
return '';
}
if (is_callable($body)) {
ob_start();
$body();
return ob_get_c... | php | {
"resource": ""
} |
q26757 | Message.getHeaders | train | public function getHeaders(): array
{
$result = [];
foreach ($this->headers as $headerInfo) {
$result[$headerInfo[0]] = $headerInfo[1];
}
return $result;
} | php | {
"resource": ""
} |
q26758 | Message.addHeader | train | public function addHeader(string $name, $value)
{
$lName = strtolower($name);
if (isset($this->headers[$lName])) {
$this->headers[$lName][1] = array_merge(
$this->headers[$lName][1],
(array) $value
);
} else {
$this->headers... | php | {
"resource": ""
} |
q26759 | Message.removeHeader | train | public function removeHeader(string $name): bool
{
$name = strtolower($name);
if (!isset($this->headers[$name])) {
return false;
}
unset($this->headers[$name]);
return true;
} | php | {
"resource": ""
} |
q26760 | Collection.aggregate | train | public function aggregate(array $pipeline, array $options = [])
{
$hasOutStage = \MongoDB\is_last_pipeline_operator_out($pipeline);
if ( ! isset($options['readPreference'])) {
$options['readPreference'] = $this->readPreference;
}
if ($hasOutStage) {
$options... | php | {
"resource": ""
} |
q26761 | Collection.count | train | public function count($filter = [], array $options = [])
{
if ( ! isset($options['readPreference'])) {
$options['readPreference'] = $this->readPreference;
}
$server = $this->manager->selectServer($options['readPreference']);
if ( ! isset($options['readConcern']) && \Mon... | php | {
"resource": ""
} |
q26762 | Collection.distinct | train | public function distinct($fieldName, $filter = [], array $options = [])
{
if ( ! isset($options['readPreference'])) {
$options['readPreference'] = $this->readPreference;
}
$server = $this->manager->selectServer($options['readPreference']);
if ( ! isset($options['readCon... | php | {
"resource": ""
} |
q26763 | Collection.insertMany | train | public function insertMany(array $documents, array $options = [])
{
if ( ! isset($options['writeConcern']) && ! $this->isInTransaction($options)) {
$options['writeConcern'] = $this->writeConcern;
}
$operation = new InsertMany($this->databaseName, $this->collectionName, $document... | php | {
"resource": ""
} |
q26764 | Collection.insertOne | train | public function insertOne($document, array $options = [])
{
if ( ! isset($options['writeConcern']) && ! $this->isInTransaction($options)) {
$options['writeConcern'] = $this->writeConcern;
}
$operation = new InsertOne($this->databaseName, $this->collectionName, $document, $option... | php | {
"resource": ""
} |
q26765 | Collection.mapReduce | train | public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce, $out, array $options = [])
{
$hasOutputCollection = ! \MongoDB\is_mapreduce_output_inline($out);
if ( ! isset($options['readPreference'])) {
$options['readPreference'] = $this->readPreference;
}
... | php | {
"resource": ""
} |
q26766 | Collection.watch | train | public function watch(array $pipeline = [], array $options = [])
{
if ( ! isset($options['readPreference'])) {
$options['readPreference'] = $this->readPreference;
}
$server = $this->manager->selectServer($options['readPreference']);
/* Although change streams require a ... | php | {
"resource": ""
} |
q26767 | Collection.isInTransaction | train | private function isInTransaction(array $options)
{
if (isset($options['session']) && $options['session'] instanceof \MongoDB\Driver\Session && $options['session']->isInTransaction()) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q26768 | FindAndModify.createCommandDocument | train | private function createCommandDocument(Server $server)
{
$cmd = ['findAndModify' => $this->collectionName];
if ($this->options['remove']) {
$cmd['remove'] = true;
} else {
$cmd['new'] = $this->options['new'];
$cmd['upsert'] = $this->options['upsert'];
... | php | {
"resource": ""
} |
q26769 | TypeHelper.isTypeName | train | public static function isTypeName(string $typeName): bool
{
$matches = [];
$result = preg_match('~^\\\\?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*$~', $typeName, $matches);
if ($result === false) {
// @codeCoverageIgnoreStart
throw new Exception('PREG error ' ... | php | {
"resource": ""
} |
q26770 | UseStatementHelper.getUseStatementPointers | train | private static function getUseStatementPointers(File $phpcsFile, int $openTagPointer): array
{
$tokens = $phpcsFile->getTokens();
$pointer = $openTagPointer + 1;
$pointers = [];
while (true) {
$typesToFind = array_merge([T_USE], TokenHelper::$typeKeywordTokenCodes);
$pointer = TokenHelper::findNext($phpc... | php | {
"resource": ""
} |
q26771 | NoCaptcha.displaySubmit | train | public function displaySubmit($formIdentifier, $text = 'submit', $attributes = [])
{
$javascript = '';
if (!isset($attributes['data-callback'])) {
$functionName = 'onSubmit' . str_replace(['-', '=', '\'', '"', '<', '>', '`'], '', $formIdentifier);
$attributes['data-callback']... | php | {
"resource": ""
} |
q26772 | NoCaptcha.renderJs | train | public function renderJs($lang = null, $callback = false, $onLoadClass = 'onloadCallBack')
{
return '<script src="'.$this->getJsLink($lang, $callback, $onLoadClass).'" async defer></script>'."\n";
} | php | {
"resource": ""
} |
q26773 | NoCaptcha.verifyResponse | train | public function verifyResponse($response, $clientIp = null)
{
if (empty($response)) {
return false;
}
// Return true if response already verfied before.
if (in_array($response, $this->verifiedResponses)) {
return true;
}
$verifyResponse = $th... | php | {
"resource": ""
} |
q26774 | NoCaptcha.getJsLink | train | public function getJsLink($lang = null, $callback = false, $onLoadClass = 'onloadCallBack')
{
$client_api = static::CLIENT_API;
$params = [];
$callback ? $this->setCallBackParams($params, $onLoadClass) : false;
$lang ? $params['hl'] = $lang : null;
return $client_api . '?'... | php | {
"resource": ""
} |
q26775 | NoCaptcha.prepareAttributes | train | protected function prepareAttributes(array $attributes)
{
$attributes['data-sitekey'] = $this->sitekey;
if (!isset($attributes['class'])) {
$attributes['class'] = '';
}
$attributes['class'] = trim('g-recaptcha ' . $attributes['class']);
return $attributes;
} | php | {
"resource": ""
} |
q26776 | NoCaptcha.buildAttributes | train | protected function buildAttributes(array $attributes)
{
$html = [];
foreach ($attributes as $key => $value) {
$html[] = $key.'="'.$value.'"';
}
return count($html) ? ' '.implode(' ', $html) : '';
} | php | {
"resource": ""
} |
q26777 | Job.resolve | train | protected function resolve($name)
{
if (strpos($name, '\\') === false) {
if (strpos($name, '/') === false) {
$app = '';
} else {
list($app, $name) = explode('/', $name, 2);
}
$name = ($this->app->config->get('app.app_namespace... | php | {
"resource": ""
} |
q26778 | Worker.registerTimeoutHandler | train | protected function registerTimeoutHandler($job, $timeout)
{
pcntl_signal(SIGALRM, function () {
$this->kill(1);
});
pcntl_alarm(
max($this->timeoutForJob($job, $timeout), 0)
);
} | php | {
"resource": ""
} |
q26779 | ListFailed.displayFailedJobs | train | protected function displayFailedJobs(array $jobs)
{
$table = new Table();
$table->setHeader($this->headers);
$table->setRows($jobs);
$this->table($table);
} | php | {
"resource": ""
} |
q26780 | ListFailed.matchJobName | train | protected function matchJobName($payload)
{
preg_match('/"([^"]+)"/', $payload['data']['command'], $matches);
if (isset($matches[1])) {
return $matches[1];
}
return $payload['job'] ?? null;
} | php | {
"resource": ""
} |
q26781 | Utils.getHumanReadableBytes | train | public static function getHumanReadableBytes($value)
{
static $unit = array('B', 'KB', 'MB', 'GB', 'TB');
$i = \floor(\log($value, 1024));
$i = \min($i, 4); // Only go up to TB
return array(
'value' => (float) ($value / \pow(1024, $i)),
'unit' => $unit[$i],
... | php | {
"resource": ""
} |
q26782 | Kint.dumpAll | train | public function dumpAll(array $vars, array $base)
{
if (\array_keys($vars) !== \array_keys($base)) {
throw new InvalidArgumentException('Kint::dumpAll requires arrays of identical size and keys as arguments');
}
$output = $this->renderer->preRender();
if ($vars === arra... | php | {
"resource": ""
} |
q26783 | Kint.dumpVar | train | public function dumpVar(&$var, BasicObject $base)
{
return $this->renderer->render(
$this->parser->parse($var, $base)
);
} | php | {
"resource": ""
} |
q26784 | Kint.getStatics | train | public static function getStatics()
{
return array(
'aliases' => self::$aliases,
'app_root_dirs' => self::$app_root_dirs,
'cli_detection' => self::$cli_detection,
'display_called_from' => self::$display_called_from,
'enabled_mode' => self::$enabled... | php | {
"resource": ""
} |
q26785 | Kint.createFromStatics | train | public static function createFromStatics(array $statics)
{
$mode = false;
if (isset($statics['enabled_mode'])) {
$mode = $statics['enabled_mode'];
if (true === $statics['enabled_mode'] && isset($statics['mode_default'])) {
$mode = $statics['mode_default'];
... | php | {
"resource": ""
} |
q26786 | Kint.getBasesFromParamInfo | train | public static function getBasesFromParamInfo(array $params, $argc)
{
static $blacklist = array(
'null',
'true',
'false',
'array(...)',
'array()',
'[...]',
'[]',
'(...)',
'()',
'"..."',
... | php | {
"resource": ""
} |
q26787 | Kint.getCallInfo | train | public static function getCallInfo(array $aliases, array $trace, $argc)
{
$found = false;
$callee = null;
$caller = null;
$miniTrace = array();
foreach ($trace as $index => $frame) {
if (Utils::traceFrameIsListed($frame, $aliases)) {
$found = true... | php | {
"resource": ""
} |
q26788 | Kint.trace | train | public static function trace()
{
if (!self::$enabled_mode) {
return 0;
}
Utils::normalizeAliases(self::$aliases);
$args = \func_get_args();
$call_info = self::getCallInfo(self::$aliases, \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), \count($args));
$s... | php | {
"resource": ""
} |
q26789 | Kint.dump | train | public static function dump()
{
if (!self::$enabled_mode) {
return 0;
}
Utils::normalizeAliases(self::$aliases);
$args = \func_get_args();
$call_info = self::getCallInfo(self::$aliases, \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), \count($args));
$st... | php | {
"resource": ""
} |
q26790 | Kint.shortenPath | train | public static function shortenPath($file)
{
$file = \array_values(\array_filter(\explode('/', \str_replace('\\', '/', $file)), 'strlen'));
$longest_match = 0;
$match = '/';
foreach (self::$app_root_dirs as $path => $alias) {
if (empty($path)) {
continue;... | php | {
"resource": ""
} |
q26791 | Kint.getSingleCall | train | protected static function getSingleCall(array $frame, $argc)
{
if (!isset($frame['file'], $frame['line'], $frame['function']) || !\is_readable($frame['file'])) {
return null;
}
if (empty($frame['class'])) {
$callfunc = $frame['function'];
} else {
... | php | {
"resource": ""
} |
q26792 | SourceRepresentation.getSource | train | public static function getSource($filename, $start_line = 1, $length = null)
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
}
$source = \preg_split("/\r\n|\n|\r/", \file_get_contents($filename));
$source = \array_combine(\range(1... | php | {
"resource": ""
} |
q26793 | Renderer.matchPlugins | train | public function matchPlugins(array $plugins, array $hints)
{
$out = array();
foreach ($hints as $key) {
if (isset($plugins[$key])) {
$out[$key] = $plugins[$key];
}
}
return $out;
} | php | {
"resource": ""
} |
q26794 | Renderer.sortProperties | train | public static function sortProperties(array $contents, $sort)
{
switch ($sort) {
case self::SORT_VISIBILITY:
/** @var array<array-key, BasicObject[]> Containers to quickly stable sort by type */
$containers = array(
BasicObject::ACCESS_PUBLIC =... | php | {
"resource": ""
} |
q26795 | Parser.parseDeep | train | public function parseDeep(&$var, BasicObject $o)
{
$depth_limit = $this->depth_limit;
$this->depth_limit = false;
$out = $this->parse($var, $o);
$this->depth_limit = $depth_limit;
return $out;
} | php | {
"resource": ""
} |
q26796 | Parser.parse | train | public function parse(&$var, BasicObject $o)
{
$o->type = \strtolower(\gettype($var));
if (!$this->applyPlugins($var, $o, self::TRIGGER_BEGIN)) {
return $o;
}
switch ($o->type) {
case 'array':
return $this->parseArray($var, $o);
c... | php | {
"resource": ""
} |
q26797 | Parser.parseString | train | private function parseString(&$var, BasicObject $o)
{
$string = new BlobObject();
$string->transplant($o);
$string->encoding = BlobObject::detectEncoding($var);
$string->size = BlobObject::strlen($var, $string->encoding);
$rep = new Representation('Contents');
$rep->... | php | {
"resource": ""
} |
q26798 | Parser.parseArray | train | private function parseArray(array &$var, BasicObject $o)
{
$array = new BasicObject();
$array->transplant($o);
$array->size = \count($var);
if (isset($var[$this->marker])) {
--$array->size;
$array->hints[] = 'recursion';
$this->applyPlugins($var,... | php | {
"resource": ""
} |
q26799 | Parser.parseResource | train | private function parseResource(&$var, BasicObject $o)
{
$resource = new ResourceObject();
$resource->transplant($o);
$resource->resource_type = \get_resource_type($var);
$this->applyPlugins($var, $resource, self::TRIGGER_SUCCESS);
return $resource;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.