_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q16400
ModelRelationFetcher.loadRelationForPage
train
public function loadRelationForPage(int $first, int $page, string $relationName, Closure $relationConstraints): self { // Load the count of relations of models, this will be the `total` argument of `Paginator`. // Be aware that this will reload all the models entirely with the count of their relatio...
php
{ "resource": "" }
q16401
ModelRelationFetcher.buildRelationsFromModels
train
protected function buildRelationsFromModels(string $relationName, Closure $relationConstraints): Collection { return $this->models->toBase()->map( function (Model $model) use ($relationName, $relationConstraints) { $relation = $this->getRelationInstance($relationName); ...
php
{ "resource": "" }
q16402
ModelRelationFetcher.loadDefaultWith
train
protected function loadDefaultWith(EloquentCollection $collection): self { if ($collection->isEmpty()) { return $this; } $model = $collection->first(); $reflection = new ReflectionClass($model); $withProperty = $reflection->getProperty('with'); $withPrope...
php
{ "resource": "" }
q16403
ModelRelationFetcher.getRelationDictionary
train
public function getRelationDictionary(string $relationName): array { return $this->models ->mapWithKeys( function (Model $model) use ($relationName) { return
php
{ "resource": "" }
q16404
ModelRelationFetcher.unionAllRelationQueries
train
protected function unionAllRelationQueries(Collection $relations): EloquentBuilder { return $relations ->reduce( function (EloquentBuilder $builder, Relation $relation) { return $builder->unionAll( $relation->getQuery() ...
php
{ "resource": "" }
q16405
ModelRelationFetcher.associateRelationModels
train
protected function associateRelationModels(string $relationName, EloquentCollection $relationModels): self { $relation = $this->getRelationInstance($relationName); $relation->match(
php
{ "resource": "" }
q16406
ModelRelationFetcher.hydratePivotRelation
train
protected function hydratePivotRelation(string $relationName, EloquentCollection $relationModels): self { $relation = $this->getRelationInstance($relationName); if ($relationModels->isNotEmpty() && method_exists($relation, 'hydratePivotRelation')) { $hydrationMethod =
php
{ "resource": "" }
q16407
DefinitionNodeConverter.convertWrappedDefinitionNode
train
protected function convertWrappedDefinitionNode($node, array $wrappers = []): Type { // Recursively unwrap the type and save the wrappers if ($node->kind === NodeKind::NON_NULL_TYPE || $node->kind === NodeKind::LIST_TYPE) { $wrappers[] = $node->kind; return $this->convertWra...
php
{ "resource": "" }
q16408
DefinitionNodeConverter.convertNamedTypeNode
train
protected function convertNamedTypeNode(NamedTypeNode $node): Type { $nodeName = $node->name->value; switch ($nodeName) { case 'ID': return Type::id(); case 'Int': return Type::int(); case 'Boolean': return Type::boo...
php
{ "resource": "" }
q16409
FieldFactory.handle
train
public function handle(FieldValue $fieldValue): array { $fieldDefinitionNode = $fieldValue->getField(); // Directives have the first priority for defining a resolver for a field if ($resolverDirective = $this->directiveFactory->createFieldResolver($fieldDefinitionNode)) { $this-...
php
{ "resource": "" }
q16410
FieldFactory.getArgumentValues
train
protected function getArgumentValues(): Collection { return (new Collection($this->fieldValue->getField()->arguments)) ->map(function (InputValueDefinitionNode $inputValueDefinition): ArgumentValue {
php
{ "resource": "" }
q16411
FieldFactory.handleArgDirectivesRecursively
train
protected function handleArgDirectivesRecursively( InputType $type, InputValueDefinitionNode $astNode, array $argumentPath ): void { if ($type instanceof NonNull) { $this->handleArgDirectivesRecursively( $type->getWrappedType(), $astNode, ...
php
{ "resource": "" }
q16412
FieldFactory.validateArgs
train
protected function validateArgs(): void { if (! $this->rules) { return; } $validator = validator( $this->args, $this->rules, $this->messages, [ 'root' => $this->root, 'context' => $this->context, ...
php
{ "resource": "" }
q16413
FieldFactory.resumeHandlingArgDirectives
train
protected function resumeHandlingArgDirectives(): void { // copy and reset $snapshots = $this->handleArgDirectivesSnapshots; $this->handleArgDirectivesSnapshots = []; foreach ($snapshots as $handlerArgs) { $this->handleArgDirectives(...$handlerArgs); }
php
{ "resource": "" }
q16414
FieldFactory.getInputValueDefinitions
train
protected function getInputValueDefinitions(Collection $argumentValues): array { return $argumentValues ->mapWithKeys(function (ArgumentValue $argumentValue): array { return [
php
{ "resource": "" }
q16415
ExtensionErrorHandler.handle
train
public static function handle(Error $error, Closure $next): array { $underlyingException = $error->getPrevious(); if ($underlyingException instanceof RendersErrorsExtensions) { // Reconstruct the error, passing in the extensions of the underlying exception $error = new Error...
php
{ "resource": "" }
q16416
Serializer.serialize
train
public function serialize(GraphQLContext $context): string { $request = $context->request(); return serialize([ 'request' => [ 'query' => $request->query->all(), 'request' => $request->request->all(), 'attributes' => $request->attributes->...
php
{ "resource": "" }
q16417
Serializer.unserialize
train
public function unserialize(string $context): GraphQLContext { [ 'request' => $rawRequest, 'user' => $rawUser ] = unserialize($context); $request = new Request( $rawRequest['query'], $rawRequest['request'], $rawRequest['attributes'...
php
{ "resource": "" }
q16418
LighthouseRequest.variables
train
public function variables(): array { $variables = $this->fieldValue('variables'); // In case we are resolving a GET request, variables // are sent as a JSON encoded string if (is_string($variables)) { return json_decode($variables, true) ?? [];
php
{ "resource": "" }
q16419
LighthouseRequest.fieldValue
train
protected function fieldValue(string $key) { return $this->request->input($key)
php
{ "resource": "" }
q16420
QueryFilter.getInstance
train
public static function getInstance(FieldValue $value): self { $handler = 'query.filter' .'.'.strtolower($value->getParentName())
php
{ "resource": "" }
q16421
QueryFilter.apply
train
public static function apply($query, array $args, array $scopes, ResolveInfo $resolveInfo) { /** @var \Nuwave\Lighthouse\Execution\QueryFilter $queryFilter */ if ($queryFilter = $resolveInfo->queryFilter ?? false) { $query = $queryFilter->filter($query, $args); }
php
{ "resource": "" }
q16422
QueryFilter.filter
train
public function filter($query, array $args = []) { $valuesGroupedByFilterKey = []; /** * @var string * @var mixed $value */ foreach ($args as $key => $value) { /** * @var string * @var string[] $argNames */ ...
php
{ "resource": "" }
q16423
QueryFilter.addArgumentFilter
train
public function addArgumentFilter(string $argumentName, string $columnName, ArgFilterDirective $argFilterDirective): self { if ($argFilterDirective->combinesMultipleArguments()) { $filterKey = "{$columnName}.{$argFilterDirective->name()}"; $this->multiArgumentFilters[$filterKey] = $...
php
{ "resource": "" }
q16424
WhereDirective.handleBuilder
train
public function handleBuilder($builder, $value) { // Allow users to overwrite the default "where" clause, e.g. "whereYear" $clause = $this->directiveArgValue('clause', 'where'); return $builder->{$clause}(
php
{ "resource": "" }
q16425
SubscriptionServiceProvider.register
train
public function register(): void { $this->app->singleton(BroadcastManager::class); $this->app->singleton(SubscriptionRegistry::class); $this->app->singleton(StoresSubscriptions::class, StorageManager::class); $this->app->bind(ContextSerializer::class, Serializer::class); $th...
php
{ "resource": "" }
q16426
ASTHelper.mergeUniqueNodeList
train
public static function mergeUniqueNodeList($original, $addition, bool $overwriteDuplicates = false): NodeList { $newNames = (new Collection($addition)) ->pluck('name.value') ->filter() ->all(); $remainingDefinitions = (new Collection($original)) ->rej...
php
{ "resource": "" }
q16427
ASTHelper.directiveHasArgument
train
public static function directiveHasArgument(DirectiveNode $directiveDefinition, string $name): bool { return (new Collection($directiveDefinition->arguments))
php
{ "resource": "" }
q16428
ASTHelper.argValue
train
public static function argValue(ArgumentNode $arg, $default = null) { $valueNode = $arg->value; if (! $valueNode) {
php
{ "resource": "" }
q16429
ASTHelper.directiveDefinition
train
public static function directiveDefinition(Node $definitionNode, string $name): ?DirectiveNode { return (new Collection($definitionNode->directives))
php
{ "resource": "" }
q16430
ASTHelper.hasDirectiveDefinition
train
public static function hasDirectiveDefinition(Node $definitionNode, string $name): bool { return (new Collection($definitionNode->directives))
php
{ "resource": "" }
q16431
ASTHelper.attachDirectiveToObjectTypeFields
train
public static function attachDirectiveToObjectTypeFields(DocumentAST $documentAST, DirectiveNode $directive): DocumentAST { return $documentAST->objectTypeDefinitions() ->reduce( function (DocumentAST $document, ObjectTypeDefinitionNode $objectType) use ($directive): DocumentAST ...
php
{ "resource": "" }
q16432
ASTHelper.attachNodeInterfaceToObjectType
train
public static function attachNodeInterfaceToObjectType(ObjectTypeDefinitionNode $objectType, DocumentAST $documentAST): DocumentAST { $objectType->interfaces = self::mergeNodeList( $objectType->interfaces, [ Parser::parseType( 'Node', ...
php
{ "resource": "" }
q16433
ConnectionField.pageInfoResolver
train
public function pageInfoResolver(LengthAwarePaginator $paginator): array { return [ 'total' => $paginator->total(), 'count' => $paginator->count(), 'currentPage' => $paginator->currentPage(), 'lastPage' => $paginator->lastPage(),
php
{ "resource": "" }
q16434
ConnectionField.edgeResolver
train
public function edgeResolver(LengthAwarePaginator $paginator): Collection { $firstItem = $paginator->firstItem(); return $paginator->values()->map(function ($item, $index)
php
{ "resource": "" }
q16435
RelationBatchLoader.resolve
train
public function resolve(): array { $modelRelationFetcher = $this->getRelationFetcher(); if ($this->first !== null) { $modelRelationFetcher->loadRelationsForPage($this->first, $this->page); } else {
php
{ "resource": "" }
q16436
RelationBatchLoader.getRelationFetcher
train
protected function getRelationFetcher(): ModelRelationFetcher { return new ModelRelationFetcher( $this->getParentModels(), [$this->relationName => function ($query) { return $this->resolveInfo
php
{ "resource": "" }
q16437
BaseDirective.getResolverFromArgument
train
public function getResolverFromArgument(string $argumentName): Closure { [$className, $methodName] = $this->getMethodArgumentParts($argumentName);
php
{ "resource": "" }
q16438
BaseDirective.getMethodArgumentParts
train
protected function getMethodArgumentParts(string $argumentName): array { $argumentParts = explode( '@', $this->directiveArgValue($argumentName) ); if ( count($argumentParts) !== 2
php
{ "resource": "" }
q16439
BaseDirective.namespaceModelClass
train
protected function namespaceModelClass(string $modelClassCandidate): string { return $this->namespaceClassName( $modelClassCandidate, (array) config('lighthouse.namespaces.models'),
php
{ "resource": "" }
q16440
NodeRegistry.registerModel
train
public function registerModel(string $typeName, string $modelName): self { $this->nodeResolver[$typeName] =
php
{ "resource": "" }
q16441
NodeRegistry.resolve
train
public function resolve($rootValue, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) { [$decodedType, $decodedId] = $args['id']; // Check if we have a resolver registered for the given type if (! $resolver = Arr::get($this->nodeResolver, $decodedType)) { throw new...
php
{ "resource": "" }
q16442
PartialParser.getFirstAndValidateType
train
protected static function getFirstAndValidateType(NodeList $list, string $expectedType): Node { if ($list->count() !== 1) { throw new ParseException('More than one definition
php
{ "resource": "" }
q16443
Pipeline.carry
train
protected function carry(): Closure { return function ($stack, $pipe) { return function ($passable) use ($stack, $pipe) { if ($this->always !== null) { $passable = ($this->always)($passable, $pipe);
php
{ "resource": "" }
q16444
GraphQL.executeRequest
train
public function executeRequest(GraphQLRequest $request): array { $result = $this->executeQuery( $request->query(), $this->createsContext->generate( app('request') ),
php
{ "resource": "" }
q16445
GraphQL.executeQuery
train
public function executeQuery( $query, GraphQLContext $context, ?array $variables = [], $rootValue = null, ?string $operationName = null ): ExecutionResult { // Building the executable schema might take a while to do, // so we do it before we fire the StartExec...
php
{ "resource": "" }
q16446
GraphQL.prepSchema
train
public function prepSchema(): Schema { if (empty($this->executableSchema)) { $this->executableSchema = $this->schemaBuilder->build(
php
{ "resource": "" }
q16447
GraphQL.getValidationRules
train
protected function getValidationRules(): array { return [ QueryComplexity::class => new QueryComplexity(config('lighthouse.security.max_query_complexity', 0)), QueryDepth::class => new QueryDepth(config('lighthouse.security.max_query_depth', 0)),
php
{ "resource": "" }
q16448
GraphQL.documentAST
train
public function documentAST(): DocumentAST { if (empty($this->documentAST)) { $this->documentAST = config('lighthouse.cache.enable') ? app('cache') ->rememberForever( config('lighthouse.cache.key'), function (): ...
php
{ "resource": "" }
q16449
GraphQL.buildAST
train
protected function buildAST(): DocumentAST { $schemaString = $this->schemaSourceProvider->getSchemaString(); // Allow to register listeners that add in additional schema definitions. // This can be used by plugins to hook into the schema building process // while still allowing the ...
php
{ "resource": "" }
q16450
OrderByDirective.handleBuilder
train
public function handleBuilder($builder, $value) { foreach ($value as $orderByClause) { $builder->orderBy( $orderByClause['field'],
php
{ "resource": "" }
q16451
OrderByDirective.manipulateSchema
train
public function manipulateSchema(InputValueDefinitionNode $argDefinition, FieldDefinitionNode $fieldDefinition, ObjectTypeDefinitionNode $parentType, DocumentAST $current) { $expectedOrderByClause = ASTHelper::cloneNode($argDefinition); // Users may define this as NonNull if they want if ($...
php
{ "resource": "" }
q16452
LighthouseServiceProvider.loadRoutesFrom
train
protected function loadRoutesFrom($path): void { if (Str::contains($this->app->version(), 'Lumen')) { require realpath($path);
php
{ "resource": "" }
q16453
NodeFactory.handle
train
public function handle(TypeDefinitionNode $definition): Type { $nodeValue = new NodeValue($definition); return $this->pipeline ->send($nodeValue) ->through( $this->directiveFactory->createNodeMiddleware($definition)
php
{ "resource": "" }
q16454
NodeFactory.resolveType
train
protected function resolveType(TypeDefinitionNode $typeDefinition): Type { // Ignore TypeExtensionNode since they are merged before we get here switch (get_class($typeDefinition)) { case EnumTypeDefinitionNode::class: return $this->resolveEnumType($typeDefinition); ...
php
{ "resource": "" }
q16455
NodeFactory.resolveFieldsFunction
train
protected function resolveFieldsFunction($definition): Closure { return function () use ($definition): array { return (new Collection($definition->fields)) ->mapWithKeys(function (FieldDefinitionNode $fieldDefinition) use ($definition): array { $fieldValue = n...
php
{ "resource": "" }
q16456
SchemaBuilder.build
train
public function build($documentAST) { /** @var \GraphQL\Language\AST\TypeDefinitionNode $typeDefinition */ foreach ($documentAST->typeDefinitions() as $typeDefinition) { $type = $this->nodeFactory->handle($typeDefinition); $this->typeRegistry->register($type); sw...
php
{ "resource": "" }
q16457
SchemaBuilder.convertDirectives
train
protected function convertDirectives(DocumentAST $document): Collection { return $document->directiveDefinitions() ->map(function (DirectiveDefinitionNode $directive) { return new Directive([ 'name' => $directive->name->value, 'description'...
php
{ "resource": "" }
q16458
DeferrableDirective.shouldDefer
train
protected function shouldDefer(TypeNode $fieldType, ResolveInfo $resolveInfo): bool { if (strtolower($resolveInfo->operation->operation) === 'mutation') { return false; } foreach ($resolveInfo->fieldNodes as $fieldNode) { $deferDirective = ASTHelper::directiveDefinit...
php
{ "resource": "" }
q16459
CanDirective.handleField
train
public function handleField(FieldValue $value, Closure $next): FieldValue { $previousResolver = $value->getResolver(); return $next( $value->setResolver( function ($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) use ($previousResolver) { ...
php
{ "resource": "" }
q16460
MutationExecutor.saveModelWithPotentialParent
train
protected static function saveModelWithPotentialParent(Model $model, Collection $args, ?Relation $parentRelation = null): Model { [$belongsTo, $remaining] = self::partitionArgsByRelationType( new ReflectionClass($model), $args, BelongsTo::class ); // Use ...
php
{ "resource": "" }
q16461
MutationExecutor.handleMultiRelationCreate
train
protected static function handleMultiRelationCreate(Collection $multiValues, Relation $relation): void { $multiValues->each(function ($singleValues) use ($relation): void {
php
{ "resource": "" }
q16462
MutationExecutor.handleSingleRelationCreate
train
protected static function handleSingleRelationCreate(Collection $singleValues, Relation $relation): void { self::executeCreate(
php
{ "resource": "" }
q16463
MutationExecutor.partitionArgsByRelationType
train
protected static function partitionArgsByRelationType(ReflectionClass $modelReflection, Collection $args, string $relationClass): Collection { return $args->partition( function ($value, string $key) use ($modelReflection, $relationClass): bool { if (! $modelReflection->hasMethod(...
php
{ "resource": "" }
q16464
BuilderDirective.handleBuilder
train
public function handleBuilder($builder, $value) { return call_user_func( $this->getResolverFromArgument('method'), $builder,
php
{ "resource": "" }
q16465
PusherBroadcaster.hook
train
public function hook(Request $request): JsonResponse { (new Collection($request->input('events', []))) ->filter(function ($event): bool { return Arr::get($event, 'name') === 'channel_vacated'; }) ->each(function (array $event): void {
php
{ "resource": "" }
q16466
BatchLoader.instance
train
public static function instance(string $loaderClass, array $pathToField, array $constructorArgs = []): self { // The path to the field serves as the unique key for the instance $instanceName = static::instanceKey($pathToField); // If we are resolving a batched query, we need to assign each ...
php
{ "resource": "" }
q16467
BatchLoader.instanceKey
train
public static function instanceKey(array $path): string { return (new Collection($path)) ->filter(function ($path): bool { // Ignore numeric path entries, as those signify an array of fields. // Combining the queries for those is the very purpose of the
php
{ "resource": "" }
q16468
BatchLoader.load
train
public function load($key, array $metaInfo = []): Deferred { $key = $this->buildKey($key); $this->keys[$key] = $metaInfo; return new Deferred(function () use ($key) { if (! $this->hasLoaded) {
php
{ "resource": "" }
q16469
AcceptJson.handle
train
public function handle(Request $request, Closure $next) {
php
{ "resource": "" }
q16470
ResponseStream.chunk
train
protected function chunk(array $data, bool $terminating): string { $json = json_encode($data, 0); $length = $terminating ? strlen($json) : strlen($json.self::EOL); $chunk = implode(self::EOL, [ 'Content-Type: application/json',
php
{ "resource": "" }
q16471
ResponseStream.emit
train
protected function emit(string $chunk): void { echo $chunk; $this->flush(Closure::fromCallable('ob_flush'));
php
{ "resource": "" }
q16472
SubscriptionRegistry.subscriptions
train
public function subscriptions(Subscriber $subscriber): Collection { // A subscription can be fired w/out a request so we must make // sure the schema has been generated. $this->graphQL->prepSchema(); return (new Collection($subscriber->query->definitions)) ->filter(funct...
php
{ "resource": "" }
q16473
DocumentAST.typeExtensionUniqueKey
train
protected function typeExtensionUniqueKey(TypeExtensionNode $typeExtensionNode): string { $fieldNames = (new Collection($typeExtensionNode->fields))
php
{ "resource": "" }
q16474
DocumentAST.fromSource
train
public static function fromSource(string $schema): self { try { return new static( Parser::parse( $schema, // Ignore location since it only bloats the AST ['noLocation' => true] ) ); }...
php
{ "resource": "" }
q16475
DocumentAST.serialize
train
public function serialize(): string { return serialize( $this->definitionMap ->mapWithKeys(function (DefinitionNode $node, string $key): array {
php
{ "resource": "" }
q16476
DocumentAST.unserialize
train
public function unserialize($serialized): void { $this->definitionMap = unserialize($serialized) ->mapWithKeys(function (array $node, string $key): array
php
{ "resource": "" }
q16477
DocumentAST.typeDefinitions
train
public function typeDefinitions(): Collection { return $this->definitionMap ->filter(function (DefinitionNode $node) { return $node instanceof ScalarTypeDefinitionNode || $node instanceof ObjectTypeDefinitionNode || $node instanceof Interfa...
php
{ "resource": "" }
q16478
DocumentAST.extensionsForType
train
public function extensionsForType(string $extendedTypeName): Collection { return $this->typeExtensionsMap
php
{ "resource": "" }
q16479
DocumentAST.objectTypeDefinition
train
public function objectTypeDefinition(string $name): ?ObjectTypeDefinitionNode { return $this->objectTypeDefinitions()
php
{ "resource": "" }
q16480
DocumentAST.definitionsByType
train
protected function definitionsByType(string $typeClassName): Collection { return $this->definitionMap ->filter(function (Node $node) use ($typeClassName) {
php
{ "resource": "" }
q16481
DocumentAST.addFieldToQueryType
train
public function addFieldToQueryType(FieldDefinitionNode $field): self { $query = $this->queryTypeDefinition(); $query->fields
php
{ "resource": "" }
q16482
SearchDirective.handleBuilder
train
public function handleBuilder($builder, $value) { $within = $this->directiveArgValue('within'); /** @var \Illuminate\Database\Eloquent\Model $modelClass */ $modelClass = get_class( $builder->getModel() ); /** @var \Laravel\Scout\Builder
php
{ "resource": "" }
q16483
DriverManager.driver
train
public function driver(?string $name = null) { $name = $name ?: $this->getDefaultDriver();
php
{ "resource": "" }
q16484
DriverManager.validateDriver
train
protected function validateDriver($driver) { $interface = $this->interface(); if (! (new ReflectionClass($driver))->implementsInterface($interface)) {
php
{ "resource": "" }
q16485
BroadcastManager.createPusherDriver
train
protected function createPusherDriver(array $config): PusherBroadcaster { $connection = $config['connection'] ?? 'pusher'; $driverConfig = config("broadcasting.connections.{$connection}"); if (empty($driverConfig) || $driverConfig['driver'] !== 'pusher') { throw new RuntimeExcep...
php
{ "resource": "" }
q16486
DateTime.serialize
train
public function serialize($value): string { if ($value instanceof Carbon) { return $value->toDateTimeString();
php
{ "resource": "" }
q16487
Stream.chunkError
train
protected function chunkError(string $path, array $data): ?array { if (! isset($data['errors'])) { return null; } return (new Collection($data['errors'])) ->filter(function (array $error) use ($path): bool {
php
{ "resource": "" }
q16488
PaginatorField.paginatorInfoResolver
train
public function paginatorInfoResolver(LengthAwarePaginator $root): array { return [ 'count' => $root->count(), 'currentPage' => $root->currentPage(), 'firstItem' => $root->firstItem(), 'hasMorePages' => $root->hasMorePages(),
php
{ "resource": "" }
q16489
SyncIterator.process
train
public function process(Collection $items, Closure $cb, Closure $error = null): void { $items->each(function ($item) use ($cb, $error): void {
php
{ "resource": "" }
q16490
DirectiveFactory.create
train
public function create(string $directiveName, $definitionNode = null): Directive { $directive = $this->resolve($directiveName) ?? $this->createOrFail($directiveName);
php
{ "resource": "" }
q16491
DirectiveFactory.resolve
train
protected function resolve(string $directiveName): ?Directive { if ($className = Arr::get($this->resolved, $directiveName)) {
php
{ "resource": "" }
q16492
DirectiveFactory.hydrate
train
protected function hydrate(Directive $directive, $definitionNode): Directive { return $directive instanceof BaseDirective
php
{ "resource": "" }
q16493
DirectiveFactory.createAssociatedDirectivesOfType
train
protected function createAssociatedDirectivesOfType(Node $node, string $directiveClass): Collection { return (new Collection($node->directives)) ->map(function (DirectiveNode $directive) use ($node) { return $this->create($directive->name->value, $node); })
php
{ "resource": "" }
q16494
DirectiveFactory.createSingleDirectiveOfType
train
protected function createSingleDirectiveOfType(Node $node, string $directiveClass): ?Directive { $directives = $this->createAssociatedDirectivesOfType($node, $directiveClass); if ($directives->count() > 1) { $directiveNames = $directives->implode(', '); throw new DirectiveE...
php
{ "resource": "" }
q16495
ArgumentFactory.handle
train
public function handle(ArgumentValue $argumentValue): array { $definition = $argumentValue->getAstNode(); $argumentType = $argumentValue->getType(); $fieldArgument = [ 'name' => $argumentValue->getName(), 'description' => data_get($definition->description, 'value'),...
php
{ "resource": "" }
q16496
WithDirective.handleField
train
public function handleField(FieldValue $value, Closure $next): FieldValue { $resolver = $value->getResolver(); return $next( $value->setResolver( function (Model $parent, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) use ($resolver): Deferred { ...
php
{ "resource": "" }
q16497
ErrorBuffer.defaultExceptionResolver
train
protected function defaultExceptionResolver(): Closure { return function (string $errorMessage) { return (new GenericException($errorMessage))
php
{ "resource": "" }
q16498
ErrorBuffer.push
train
public function push(string $errorMessage, ?string $key = null): self { if ($key === null) { $this->errors[] = $errorMessage; } else {
php
{ "resource": "" }
q16499
ErrorBuffer.flush
train
public function flush(string $errorMessage): void { if (! $this->hasErrors()) { return; }
php
{ "resource": "" }