_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q16300
Updates.getStatus
train
public function getStatus(): bool { foreach ($this->requestVersion() as $key => $version) { if (! Str::contains($key, 'dev')) { continue; }
php
{ "resource": "" }
q16301
Updates.requestVersion
train
public function requestVersion(): array { try { $versions = json_decode(file_get_contents($this->apiURL), true)['packages']['orchid/platform']; return array_reverse($versions);
php
{ "resource": "" }
q16302
Builder.generateForm
train
public function generateForm(): string { foreach ($this->fields as $field) { if (is_array($field)) { $this->renderGroup($field); continue;
php
{ "resource": "" }
q16303
Builder.render
train
private function render(Field $field) { $field->set('lang', $this->language); $field->set('prefix', $this->buildPrefix($field));
php
{ "resource": "" }
q16304
Builder.getValue
train
private function getValue(string $key, $value = null) { if (! is_null($this->language)) { $key = $this->language.'.'.$key; } if (! is_null($this->prefix)) { $key = $this->prefix.'.'.$key; } $data = $this->data->getContent($key); // default
php
{ "resource": "" }
q16305
Dashboard.prefix
train
public static function prefix(string $path = ''): string { $prefix = config('platform.prefix');
php
{ "resource": "" }
q16306
Dashboard.model
train
public static function model(string $key, string $default = null) {
php
{ "resource": "" }
q16307
Dashboard.getResource
train
public function getResource($key = null) { if (is_null($key)) { return $this->resources;
php
{ "resource": "" }
q16308
UserAccess.removeRoleBySlug
train
public function removeRoleBySlug($slug): int { $role = $this->roles()->where('slug', $slug)->first();
php
{ "resource": "" }
q16309
Role.setPermissionsAttribute
train
public function setPermissionsAttribute(array $permissions = []) { foreach ($permissions as $key => $value)
php
{ "resource": "" }
q16310
PressServiceProvider.registerConfig
train
protected function registerConfig() { $this->publishes([ realpath(PLATFORM_PATH.'/config/press.php') => config_path('press.php'),
php
{ "resource": "" }
q16311
Post.grid
train
public function grid(): array { return [ TD::set('id', 'ID') ->align(TD::ALIGN_CENTER) ->width('100px') ->filter('numeric') ->sort() ->linkPost(), TD::set('name', 'Name') ->width('250px')...
php
{ "resource": "" }
q16312
Attachment.url
train
public function url($default = null): ?string { $disk = $this->getAttribute('disk'); if (Storage::disk($disk)->exists($this->physicalPath())) {
php
{ "resource": "" }
q16313
Attachment.getMimeType
train
public function getMimeType(): string { $mimes = new MimeTypes();
php
{ "resource": "" }
q16314
Field.translate
train
private function translate(): self { if (empty($this->translations)) { return $this; } $lang = $this->get('lang'); foreach ($this->attributes as $key => $attribute) {
php
{ "resource": "" }
q16315
FoundationServiceProvider.registerOrchid
train
protected function registerOrchid(): self { $this->publishes([ realpath(PLATFORM_PATH.'/install-stubs/routes/') => base_path('routes'),
php
{ "resource": "" }
q16316
FoundationServiceProvider.registerViews
train
public function registerViews(): self { $this->loadViewsFrom(PLATFORM_PATH.'/resources/views', 'platform'); $this->publishes([
php
{ "resource": "" }
q16317
FoundationServiceProvider.register
train
public function register(): void { $this->commands($this->commands); $this->app->singleton(Dashboard::class, function () { return new Dashboard(); }); if (! Route::hasMacro('screen')) { Route::macro('screen', function ($url, $screen, $name = null) { ...
php
{ "resource": "" }
q16318
Category.getAllCategories
train
public function getAllCategories() { $categories = $this->exists ? self::whereNotIn('id', [$this->id])->get() : self::get(); return $categories->mapWithKeys(function ($item) {
php
{ "resource": "" }
q16319
Category.newWithCreateTerm
train
public function newWithCreateTerm($term): self { $newTerm = Term::firstOrCreate($term); $this->term_id = $newTerm->id;
php
{ "resource": "" }
q16320
Category.setParent
train
public function setParent($parent_id = null): self { $parent_id = ((int) $parent_id
php
{ "resource": "" }
q16321
BaseWriter.utf8ToUtf16BigEndian
train
public function utf8ToUtf16BigEndian($str, $setbom = true) // UTF8ToUTF16BE { if ($this->mpdf->checkSIP && preg_match("/([\x{20000}-\x{2FFFF}])/u", $str)) { if (!in_array($this->mpdf->currentfontfamily, ['gb', 'big5', 'sjis', 'uhc', 'gbB', 'big5B', 'sjisB', 'uhcB', 'gbI', 'big5I', 'sjisI', 'uhcI', 'gbBI', 'bi...
php
{ "resource": "" }
q16322
Otl._getXAdvancePos
train
private function _getXAdvancePos($pos) { // NB Not all fonts have all marks specified in GlyphClassMarks // If the current glyph is not a base (but a mark) then ignore this, and apply to the current position if (strpos($this->GlyphClassMarks, $this->OTLdata[$pos]['hex']) !== false) { return $pos;
php
{ "resource": "" }
q16323
PageFormat.getSizeFromName
train
public static function getSizeFromName($name) { $format = strtoupper($name); $formats = [ '4A0' => [4767.87, 6740.79], '2A0' => [3370.39, 4767.87], 'A0' => [2383.94, 3370.39], 'A1' => [1683.78, 2383.94], 'A2' => [1190.55, 1683.78], 'A3' => [841.89, 1190.55], 'A4' => [595.28, 841.89], 'A5' =...
php
{ "resource": "" }
q16324
CssManager.array_merge_recursive_unique
train
function array_merge_recursive_unique($array1, $array2) { $arrays = func_get_args(); $narrays = count($arrays); $ret = $arrays[0]; for ($i = 1; $i < $narrays; $i ++) { foreach ($arrays[$i] as $key => $value) { if (((string) $key) === ((string)((int) $key))) { // integer or string as integer key - append...
php
{ "resource": "" }
q16325
CssManager._nthchild
train
function _nthchild($f, $c) { // $f is formula e.g. 2N+1 split into a preg_match array // $c is the comparator value e.g row or column number $c += 1; $select = false; $f_count = count($f); if ($f[0] === 'ODD') { $a = 2; $b = 1; } elseif ($f[0] === 'EVEN') { $a = 2; $b = 0; } elseif ($f_cou...
php
{ "resource": "" }
q16326
AbstractBarcode.binseqToArray
train
protected function binseqToArray($seq, array $barcodeData) { $len = strlen($seq); $w = 0; $k = 0; for ($i = 0; $i < $len; ++$i) { $w += 1; if (($i == ($len - 1)) or (($i < ($len - 1)) and ($seq[$i] != $seq[($i + 1)]))) { if ($seq[$i] == '1') { $t = true; // bar } else {
php
{ "resource": "" }
q16327
S25.checksum
train
private function checksum($code) { $len = strlen($code); $sum = 0; for ($i = 0; $i < $len; $i += 2) { $sum += $code[$i]; } $sum *= 3; for ($i = 1; $i <
php
{ "resource": "" }
q16328
FpdiTrait.getImportedExternalPageLinks
train
public function getImportedExternalPageLinks($pageNumber) { $links = []; $reader = $this->getPdfReader($this->currentReaderId); $parser = $reader->getParser(); $page = $reader->getPage($pageNumber); $page->getPageDictionary(); $annotations = $page->getAttribute('Annots'); if ($annotations instanceof P...
php
{ "resource": "" }
q16329
OtlDump._checkGSUBignore
train
function _checkGSUBignore($flag, $glyph, $MarkFilteringSet) { $ignore = false; // Flag & 0x0008 = Ignore Marks if ((($flag & 0x0008) == 0x0008) && strpos($this->GlyphClassMarks, $glyph)) { $ignore = true; } if ((($flag & 0x0004) == 0x0004) && strpos($this->GlyphClassLigatures, $glyph)) { $ignore = true...
php
{ "resource": "" }
q16330
OtlDump.getGlyphData
train
function getGlyphData($originalGlyphIdx, &$maxdepth, &$depth, &$points, &$contours) { $depth++; $maxdepth = max($maxdepth, $depth); if (count($this->glyphdata[$originalGlyphIdx]['compGlyphs'])) { foreach ($this->glyphdata[$originalGlyphIdx]['compGlyphs'] as $glyphIdx) { $this->getGlyphData($glyphIdx, $max...
php
{ "resource": "" }
q16331
OtlDump.getGlyphs
train
function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs) { $glyphPos = $this->glyphPos[$originalGlyphIdx]; $glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos; if (!$glyphLen) { return; } $this->seek($start + $glyphPos); $numberOfContours = $this->read_short(); if ($number...
php
{ "resource": "" }
q16332
OtlDump.getCMAP4
train
function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph) { $this->maxUniChar = 0; $this->seek($unicode_cmap_offset + 2); $length = $this->read_ushort(); $limit = $unicode_cmap_offset + $length; $this->skip(2); $segCount = $this->read_ushort() / 2; $this->skip(6); $endCount = []; for ($i...
php
{ "resource": "" }
q16333
Protection.objectKey
train
public function objectKey($n) { if ($this->useRC128Encryption) { $len = 16; } else { $len = 10; } return
php
{ "resource": "" }
q16334
Protection.rc4
train
public function rc4($key, $text) { if ($this->lastRc4Key != $key) { $k = str_repeat($key, 256 / strlen($key) + 1); $rc4 = range(0, 255); $j = 0; for ($i = 0; $i < 256; $i++) { $t = $rc4[$i]; $j = ($j + $t + ord($k[$i])) % 256; $rc4[$i] = $rc4[$j]; $rc4[$j] = $t;
php
{ "resource": "" }
q16335
Svg.svg_overflow
train
function svg_overflow($x, $y) { $x2 = $x; $y2 = $y; if (isset($this->svg_attribs['overflow'])) { if ($this->svg_attribs['overflow'] == 'hidden') { // Not sure if this is supposed to strip off units, but since I dont use any I will omlt this step $svg_w = preg_replace("/([0-9\.]*)(.*)/i", "$1", $this->...
php
{ "resource": "" }
q16336
ImageProcessor.fourBytesToInt
train
private function fourBytesToInt($s) { return (ord($s[0]) << 24) + (ord($s[1])
php
{ "resource": "" }
q16337
ImageProcessor.imageError
train
private function imageError($file, $firsttime, $msg) { $this->failedImages[$file] = true; if ($firsttime && ($this->mpdf->showImageErrors || $this->mpdf->debug)) { throw new \Mpdf\MpdfImageException(sprintf('%s
php
{ "resource": "" }
q16338
Tag.getTagClassName
train
public static function getTagClassName($tag) { static $map = [ 'BARCODE' => 'BarCode', 'BLOCKQUOTE' => 'BlockQuote', 'COLUMN_BREAK' => 'ColumnBreak', 'COLUMNBREAK' => 'ColumnBreak', 'DOTTAB' => 'DotTab', 'FIELDSET' => 'FieldSet', 'FIGCAPTION' => 'FigCaption', 'FORMFEED' => 'FormFeed', 'HGR...
php
{ "resource": "" }
q16339
Mpdf.GetFirstBlockFill
train
function GetFirstBlockFill() { // Returns the first blocklevel that uses a bgcolor fill $startfill = 0; for ($i = 1; $i <= $this->blklvl; $i++) { if ($this->blk[$i]['bgcolor'] || $this->blk[$i]['border_left']['w'] || $this->blk[$i]['border_right']['w']
php
{ "resource": "" }
q16340
Mpdf._moveToPrevChar
train
function _moveToPrevChar(&$contentctr, &$charctr, $content) { $lastchar = false; $charctr--; while ($charctr < 0) { // go back to previous $content[] $contentctr--; if ($contentctr < 0) { return false; } if ($this->usingCoreFont) { $charctr = strlen($content[$contentctr]) - 1; } else { ...
php
{ "resource": "" }
q16341
Mpdf._advanceFloatMargins
train
function _advanceFloatMargins() { // Update floatmargins - L if (isset($this->floatmargins['L']) && $this->floatmargins['L']['skipline'] && $this->floatmargins['L']['y0'] != $this->y) { $yadj = $this->y - $this->floatmargins['L']['y0']; $this->floatmargins['L']['y0'] = $this->y; $this->floatmargins['L']['...
php
{ "resource": "" }
q16342
Mpdf.writeHTMLHeaders
train
function writeHTMLHeaders() { if ($this->mirrorMargins && ($this->page) % 2 == 0) { $OE = 'E'; } else { $OE = 'O'; } if ($OE === 'E') { $this->saveHTMLHeader[$this->page][$OE]['html'] = $this->HTMLHeaderE['html']; } else { $this->saveHTMLHeader[$this->page][$OE]['html'] = $this->HTMLHeader['htm...
php
{ "resource": "" }
q16343
Mpdf.ClearFloats
train
function ClearFloats($clear, $blklvl = 0) { list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($blklvl, true); $end = $currpos = ($this->page * 1000 + $this->y); if ($clear == 'BOTH' && ($l_exists || $r_exists)) { $this->pageoutput[$this->page] = []; $end = max($l_max, ...
php
{ "resource": "" }
q16344
Mpdf.GetFloatDivInfo
train
function GetFloatDivInfo($blklvl = 0, $clear = false) { // If blklvl specified, only returns floats at that level - for ClearFloats $l_exists = false; $r_exists = false; $l_max = 0; $r_max = 0; $l_width = 0; $r_width = 0; if (count($this->floatDivs)) { $currpos = ($this->page * 1000 + $this->y); ...
php
{ "resource": "" }
q16345
Mpdf.SetStylesArray
train
function SetStylesArray($arr) { $style = ''; foreach (['B', 'I'] as $s) { if (isset($arr[$s])) { if ($arr[$s]) { $this->$s = true; $style .= $s; } else { $this->$s = false; } } elseif ($this->$s)
php
{ "resource": "" }
q16346
Mpdf.Bookmark
train
function Bookmark($txt, $level = 0, $y = 0) { $txt = $this->purify_utf8_text($txt); if ($this->text_input_as_HTML) { $txt = $this->all_entities_to_utf8($txt); } if ($y == -1) { if (!$this->ColActive) { $y = $this->y; } else { $y = $this->y0; } // If columns are on - mark top of columns } ...
php
{ "resource": "" }
q16347
Mpdf.IndexEntry
train
function IndexEntry($txt, $xref = '') { if ($xref) { $this->IndexEntrySee($txt, $xref); return; } // Search the reference (AND Ref/PageNo) in the array $Present = false; if ($this->keep_block_together) { // do nothing } /* -- TABLES -- */ elseif ($this->kwt) { $size = count($this->kwt_Referenc...
php
{ "resource": "" }
q16348
Mpdf.IndexEntrySee
train
function IndexEntrySee($txta, $txtb) { if ($this->directionality == 'rtl') { // *OTL* // ONLY DO THIS IF NOT IN TAGS if ($txta == strip_tags($txta)) { $txta = str_replace(':', ' - ', $txta); // *OTL* } if ($txtb == strip_tags($txtb)) { $txtb = str_replace(':', ' - ', $txtb); // *OTL* } } // ...
php
{ "resource": "" }
q16349
Mpdf.is_utf8
train
function is_utf8(&$string) { if ($string === mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) { return true; } if ($this->ignore_invalid_utf8) {
php
{ "resource": "" }
q16350
Mpdf.columnAdjustAdd
train
function columnAdjustAdd($type, $k, $xadj, $yadj, $a, $b, $c = 0, $d = 0, $e = 0, $f = 0) { if ($type === 'Td') { // xpos,ypos $a += ($xadj * $k); $b -= ($yadj * $k); return 'BT ' . sprintf('%.3F %.3F', $a, $b) . ' Td'; } elseif ($type === 're') { // xpos,ypos,width,height $a += ($xadj * $k); ...
php
{ "resource": "" }
q16351
Imb.imbCrc11Fcs
train
private function imbCrc11Fcs($codeArray) { $genpoly = 0x0F35; // generator polynomial $fcs = 0x07FF; // Frame Check Sequence // do most significant byte skipping the 2 most significant bits $data = hexdec($codeArray[0]) << 5; for ($bit = 2; $bit < 8; ++$bit) { if (($fcs ^ $data) & 0x400) {
php
{ "resource": "" }
q16352
Imb.imbReverseUs
train
private function imbReverseUs($num) { $rev = 0; for ($i = 0;
php
{ "resource": "" }
q16353
Imb.imbTables
train
private function imbTables($n, $size) { $table = []; $lli = 0; // LUT lower index $lui = $size - 1; // LUT upper index for ($count = 0; $count < 8192; ++$count) { $bitCount = 0; for ($bit_index = 0; $bit_index < 13; ++$bit_index) { $bitCount += (int) (($count & (1 << $bit_index)) != 0); } // ...
php
{ "resource": "" }
q16354
Imb.decToHex
train
private function decToHex($number) { $hex = []; if ($number == 0) { return '00'; } while ($number > 0) { if ($number == 0) { array_push($hex, '0'); } else { array_push($hex, strtoupper(dechex(bcmod($number,
php
{ "resource": "" }
q16355
StorageManager.subscriberByRequest
train
public function subscriberByRequest(array $input, array $headers): ?Subscriber { $channel = Arr::get($input, 'channel_name'); return $channel
php
{ "resource": "" }
q16356
StorageManager.subscriberByChannel
train
public function subscriberByChannel(string $channel): ?Subscriber {
php
{ "resource": "" }
q16357
StorageManager.subscribersByTopic
train
public function subscribersByTopic(string $topic) { $key = self::TOPIC_KEY.".{$topic}"; if (! $this->cache->has($key)) { return new Collection; }
php
{ "resource": "" }
q16358
StorageManager.storeSubscriber
train
public function storeSubscriber(Subscriber $subscriber, string $topic): void { $topicKey = self::TOPIC_KEY.".{$topic}"; $subscriberKey = self::SUBSCRIBER_KEY.".{$subscriber->channel}"; $topic = $this->cache->has($topicKey) ? json_decode($this->cache->get($topicKey), true) ...
php
{ "resource": "" }
q16359
StorageManager.deleteSubscriber
train
public function deleteSubscriber(string $channel): ?Subscriber { $key = self::SUBSCRIBER_KEY.".{$channel}"; $hasSubscriber = $this->cache->has($key); $subscriber = $this->cache->get($key);
php
{ "resource": "" }
q16360
SchemaStitcher.gatherSchemaImportsRecursively
train
protected static function gatherSchemaImportsRecursively(string $path): string { if (! file_exists($path)) { self::throwFileNotFoundException($path); } return (new Collection(file($path))) ->map(function (string $line) use ($path) { if (! Str::startsW...
php
{ "resource": "" }
q16361
CacheDirective.store
train
protected function store(CacheManager $cache, string $key, $value, ?Carbon $expiration, array $tags): void { $supportsTags = $this->useTags($cache); if ($expiration) { $supportsTags ? $cache->tags($tags)->put($key, $value, $expiration)
php
{ "resource": "" }
q16362
CacheDirective.setNodeKey
train
protected function setNodeKey(NodeValue $nodeValue): void { if ($nodeValue->getCacheKey()) { return; } $fields = data_get($nodeValue->getTypeDefinition(), 'fields', []); $nodeKey = (new Collection($fields))->reduce(function (?string $key, FieldDefinitionNode $field): ?st...
php
{ "resource": "" }
q16363
Builder.apply
train
public function apply($builder, array $args) { /* * Call the queryFilter for backwards compatibility * @deprecated */ $this->queryFilter->filter($builder, $args); foreach ($args as $key => $value) { /** @var \Nuwave\Lighthouse\Support\Contracts\ArgBuil...
php
{ "resource": "" }
q16364
Builder.addScopes
train
public function addScopes(array $scopes): self {
php
{ "resource": "" }
q16365
Builder.addBuilderDirective
train
public function addBuilderDirective(string $argumentName, ArgBuilderDirective $argBuilderDirective): self {
php
{ "resource": "" }
q16366
MultipartFormRequest.fieldValue
train
protected function fieldValue(string $key) { return $this->isBatched()
php
{ "resource": "" }
q16367
SubscriptionBroadcaster.queueBroadcast
train
public function queueBroadcast(GraphQLSubscription $subscription, string $fieldName, $root): void { $this->eventsDispatcher->dispatch(
php
{ "resource": "" }
q16368
SubscriptionBroadcaster.broadcast
train
public function broadcast(GraphQLSubscription $subscription, string $fieldName, $root): void { $topic = $subscription->decodeTopic($fieldName, $root); $subscribers = $this->storage ->subscribersByTopic($topic) ->filter(function (Subscriber $subscriber) use ($subscription, $r...
php
{ "resource": "" }
q16369
SubscriptionBroadcaster.authorize
train
public function authorize(Request $request): Response { return $this->auth->authorize($request)
php
{ "resource": "" }
q16370
Tracing.handleStartRequest
train
public function handleStartRequest(StartRequest $startRequest): void { $this->requestStart = Carbon::now();
php
{ "resource": "" }
q16371
Tracing.handleBuildExtensionsResponse
train
public function handleBuildExtensionsResponse(BuildExtensionsResponse $buildExtensionsResponse): ExtensionsResponse { $requestEnd = Carbon::now(); $requestEndPrecise = $this->getTime(); return new ExtensionsResponse( 'tracing', [
php
{ "resource": "" }
q16372
Tracing.record
train
public function record(ResolveInfo $resolveInfo, $start, $end): void { $this->resolverTraces [] = [ 'path' => $resolveInfo->path, 'parentType' => $resolveInfo->parentType->name, 'returnType' => $resolveInfo->returnType->__toString(), 'fieldName' => $resolveInf...
php
{ "resource": "" }
q16373
Tracing.diffTimeInNanoseconds
train
protected function diffTimeInNanoseconds($start, $end): int { if ($this->platformSupportsNanoseconds()) { return $end - $start; } // Difference is in seconds (with microsecond precision) // * 1000 to get to milliseconds //
php
{ "resource": "" }
q16374
Date.serialize
train
public function serialize($value): string { if ($value instanceof Carbon) { return $value->toDateString(); }
php
{ "resource": "" }
q16375
CacheValue.getKey
train
public function getKey(): string { $argKeys = $this->argKeys(); return $this->implode([ $this->privateCache ? 'auth' : null, $this->privateCache
php
{ "resource": "" }
q16376
CacheValue.getTags
train
public function getTags(): array { $typeTag = $this->implode([ 'graphql', strtolower($this->fieldValue->getParentName()), $this->fieldKey, ]); $fieldTag = $this->implode([ 'graphql',
php
{ "resource": "" }
q16377
CacheValue.argKeys
train
protected function argKeys(): Collection { $args = $this->args; ksort($args); return (new Collection($args))->map(function ($value, $key)
php
{ "resource": "" }
q16378
CacheValue.setFieldKey
train
protected function setFieldKey() { if (! $this->fieldValue || ! $this->rootValue) { return; } $cacheFieldKey = $this->fieldValue ->getParent() ->getCacheKey();
php
{ "resource": "" }
q16379
HasResolverArguments.setResolverArguments
train
public function setResolverArguments($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): self { return $this ->setRoot($root)
php
{ "resource": "" }
q16380
Utils.namespaceClassname
train
public static function namespaceClassname(string $classCandidate, array $namespacesToTry, callable $determineMatch): ?string { if ($determineMatch($classCandidate)) { return $classCandidate; } // Stop if the class is found or we are out of namespaces to try while (! empt...
php
{ "resource": "" }
q16381
Utils.constructResolver
train
public static function constructResolver(string $className, string $methodName): Closure { if (! method_exists($className, $methodName)) { throw new DefinitionException("Method '{$methodName}' does
php
{ "resource": "" }
q16382
Defer.defer
train
public function defer(Closure $resolver, string $path) { if ($data = Arr::get($this->result, "data.{$path}")) { return $data;
php
{ "resource": "" }
q16383
Defer.resolve
train
public function resolve(Closure $originalResolver, string $path) { $isDeferred = $this->isDeferred($path); $resolver = $isDeferred ? $this->deferred[$path] : $originalResolver;
php
{ "resource": "" }
q16384
Defer.createResponse
train
public function createResponse(array $result): Response { if (empty($this->deferred)) { return response($result); } return response()->stream( function () use ($result): void { $nested = 1; $this->result = $result; $thi...
php
{ "resource": "" }
q16385
Defer.maxNestedFieldsResolved
train
protected function maxNestedFieldsResolved(int $nested): bool { if ($this->maxNestedFields === 0) { return false;
php
{ "resource": "" }
q16386
Defer.executeDeferred
train
protected function executeDeferred(): void { $this->result = app()->call( [$this->graphQL, 'executeRequest'] ); $this->stream->stream( $this->result,
php
{ "resource": "" }
q16387
DeleteDirective.getSingleArgumentDefinition
train
protected function getSingleArgumentDefinition(): InputValueDefinitionNode { if (count($this->definitionNode->arguments) !== 1) { throw new DirectiveException(
php
{ "resource": "" }
q16388
ASTBuilder.build
train
public function build(string $schema): DocumentAST { $document = DocumentAST::fromSource($schema); // Node manipulators may be defined on type extensions $document = $this->applyNodeManipulators($document); // After they have been applied, we can safely merge them $document ...
php
{ "resource": "" }
q16389
ASTBuilder.mergeTypeExtensions
train
protected function mergeTypeExtensions(DocumentAST $document): DocumentAST { $document->objectTypeDefinitions()->each( function (ObjectTypeDefinitionNode $objectType) use ($document) { $name = $objectType->name->value; $objectType = $document ...
php
{ "resource": "" }
q16390
ASTBuilder.addNodeSupport
train
protected function addNodeSupport(DocumentAST $document): DocumentAST { $hasTypeImplementingNode = $document ->objectTypeDefinitions() ->contains(function (ObjectTypeDefinitionNode $objectType): bool { return (new Collection($objectType->interfaces)) ...
php
{ "resource": "" }
q16391
Subscriber.unserialize
train
public function unserialize($subscription): self { $data = json_decode($subscription, true); $this->operationName = $data['operation_name']; $this->channel = $data['channel'];
php
{ "resource": "" }
q16392
Subscriber.serialize
train
public function serialize() { return json_encode([ 'operation_name' => $this->operationName, 'channel' => $this->channel, 'args' => $this->args,
php
{ "resource": "" }
q16393
GraphQLController.query
train
public function query(GraphQLRequest $request) { $this->eventsDispatcher->dispatch( new StartRequest($request) ); $result = $request->isBatched() ? $this->executeBatched($request) : $this->graphQL->executeRequest($request); $response = $this->cre...
php
{ "resource": "" }
q16394
GraphQLController.executeBatched
train
protected function executeBatched(GraphQLRequest $request): array { $results = []; do { $results[] = $this->graphQL->executeRequest($request);
php
{ "resource": "" }
q16395
GlobalId.decodeID
train
public function decodeID(string $globalID): string {
php
{ "resource": "" }
q16396
GlobalId.decodeType
train
public function decodeType(string $globalID): string {
php
{ "resource": "" }
q16397
ModelRelationFetcher.setRelations
train
public function setRelations(array $relations): self { // Parse and set the relations. $this->relations = $this->newModelQuery()
php
{ "resource": "" }
q16398
ModelRelationFetcher.setModels
train
protected function setModels($models): self { // We can not use the collect() helper here, since we require this // to be an Eloquent Collection $this->models
php
{ "resource": "" }
q16399
ModelRelationFetcher.loadRelationsForPage
train
public function loadRelationsForPage(int $perPage, int $page = 1): self { foreach ($this->relations as
php
{ "resource": "" }