_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q21000 | TNTGeoSearch.findNearest | train | public function findNearest($currentLocation, $distance, $limit = 10)
{
$startTimer = microtime(true);
$res = $this->buildQuery($currentLocation, $distance, $limit);
$stopTimer = microtime(true);
return [
'ids' | php | {
"resource": ""
} |
q21001 | ArabicStemmer.stem | train | public static function stem($word)
{
$nounStem = self::roughStem(
$word, self::$_nounMay, self::$_nounPre, self::$_nounPost,
self::$_nounMaxPre, self::$_nounMaxPost, self::$_nounMinStem
);
$verbStem = self::roughStem(
$word, self::$_verbMay, self::$_verbP... | php | {
"resource": ""
} |
q21002 | GermanStemmer.step0a | train | private static function step0a($word)
{
$vstr = implode('', self::$vowels);
$word = preg_replace('#([' . $vstr . '])u([' . $vstr . '])#u', '$1U$2', $word);
| php | {
"resource": ""
} |
q21003 | DocPage.loadAndResolveFile | train | public function loadAndResolveFile(): \SimpleXMLElement
{
$content = \file_get_contents($this->path);
$strpos = \strpos($content, '?>')+2;
if (!\file_exists(__DIR__.'/../doc/entities/generated.ent')) {
self::buildEntities();
}
$path = \realpath(__DIR__.'/../doc/en... | php | {
"resource": ""
} |
q21004 | Type.isClass | train | private static function isClass(string $type): bool
{
if ($type === '') {
throw new EmptyTypeException('Empty type passed');
}
if ($type === 'stdClass') {
return true;
}
// Classes | php | {
"resource": ""
} |
q21005 | Method.removeString | train | private function removeString(string $string, string $search): string
{
$search = str_replace(' ', '\s+', $search);
$result = preg_replace('/[\s\,]*'.$search.'/m', '', $string);
if ($result === null) {
| php | {
"resource": ""
} |
q21006 | Method.isOverloaded | train | public function isOverloaded(): bool
{
foreach ($this->getParams() as $parameter) {
| php | {
"resource": ""
} |
q21007 | Scanner.getIgnoredFunctions | train | private function getIgnoredFunctions(): array
{
if ($this->ignoredFunctions === null) {
$ignoredFunctions = require __DIR__.'/../config/ignoredFunctions.php';
$specialCaseFunctions = require __DIR__.'/../config/specialCasesFunctions.php';
| php | {
"resource": ""
} |
q21008 | FileCreator.generateXlsFile | train | public function generateXlsFile(array $protoFunctions, string $path): void
{
$spreadsheet = new Spreadsheet();
$numb = 1;
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Function name');
$sheet->setCellValue('B1', 'Status');
foreach ($protoFunct... | php | {
"resource": ""
} |
q21009 | FileCreator.generatePhpFile | train | public function generatePhpFile(array $functions, string $path): void
{
$path = rtrim($path, '/').'/';
$phpFunctionsByModule = [];
foreach ($functions as $function) {
$writePhpFunction = new WritePhpFunction($function);
$phpFunctionsByModule[$function->getModuleName()... | php | {
"resource": ""
} |
q21010 | FileCreator.generateFunctionsList | train | public function generateFunctionsList(array $functions, string $path): void
{
$functionNames = $this->getFunctionsNameList($functions);
$stream = fopen($path, 'w');
if ($stream === false) {
throw new \RuntimeException('Unable to write to '.$path);
}
fwrite($stream... | php | {
"resource": ""
} |
q21011 | FileCreator.generateRectorFile | train | public function generateRectorFile(array $functions, string $path): void
{
$functionNames = $this->getFunctionsNameList($functions);
$stream = fopen($path, 'w');
if ($stream === false) {
throw new \RuntimeException('Unable to write to '.$path);
}
fwrite($stream, "... | php | {
"resource": ""
} |
q21012 | MetadataFactory.getMetadataForFile | train | public function getMetadataForFile(string $file): ?BenchmarkMetadata
{
$hierarchy = $this->reflector->reflect($file);
if ($hierarchy->isEmpty()) {
return null;
}
try {
$top = $hierarchy->getTop();
} catch (\InvalidArgumentException $exception) {
... | php | {
"resource": ""
} |
q21013 | XmlDecoder.decode | train | public function decode(Document $document)
{
$suites = [];
foreach ($document->query('//suite') as | php | {
"resource": ""
} |
q21014 | XmlDecoder.decodeFiles | train | public function decodeFiles(array $files)
{
// combine into one document.
//
$suiteDocument = new Document('phpbench');
$rootEl = $suiteDocument->createRoot('phpbench');
foreach ($files as $file) {
| php | {
"resource": ""
} |
q21015 | Kde.evaluate | train | public function evaluate(array $points)
{
$count = count($this->dataset);
$bigger = count($points) > $count;
if ($bigger) {
$range = $count - 1;
} else {
$range = count($points) - 1;
}
$result = array_fill(0, count($points), 0);
// ... | php | {
"resource": ""
} |
q21016 | Kde.setBandwidth | train | public function setBandwidth($bwMethod = null)
{
if ($bwMethod == 'scott' || null === $bwMethod) {
$this->coVarianceFactor = function () {
return pow(count($this->dataset), -1. / (5));
};
} elseif ($bwMethod == 'silverman') {
$this->coVarianceFacto... | php | {
"resource": ""
} |
q21017 | SqlVisitor.visit | train | public function visit(Constraint $constraint)
{
$sql = $this->doVisit($constraint);
$return = [$sql, $this->values];
$this->values = [];
$this->paramCounter = 0;
$select = [
'run.id',
'run.uuid',
'run.tag',
'run.date',
... | php | {
"resource": ""
} |
q21018 | BenchmarkFinder.findBenchmarks | train | public function findBenchmarks($path, array $subjectFilter = [], array $groupFilter = [])
{
$finder = new Finder();
$path = PhpBench::normalizePath($path);
if (!file_exists($path)) {
throw new \InvalidArgumentException(sprintf(
'File or directory "%s" does not ex... | php | {
"resource": ""
} |
q21019 | ReportManager.generateReports | train | public function generateReports(SuiteCollection $collection, array $reportNames)
{
$reportDoms = [];
$reportConfigs = [];
foreach ($reportNames as $reportName) {
$reportConfigs[$reportName] = $this->generatorRegistry->getConfig($reportName);
}
foreach ($reportCo... | php | {
"resource": ""
} |
q21020 | ResultCollection.getMetric | train | public function getMetric($class, $metric)
{
$metrics = $this->getResult($class)->getMetrics();
if (!isset($metrics[$metric])) {
throw new \InvalidArgumentException(sprintf(
| php | {
"resource": ""
} |
q21021 | SuiteCollection.mergeCollection | train | public function mergeCollection(self $collection)
{
foreach | php | {
"resource": ""
} |
q21022 | Reflector.getParameterSets | train | public function getParameterSets($file, $paramProviders)
{
$parameterSets = $this->launcher->payload(__DIR__ . '/template/parameter_set_extractor.template', [
'file' => $file,
'class' => $this->getClassNameFromFile($file),
'paramProviders' => var_export($paramProviders, t... | php | {
"resource": ""
} |
q21023 | TimeUnit.toDestUnit | train | public function toDestUnit(float $time, string $destUnit = null, string $mode = null)
| php | {
"resource": ""
} |
q21024 | TimeUnit.overrideDestUnit | train | public function overrideDestUnit($destUnit)
{
self::validateUnit($destUnit);
$this->destUnit | php | {
"resource": ""
} |
q21025 | TimeUnit.overrideMode | train | public function overrideMode($mode)
{
self::validateMode($mode);
$this->mode | php | {
"resource": ""
} |
q21026 | TimeUnit.getDestSuffix | train | public function getDestSuffix(string $unit = null, string $mode = null)
{
| php | {
"resource": ""
} |
q21027 | TimeUnit.format | train | public function format(float $time, string $unit = null, string $mode = null, int $precision = null, bool $suffix = true)
{
$value = number_format($this->toDestUnit($time, $unit, $mode), $precision !== null ? $precision : $this->precision);
| php | {
"resource": ""
} |
q21028 | TimeUnit.convert | train | public static function convert(float $time, string $unit, string $destUnit, string $mode)
{
self::validateMode($mode);
if ($mode === self::MODE_TIME) {
| php | {
"resource": ""
} |
q21029 | TimeUnit.convertInto | train | public static function convertInto(float $time, string $unit, string $destUnit)
{
if (!$time) {
return 0;
}
self::validateUnit($unit);
self::validateUnit($destUnit);
| php | {
"resource": ""
} |
q21030 | TimeUnit.convertTo | train | public static function convertTo(float $time, string $unit, string $destUnit)
{
self::validateUnit($unit);
self::validateUnit($destUnit);
$destM = self::$map[$destUnit];
| php | {
"resource": ""
} |
q21031 | TimeUnit.getSuffix | train | public static function getSuffix($unit, $mode = null)
{
self::validateUnit($unit);
$suffix = self::$suffixes[$unit];
if ($mode === self::MODE_THROUGHPUT) {
| php | {
"resource": ""
} |
q21032 | Formatter.classesFromFile | train | public function classesFromFile($filename)
{
$classes = $this->loader->load($filename);
| php | {
"resource": ""
} |
q21033 | Formatter.registerClasses | train | public function registerClasses(array $classDefinitions)
{
foreach ($classDefinitions as | php | {
"resource": ""
} |
q21034 | ReflectionHierarchy.hasMethod | train | public function hasMethod($name)
{
foreach ($this->reflectionClasses as $reflectionClass) {
if (isset($reflectionClass->methods[$name])) {
| php | {
"resource": ""
} |
q21035 | ReflectionHierarchy.hasStaticMethod | train | public function hasStaticMethod($name)
{
foreach ($this->reflectionClasses as $reflectionClass) {
if (isset($reflectionClass->methods[$name])) {
$method = $reflectionClass->methods[$name];
| php | {
"resource": ""
} |
q21036 | Row.offsetGet | train | public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
throw new \InvalidArgumentException(sprintf(
'Column "%s" does not exist, valid columns: "%s"',
| php | {
"resource": ""
} |
q21037 | FormatRegistry.register | train | public function register($name, FormatInterface $format)
{
if (isset($this->formats[$name])) {
throw new \InvalidArgumentException(sprintf(
'Formatter with | php | {
"resource": ""
} |
q21038 | FormatRegistry.get | train | public function get($name)
{
if (!isset($this->formats[$name])) {
throw new \InvalidArgumentException(sprintf(
'Unknown format "%s", known formats: "%s"',
| php | {
"resource": ""
} |
q21039 | XmlEncoder.encode | train | public function encode(SuiteCollection $suiteCollection)
{
$dom = new Document();
$rootEl = $dom->createRoot('phpbench');
$rootEl->setAttribute('version', PhpBench::VERSION);
$rootEl->setAttributeNS(
'http://www.w3.org/2000/xmlns/',
'xmlns:xsi',
'... | php | {
"resource": ""
} |
q21040 | BaselineManager.addBaselineCallable | train | public function addBaselineCallable($name, $callable)
{
if (isset($this->callables[$name])) {
throw new \InvalidArgumentException(sprintf(
'Baseline callable "%s" has already been registered.',
$name
));
}
if (!is_callable($callable)) ... | php | {
"resource": ""
} |
q21041 | BaselineManager.benchmark | train | public function benchmark($name, $revs)
{
if (!isset($this->callables[$name])) {
throw new \InvalidArgumentException(sprintf(
'Unknown baseline callable "%s", known baseline callables: "%s"',
$name, implode('", "', array_keys($this->callables))
| php | {
"resource": ""
} |
q21042 | ConsoleRenderer.configureFormatters | train | private function configureFormatters(OutputFormatterInterface $formatter)
{
$formatter->setStyle(
'title', new OutputFormatterStyle('white', null, ['bold'])
);
$formatter->setStyle(
'subtitle', new OutputFormatterStyle('white', null, []) | php | {
"resource": ""
} |
q21043 | Suite.generateUuid | train | public function generateUuid()
{
$serialized = serialize($this->envInformations);
$this->uuid = dechex($this->getDate()->format('Ymd')) | php | {
"resource": ""
} |
q21044 | Benchmark.createSubject | train | public function createSubject($name)
{
$subject = new Subject($this, $name);
| php | {
"resource": ""
} |
q21045 | Statistics.stdev | train | public static function stdev(array $values, $sample = false)
{
| php | {
"resource": ""
} |
q21046 | Statistics.variance | train | public static function variance(array $values, $sample = false)
{
$average = self::mean($values);
$sum = 0;
foreach ($values as $value) {
$diff = pow($value - $average, 2);
$sum += $diff;
| php | {
"resource": ""
} |
q21047 | Statistics.kdeMode | train | public static function kdeMode(array $population, $space = 512, $bandwidth = null): float
{
if (count($population) === 1) {
return current($population);
}
if (count($population) === 0) {
return 0.0;
}
if (min($population) == max($population)) {
| php | {
"resource": ""
} |
q21048 | Statistics.histogram | train | public static function histogram(array $values, $steps = 10, $lowerBound = null, $upperBound = null)
{
$min = $lowerBound ?: min($values);
$max = $upperBound ?: max($values);
$range = $max - $min;
$step = $range / $steps;
$steps++; // add one extra step to catch the max val... | php | {
"resource": ""
} |
q21049 | Variant.createIteration | train | public function createIteration(array $results = [])
{
$index = count($this->iterations);
$iteration = new Iteration($index, $this, $results);
| php | {
"resource": ""
} |
q21050 | Variant.getMetricValues | train | public function getMetricValues($resultClass, $metricName)
{
$values = [];
foreach ($this->iterations as $iteration) {
| php | {
"resource": ""
} |
q21051 | Variant.getMetricValuesByRev | train | public function getMetricValuesByRev($resultClass, $metric)
{
return array_map(function ($value) | php | {
"resource": ""
} |
q21052 | Variant.computeStats | train | public function computeStats()
{
$this->rejects = [];
$revs = $this->getRevolutions();
if (0 === count($this->iterations)) {
return;
}
$times = $this->getMetricValuesByRev(TimeResult::class, 'net');
$retryThreshold = $this->getSubject()->getRetryThreshol... | php | {
"resource": ""
} |
q21053 | Variant.getStats | train | public function getStats()
{
if (null !== $this->errorStack) {
throw new \RuntimeException(sprintf(
'Cannot retrieve stats when an exception was encountered ([%s] %s)',
$this->errorStack->getTop()->getClass(),
| php | {
"resource": ""
} |
q21054 | Variant.setException | train | public function setException(\Exception $exception)
{
$errors = [];
do {
$errors[] = Error::fromException($exception);
| php | {
"resource": ""
} |
q21055 | AssertionProcessor.assertionsFromRawCliConfig | train | public function assertionsFromRawCliConfig(array $rawAssertions)
{
$assertions = [];
foreach ($rawAssertions as $rawAssertion) {
$config = $this->jsonDecoder->decode($rawAssertion); | php | {
"resource": ""
} |
q21056 | Registry.registerService | train | public function registerService($name, $serviceId)
{
if (isset($this->serviceMap[$name])) {
throw new \InvalidArgumentException(sprintf(
'%s service "%s" is already registered',
| php | {
"resource": ""
} |
q21057 | Registry.setService | train | public function setService($name, $object)
{
if (isset($this->services[$name])) {
throw new \InvalidArgumentException(sprintf(
'%s service "%s" already exists.',
| php | {
"resource": ""
} |
q21058 | Registry.getService | train | public function getService($name = null)
{
$name = $name ?: $this->defaultService;
if (!$name) {
throw new \RuntimeException(sprintf(
'You must configure a default %s service, registered %s services: "%s"',
| php | {
"resource": ""
} |
q21059 | AnnotationReader.parse | train | private function parse($input, $context = '')
{
try {
$annotations = $this->docParser->parse($input, $context);
} catch (AnnotationException $e) {
if (!preg_match('/The annotation "(.*)" .* was never imported/', $e->getMessage(), $matches)) {
| php | {
"resource": ""
} |
q21060 | BenchmarkMetadata.getOrCreateSubject | train | public function getOrCreateSubject($name)
{
if (isset($this->subjects[$name])) {
return $this->subjects[$name];
}
| php | {
"resource": ""
} |
q21061 | BenchmarkMetadata.filterSubjectNames | train | public function filterSubjectNames(array $filters)
{
foreach (array_keys($this->subjects) as $subjectName) {
$unset = true;
foreach ($filters as $filter) {
if (preg_match(
sprintf('{^.*?%s.*?$}', $filter),
sprintf('%s::%s', $th... | php | {
"resource": ""
} |
q21062 | BenchmarkMetadata.filterSubjectGroups | train | public function filterSubjectGroups(array $groups)
{
foreach ($this->subjects as $subjectName => $subject) {
if (0 === count(array_intersect($subject->getGroups(), $groups))) | php | {
"resource": ""
} |
q21063 | ConfigurableRegistry.getConfig | train | public function getConfig($name)
{
if (is_array($name)) {
$config = $name;
$name = uniqid();
$this->setConfig($name, $config);
}
$name = trim($name);
$name = $this->processRawCliConfig($name);
if (!isset($this->configs[$name])) {
... | php | {
"resource": ""
} |
q21064 | ConfigurableRegistry.setConfig | train | public function setConfig($name, array $config)
{
if (isset($this->configs[$name])) {
throw new \InvalidArgumentException(sprintf(
'%s config "%s" already exists.',
| php | {
"resource": ""
} |
q21065 | Supplier.getInformations | train | public function getInformations()
{
$informations = [];
foreach ($this->providers as $provider) {
if (false === $provider->isApplicable()) {
continue;
| php | {
"resource": ""
} |
q21066 | HistoryIterator.getEntryIterator | train | private function getEntryIterator()
{
$files = $this->days->current();
$files = new \DirectoryIterator($this->days->current());
$historyEntries = [];
foreach ($files as $file) {
if (!$file->isFile()) {
continue;
}
if ($file->getEx... | php | {
"resource": ""
} |
q21067 | HistoryIterator.getHistoryEntry | train | private function getHistoryEntry($path)
{
$dom = new Document();
$dom->load($path);
$collection = $this->xmlDecoder->decode($dom);
$suites = $collection->getSuites();
$suite = reset($suites);
$envInformations = $suite->getEnvInformations();
$vcsBranch = null;... | php | {
"resource": ""
} |
q21068 | TableGenerator.processDiffs | train | private function processDiffs(array $tables, Config $config)
{
$stat = $config['diff_col'];
if ($config['compare']) {
return $tables;
}
if (!in_array('diff', $config['cols'])) {
return $tables;
}
if (!in_array($stat, $config['cols'])) {
... | php | {
"resource": ""
} |
q21069 | TableGenerator.processSort | train | private function processSort(array $table, Config $config)
{
if ($config['sort']) {
$cols = array_reverse($config['sort']);
foreach ($cols as $colName => $direction) {
Sort::mergeSort($table, function ($elementA, $elementB) use ($colName, $direction) {
... | php | {
"resource": ""
} |
q21070 | TableGenerator.processCols | train | private function processCols(array $tables, Config $config)
{
if ($config['cols']) {
$cols = $config['cols'];
if ($config['compare']) {
$cols[] = $config['compare'];
$cols = array_merge($cols, $config['compare_fields']);
}
$tab... | php | {
"resource": ""
} |
q21071 | TableGenerator.generateDocument | train | private function generateDocument(array $tables, Config $config)
{
$document = new Document();
$reportsEl = $document->createRoot('reports');
$reportsEl->setAttribute('name', 'table');
$reportEl = $reportsEl->appendElement('report');
$classMap = array_merge(
$this... | php | {
"resource": ""
} |
q21072 | TableGenerator.resolveCompareColumnName | train | private function resolveCompareColumnName(Row $row, $name, $index = 1)
{
if (!isset($row[$name])) {
return $name;
}
$newName = $name . '#' . (string) $index++;
if (!isset($row[$newName])) {
| php | {
"resource": ""
} |
q21073 | JsonDecoder.normalize | train | private function normalize($jsonString)
{
if (!is_string($jsonString)) {
throw new \InvalidArgumentException(sprintf(
'Expected a string, got "%s"',
gettype($jsonString)
));
}
$chars = str_split($jsonString);
$inRight = $inQuote... | php | {
"resource": ""
} |
q21074 | Subject.createVariant | train | public function createVariant(ParameterSet $parameterSet, $revolutions, $warmup, array $computedStats = [])
{
$variant = new Variant(
$this,
$parameterSet,
| php | {
"resource": ""
} |
q21075 | Storage.setFailureCount | train | public function setFailureCount($service, $failureCount)
{
| php | {
"resource": ""
} |
q21076 | Storage.setLastFailureTime | train | public function setLastFailureTime($service, $lastFailureTime)
{ | php | {
"resource": ""
} |
q21077 | Memcached.throwExceptionIfErrorOccurred | train | private function throwExceptionIfErrorOccurred()
{
$errorResultCodes = [
\Memcached::RES_FAILURE,
\Memcached::RES_SERVER_TEMPORARILY_DISABLED,
| php | {
"resource": ""
} |
q21078 | VKOAuth.getAuthorizeUrl | train | public function getAuthorizeUrl(string $response_type, int $client_id, string $redirect_uri, string $display,
?array $scope = null, ?string $state = null, ?array $group_ids = null, bool $revoke = false): string {
$scope_mask = 0;
foreach ($scope as $scope_setting) {
... | php | {
"resource": ""
} |
q21079 | VKOAuth.checkOAuthResponse | train | protected function checkOAuthResponse(TransportClientResponse $response) {
$this->checkHttpStatus($response);
$body = $response->getBody();
$decode_body = $this->decodeBody($body);
if (isset($decode_body[static::RESPONSE_KEY_ERROR])) {
| php | {
"resource": ""
} |
q21080 | VKOAuth.decodeBody | train | protected function decodeBody(string $body) {
$decoded_body = json_decode($body, true);
if ($decoded_body === null || !is_array($decoded_body)) {
| php | {
"resource": ""
} |
q21081 | VKCallbackApiLongPollExecutor.listen | train | public function listen(?int $ts = null) {
if ($this->server === null) {
$this->server = $this->getLongPollServer();
}
if ($this->last_ts === null) {
$this->last_ts = $this->server[static::SERVER_TIMESTAMP];
}
if ($ts === null) {
$ts = $this->... | php | {
"resource": ""
} |
q21082 | VKCallbackApiLongPollExecutor.getLongPollServer | train | protected function getLongPollServer() {
$params = array(
static::PARAM_GROUP_ID => $this->group_id
);
$server = $this->api_client->groups()->getLongPollServer($this->access_token, $params);
| php | {
"resource": ""
} |
q21083 | VKCallbackApiLongPollExecutor.getEvents | train | public function getEvents(string $host, string $key, int $ts) {
$params = array(
static::PARAM_KEY => $key,
static::PARAM_TS => $ts,
static::PARAM_WAIT => $this->wait,
static::PARAM_ACT => static::VALUE_ACT
);
try { | php | {
"resource": ""
} |
q21084 | VKCallbackApiLongPollExecutor.parseResponse | train | private function parseResponse(array $params, TransportClientResponse $response) {
$this->checkHttpStatus($response);
$body = $response->getBody();
$decode_body = $this->decodeBody($body);
if (isset($decode_body[static::EVENTS_FAILED])) {
switch ($decode_body[static::EVENTS... | php | {
"resource": ""
} |
q21085 | CurlHttpClient.get | train | public function get(string $url, ?array $payload = null): TransportClientResponse {
| php | {
"resource": ""
} |
q21086 | CurlHttpClient.upload | train | public function upload(string $url, string $parameter_name, string $path): TransportClientResponse {
$payload = array();
$payload[$parameter_name] = (class_exists('CURLFile', false)) ?
| php | {
"resource": ""
} |
q21087 | CurlHttpClient.sendRequest | train | public function sendRequest(string $url, array $opts) {
$curl = curl_init($url);
curl_setopt_array($curl, $this->initial_opts + $opts);
$response = curl_exec($curl);
$curl_error_code = curl_errno($curl);
$curl_error = curl_error($curl);
$http_status = curl_getin... | php | {
"resource": ""
} |
q21088 | CurlHttpClient.parseRawResponse | train | protected function parseRawResponse(int $http_status, string $response) {
list($raw_headers, $body) = $this->extractResponseHeadersAndBody($response);
$headers | php | {
"resource": ""
} |
q21089 | CurlHttpClient.extractResponseHeadersAndBody | train | protected function extractResponseHeadersAndBody(string $response) {
$parts = explode("\r\n\r\n", $response);
$raw_body = array_pop($parts);
| php | {
"resource": ""
} |
q21090 | CurlHttpClient.getHeaders | train | protected function getHeaders(string $raw_headers) {
// Normalize line breaks
$raw_headers = str_replace("\r\n", "\n", $raw_headers);
// There will be multiple headers if a 301 was followed
// or a proxy was followed, etc
$header_collection = explode("\n\n", trim($raw_headers));... | php | {
"resource": ""
} |
q21091 | VKApiRequest.upload | train | public function upload(string $upload_url, string $parameter_name, string $path) {
try {
$response = $this->http_client->upload($upload_url, $parameter_name, $path);
} catch (TransportRequestException $e) {
| php | {
"resource": ""
} |
q21092 | VKApiRequest.parseResponse | train | private function parseResponse(TransportClientResponse $response) {
$this->checkHttpStatus($response);
$body = $response->getBody();
$decode_body = $this->decodeBody($body);
if (isset($decode_body[static::KEY_ERROR])) {
$error = $decode_body[static::KEY_ERROR];
... | php | {
"resource": ""
} |
q21093 | VKApiRequest.formatParams | train | private function formatParams(array $params) {
foreach ($params as $key => $value) {
if (is_array($value)) {
$params[$key] = implode(',', $value);
} else if (is_bool($value)) {
| php | {
"resource": ""
} |
q21094 | FeFactory.send | train | public function send(DocumentInterface $document)
{
$xml = $this->getXmlSigned($document);
| php | {
"resource": ""
} |
q21095 | See.getXmlSigned | train | public function getXmlSigned(DocumentInterface $document)
{
$classDoc = get_class($document);
return $this->factory
| php | {
"resource": ""
} |
q21096 | See.send | train | public function send(DocumentInterface $document)
{
$classDoc = get_class($document);
$this->factory
->setBuilder($this->getBuilder($classDoc))
| php | {
"resource": ""
} |
q21097 | See.sendXml | train | public function sendXml($type, $name, $xml)
{
$this->factory
->setBuilder($this->getBuilder($type))
| php | {
"resource": ""
} |
q21098 | LoginController.attempLoginUsingUsernameAsAnEmail | train | protected function attempLoginUsingUsernameAsAnEmail(Request $request)
{
return $this->guard()->attempt(
| php | {
"resource": ""
} |
q21099 | AdminLTEAdmin.createAdminUser | train | protected function createAdminUser()
{
try {
factory(get_class(app('App\User')))->create([
"name" => env('ADMIN_USER', $this->username()),
"email" => env('ADMIN_EMAIL', $this->email()),
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.