repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
nuwave/lighthouse
src/Schema/Factories/FieldFactory.php
FieldFactory.getInputValueDefinitions
protected function getInputValueDefinitions(Collection $argumentValues): array { return $argumentValues ->mapWithKeys(function (ArgumentValue $argumentValue): array { return [ $argumentValue->getName() => $this->argumentFactory->handle($argumentValue), ...
php
protected function getInputValueDefinitions(Collection $argumentValues): array { return $argumentValues ->mapWithKeys(function (ArgumentValue $argumentValue): array { return [ $argumentValue->getName() => $this->argumentFactory->handle($argumentValue), ...
[ "protected", "function", "getInputValueDefinitions", "(", "Collection", "$", "argumentValues", ")", ":", "array", "{", "return", "$", "argumentValues", "->", "mapWithKeys", "(", "function", "(", "ArgumentValue", "$", "argumentValue", ")", ":", "array", "{", "retur...
Transform the ArgumentValues into the final InputValueDefinitions. @param \Illuminate\Support\Collection<ArgumentValue> $argumentValues @return \GraphQL\Language\AST\InputValueDefinitionNode[]
[ "Transform", "the", "ArgumentValues", "into", "the", "final", "InputValueDefinitions", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/FieldFactory.php#L503-L512
train
nuwave/lighthouse
src/Execution/ExtensionErrorHandler.php
ExtensionErrorHandler.handle
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
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...
[ "public", "static", "function", "handle", "(", "Error", "$", "error", ",", "Closure", "$", "next", ")", ":", "array", "{", "$", "underlyingException", "=", "$", "error", "->", "getPrevious", "(", ")", ";", "if", "(", "$", "underlyingException", "instanceof...
Handle Exceptions that implement Nuwave\Lighthouse\Exceptions\RendersErrorsExtensions and add extra content from them to the 'extensions' key of the Error that is rendered to the User. @param \GraphQL\Error\Error $error @param \Closure $next @return array
[ "Handle", "Exceptions", "that", "implement", "Nuwave", "\\", "Lighthouse", "\\", "Exceptions", "\\", "RendersErrorsExtensions", "and", "add", "extra", "content", "from", "them", "to", "the", "extensions", "key", "of", "the", "Error", "that", "is", "rendered", "t...
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/ExtensionErrorHandler.php#L20-L38
train
nuwave/lighthouse
src/Subscriptions/Serializer.php
Serializer.serialize
public function serialize(GraphQLContext $context): string { $request = $context->request(); return serialize([ 'request' => [ 'query' => $request->query->all(), 'request' => $request->request->all(), 'attributes' => $request->attributes->...
php
public function serialize(GraphQLContext $context): string { $request = $context->request(); return serialize([ 'request' => [ 'query' => $request->query->all(), 'request' => $request->request->all(), 'attributes' => $request->attributes->...
[ "public", "function", "serialize", "(", "GraphQLContext", "$", "context", ")", ":", "string", "{", "$", "request", "=", "$", "context", "->", "request", "(", ")", ";", "return", "serialize", "(", "[", "'request'", "=>", "[", "'query'", "=>", "$", "reques...
Serialize the context. @param \Nuwave\Lighthouse\Support\Contracts\GraphQLContext $context @return string
[ "Serialize", "the", "context", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/Serializer.php#L33-L49
train
nuwave/lighthouse
src/Subscriptions/Serializer.php
Serializer.unserialize
public function unserialize(string $context): GraphQLContext { [ 'request' => $rawRequest, 'user' => $rawUser ] = unserialize($context); $request = new Request( $rawRequest['query'], $rawRequest['request'], $rawRequest['attributes'...
php
public function unserialize(string $context): GraphQLContext { [ 'request' => $rawRequest, 'user' => $rawUser ] = unserialize($context); $request = new Request( $rawRequest['query'], $rawRequest['request'], $rawRequest['attributes'...
[ "public", "function", "unserialize", "(", "string", "$", "context", ")", ":", "GraphQLContext", "{", "[", "'request'", "=>", "$", "rawRequest", ",", "'user'", "=>", "$", "rawUser", "]", "=", "unserialize", "(", "$", "context", ")", ";", "$", "request", "...
Unserialize the context. @param string $context @return \Nuwave\Lighthouse\Support\Contracts\GraphQLContext
[ "Unserialize", "the", "context", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/Serializer.php#L57-L81
train
nuwave/lighthouse
src/Execution/LighthouseRequest.php
LighthouseRequest.variables
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) ?? []; } // If t...
php
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) ?? []; } // If t...
[ "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", ...
Get the given variables for the query. @return mixed[]
[ "Get", "the", "given", "variables", "for", "the", "query", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/LighthouseRequest.php#L38-L50
train
nuwave/lighthouse
src/Execution/LighthouseRequest.php
LighthouseRequest.fieldValue
protected function fieldValue(string $key) { return $this->request->input($key) ?? $this->request->input("{$this->batchIndex}.{$key}"); }
php
protected function fieldValue(string $key) { return $this->request->input($key) ?? $this->request->input("{$this->batchIndex}.{$key}"); }
[ "protected", "function", "fieldValue", "(", "string", "$", "key", ")", "{", "return", "$", "this", "->", "request", "->", "input", "(", "$", "key", ")", "??", "$", "this", "->", "request", "->", "input", "(", "\"{$this->batchIndex}.{$key}\"", ")", ";", "...
Get the contents of a field by key. This is expected to take batched requests into consideration. @param string $key @return array|string|null
[ "Get", "the", "contents", "of", "a", "field", "by", "key", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/LighthouseRequest.php#L70-L74
train
nuwave/lighthouse
src/Execution/QueryFilter.php
QueryFilter.getInstance
public static function getInstance(FieldValue $value): self { $handler = 'query.filter' .'.'.strtolower($value->getParentName()) .'.'.strtolower($value->getFieldName()); // Get an existing instance or register a new one return app()->bound($handler) ? app...
php
public static function getInstance(FieldValue $value): self { $handler = 'query.filter' .'.'.strtolower($value->getParentName()) .'.'.strtolower($value->getFieldName()); // Get an existing instance or register a new one return app()->bound($handler) ? app...
[ "public", "static", "function", "getInstance", "(", "FieldValue", "$", "value", ")", ":", "self", "{", "$", "handler", "=", "'query.filter'", ".", "'.'", ".", "strtolower", "(", "$", "value", "->", "getParentName", "(", ")", ")", ".", "'.'", ".", "strtol...
Get the single instance of the query filter for a field. @param \Nuwave\Lighthouse\Schema\Values\FieldValue $value @return static
[ "Get", "the", "single", "instance", "of", "the", "query", "filter", "for", "a", "field", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/QueryFilter.php#L48-L58
train
nuwave/lighthouse
src/Execution/QueryFilter.php
QueryFilter.apply
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); } foreach...
php
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); } foreach...
[ "public", "static", "function", "apply", "(", "$", "query", ",", "array", "$", "args", ",", "array", "$", "scopes", ",", "ResolveInfo", "$", "resolveInfo", ")", "{", "/** @var \\Nuwave\\Lighthouse\\Execution\\QueryFilter $queryFilter */", "if", "(", "$", "queryFilte...
Check if the ResolveInfo contains a QueryFilter instance and apply it to the query if given. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query @param array $args @param string[] $scopes @param \GraphQL\Type\Definition\ResolveInfo $resolveInfo @return \Illuminate\Database\Qu...
[ "Check", "if", "the", "ResolveInfo", "contains", "a", "QueryFilter", "instance", "and", "apply", "it", "to", "the", "query", "if", "given", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/QueryFilter.php#L69-L81
train
nuwave/lighthouse
src/Execution/QueryFilter.php
QueryFilter.filter
public function filter($query, array $args = []) { $valuesGroupedByFilterKey = []; /** * @var string * @var mixed $value */ foreach ($args as $key => $value) { /** * @var string * @var string[] $argNames */ ...
php
public function filter($query, array $args = []) { $valuesGroupedByFilterKey = []; /** * @var string * @var mixed $value */ foreach ($args as $key => $value) { /** * @var string * @var string[] $argNames */ ...
[ "public", "function", "filter", "(", "$", "query", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "valuesGroupedByFilterKey", "=", "[", "]", ";", "/**\n * @var string\n * @var mixed $value\n */", "foreach", "(", "$", "args", "as"...
Apply all registered filters to the query. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query @param array $args @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
[ "Apply", "all", "registered", "filters", "to", "the", "query", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/QueryFilter.php#L90-L135
train
nuwave/lighthouse
src/Execution/QueryFilter.php
QueryFilter.addArgumentFilter
public function addArgumentFilter(string $argumentName, string $columnName, ArgFilterDirective $argFilterDirective): self { if ($argFilterDirective->combinesMultipleArguments()) { $filterKey = "{$columnName}.{$argFilterDirective->name()}"; $this->multiArgumentFilters[$filterKey] = $...
php
public function addArgumentFilter(string $argumentName, string $columnName, ArgFilterDirective $argFilterDirective): self { if ($argFilterDirective->combinesMultipleArguments()) { $filterKey = "{$columnName}.{$argFilterDirective->name()}"; $this->multiArgumentFilters[$filterKey] = $...
[ "public", "function", "addArgumentFilter", "(", "string", "$", "argumentName", ",", "string", "$", "columnName", ",", "ArgFilterDirective", "$", "argFilterDirective", ")", ":", "self", "{", "if", "(", "$", "argFilterDirective", "->", "combinesMultipleArguments", "("...
Add the argument filter. @param string $argumentName @param string $columnName @param \Nuwave\Lighthouse\Support\Contracts\ArgFilterDirective $argFilterDirective @return $this
[ "Add", "the", "argument", "filter", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/QueryFilter.php#L145-L160
train
nuwave/lighthouse
src/Schema/Directives/WhereDirective.php
WhereDirective.handleBuilder
public function handleBuilder($builder, $value) { // Allow users to overwrite the default "where" clause, e.g. "whereYear" $clause = $this->directiveArgValue('clause', 'where'); return $builder->{$clause}( $this->directiveArgValue('key', $this->definitionNode->name->value), ...
php
public function handleBuilder($builder, $value) { // Allow users to overwrite the default "where" clause, e.g. "whereYear" $clause = $this->directiveArgValue('clause', 'where'); return $builder->{$clause}( $this->directiveArgValue('key', $this->definitionNode->name->value), ...
[ "public", "function", "handleBuilder", "(", "$", "builder", ",", "$", "value", ")", "{", "// Allow users to overwrite the default \"where\" clause, e.g. \"whereYear\"", "$", "clause", "=", "$", "this", "->", "directiveArgValue", "(", "'clause'", ",", "'where'", ")", "...
Add any "WHERE" clause to the builder. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $builder @param mixed $value @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
[ "Add", "any", "WHERE", "clause", "to", "the", "builder", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/WhereDirective.php#L26-L36
train
nuwave/lighthouse
src/Subscriptions/SubscriptionServiceProvider.php
SubscriptionServiceProvider.register
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
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...
[ "public", "function", "register", "(", ")", ":", "void", "{", "$", "this", "->", "app", "->", "singleton", "(", "BroadcastManager", "::", "class", ")", ";", "$", "this", "->", "app", "->", "singleton", "(", "SubscriptionRegistry", "::", "class", ")", ";"...
Register subscription services. @return void
[ "Register", "subscription", "services", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/SubscriptionServiceProvider.php#L65-L77
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.mergeUniqueNodeList
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
public static function mergeUniqueNodeList($original, $addition, bool $overwriteDuplicates = false): NodeList { $newNames = (new Collection($addition)) ->pluck('name.value') ->filter() ->all(); $remainingDefinitions = (new Collection($original)) ->rej...
[ "public", "static", "function", "mergeUniqueNodeList", "(", "$", "original", ",", "$", "addition", ",", "bool", "$", "overwriteDuplicates", "=", "false", ")", ":", "NodeList", "{", "$", "newNames", "=", "(", "new", "Collection", "(", "$", "addition", ")", ...
This function will merge two lists uniquely by name. @param \GraphQL\Language\AST\NodeList|array $original @param \GraphQL\Language\AST\NodeList|array $addition @param bool $overwriteDuplicates By default this throws if a collision occurs. If this is set to true, the fields of the original list will be overwritt...
[ "This", "function", "will", "merge", "two", "lists", "uniquely", "by", "name", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L54-L81
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.directiveHasArgument
public static function directiveHasArgument(DirectiveNode $directiveDefinition, string $name): bool { return (new Collection($directiveDefinition->arguments)) ->contains(function (ArgumentNode $argumentNode) use ($name): bool { return $argumentNode->name->value === $name; ...
php
public static function directiveHasArgument(DirectiveNode $directiveDefinition, string $name): bool { return (new Collection($directiveDefinition->arguments)) ->contains(function (ArgumentNode $argumentNode) use ($name): bool { return $argumentNode->name->value === $name; ...
[ "public", "static", "function", "directiveHasArgument", "(", "DirectiveNode", "$", "directiveDefinition", ",", "string", "$", "name", ")", ":", "bool", "{", "return", "(", "new", "Collection", "(", "$", "directiveDefinition", "->", "arguments", ")", ")", "->", ...
Does the given directive have an argument of the given name? @param \GraphQL\Language\AST\DirectiveNode $directiveDefinition @param string $name @return bool
[ "Does", "the", "given", "directive", "have", "an", "argument", "of", "the", "given", "name?" ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L140-L146
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.argValue
public static function argValue(ArgumentNode $arg, $default = null) { $valueNode = $arg->value; if (! $valueNode) { return $default; } return AST::valueFromASTUntyped($valueNode); }
php
public static function argValue(ArgumentNode $arg, $default = null) { $valueNode = $arg->value; if (! $valueNode) { return $default; } return AST::valueFromASTUntyped($valueNode); }
[ "public", "static", "function", "argValue", "(", "ArgumentNode", "$", "arg", ",", "$", "default", "=", "null", ")", "{", "$", "valueNode", "=", "$", "arg", "->", "value", ";", "if", "(", "!", "$", "valueNode", ")", "{", "return", "$", "default", ";",...
Get argument's value. @param \GraphQL\Language\AST\ArgumentNode $arg @param mixed $default @return mixed
[ "Get", "argument", "s", "value", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L173-L182
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.directiveDefinition
public static function directiveDefinition(Node $definitionNode, string $name): ?DirectiveNode { return (new Collection($definitionNode->directives)) ->first(function (DirectiveNode $directiveDefinitionNode) use ($name): bool { return $directiveDefinitionNode->name->value === $na...
php
public static function directiveDefinition(Node $definitionNode, string $name): ?DirectiveNode { return (new Collection($definitionNode->directives)) ->first(function (DirectiveNode $directiveDefinitionNode) use ($name): bool { return $directiveDefinitionNode->name->value === $na...
[ "public", "static", "function", "directiveDefinition", "(", "Node", "$", "definitionNode", ",", "string", "$", "name", ")", ":", "?", "DirectiveNode", "{", "return", "(", "new", "Collection", "(", "$", "definitionNode", "->", "directives", ")", ")", "->", "f...
This can be at most one directive, since directives can only be used once per location. @param \GraphQL\Language\AST\Node $definitionNode @param string $name @return \GraphQL\Language\AST\DirectiveNode|null
[ "This", "can", "be", "at", "most", "one", "directive", "since", "directives", "can", "only", "be", "used", "once", "per", "location", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L191-L197
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.hasDirectiveDefinition
public static function hasDirectiveDefinition(Node $definitionNode, string $name): bool { return (new Collection($definitionNode->directives)) ->contains(function (DirectiveNode $directiveDefinitionNode) use ($name): bool { return $directiveDefinitionNode->name->value === $name; ...
php
public static function hasDirectiveDefinition(Node $definitionNode, string $name): bool { return (new Collection($definitionNode->directives)) ->contains(function (DirectiveNode $directiveDefinitionNode) use ($name): bool { return $directiveDefinitionNode->name->value === $name; ...
[ "public", "static", "function", "hasDirectiveDefinition", "(", "Node", "$", "definitionNode", ",", "string", "$", "name", ")", ":", "bool", "{", "return", "(", "new", "Collection", "(", "$", "definitionNode", "->", "directives", ")", ")", "->", "contains", "...
Check if a node has a particular directive defined upon it. @param \GraphQL\Language\AST\Node $definitionNode @param string $name @return bool
[ "Check", "if", "a", "node", "has", "a", "particular", "directive", "defined", "upon", "it", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L206-L212
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.attachDirectiveToObjectTypeFields
public static function attachDirectiveToObjectTypeFields(DocumentAST $documentAST, DirectiveNode $directive): DocumentAST { return $documentAST->objectTypeDefinitions() ->reduce( function (DocumentAST $document, ObjectTypeDefinitionNode $objectType) use ($directive): DocumentAST ...
php
public static function attachDirectiveToObjectTypeFields(DocumentAST $documentAST, DirectiveNode $directive): DocumentAST { return $documentAST->objectTypeDefinitions() ->reduce( function (DocumentAST $document, ObjectTypeDefinitionNode $objectType) use ($directive): DocumentAST ...
[ "public", "static", "function", "attachDirectiveToObjectTypeFields", "(", "DocumentAST", "$", "documentAST", ",", "DirectiveNode", "$", "directive", ")", ":", "DocumentAST", "{", "return", "$", "documentAST", "->", "objectTypeDefinitions", "(", ")", "->", "reduce", ...
Attach directive to all registered object type fields. @param \Nuwave\Lighthouse\Schema\AST\DocumentAST $documentAST @param \GraphQL\Language\AST\DirectiveNode $directive @return \Nuwave\Lighthouse\Schema\AST\DocumentAST
[ "Attach", "directive", "to", "all", "registered", "object", "type", "fields", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L243-L268
train
nuwave/lighthouse
src/Schema/AST/ASTHelper.php
ASTHelper.attachNodeInterfaceToObjectType
public static function attachNodeInterfaceToObjectType(ObjectTypeDefinitionNode $objectType, DocumentAST $documentAST): DocumentAST { $objectType->interfaces = self::mergeNodeList( $objectType->interfaces, [ Parser::parseType( 'Node', ...
php
public static function attachNodeInterfaceToObjectType(ObjectTypeDefinitionNode $objectType, DocumentAST $documentAST): DocumentAST { $objectType->interfaces = self::mergeNodeList( $objectType->interfaces, [ Parser::parseType( 'Node', ...
[ "public", "static", "function", "attachNodeInterfaceToObjectType", "(", "ObjectTypeDefinitionNode", "$", "objectType", ",", "DocumentAST", "$", "documentAST", ")", ":", "DocumentAST", "{", "$", "objectType", "->", "interfaces", "=", "self", "::", "mergeNodeList", "(",...
This adds an Interface called "Node" to an ObjectType definition. @param \GraphQL\Language\AST\ObjectTypeDefinitionNode $objectType @param \Nuwave\Lighthouse\Schema\AST\DocumentAST $documentAST @return \Nuwave\Lighthouse\Schema\AST\DocumentAST
[ "This", "adds", "an", "Interface", "called", "Node", "to", "an", "ObjectType", "definition", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTHelper.php#L277-L295
train
nuwave/lighthouse
src/Pagination/ConnectionField.php
ConnectionField.pageInfoResolver
public function pageInfoResolver(LengthAwarePaginator $paginator): array { return [ 'total' => $paginator->total(), 'count' => $paginator->count(), 'currentPage' => $paginator->currentPage(), 'lastPage' => $paginator->lastPage(), 'hasNextPage' => $...
php
public function pageInfoResolver(LengthAwarePaginator $paginator): array { return [ 'total' => $paginator->total(), 'count' => $paginator->count(), 'currentPage' => $paginator->currentPage(), 'lastPage' => $paginator->lastPage(), 'hasNextPage' => $...
[ "public", "function", "pageInfoResolver", "(", "LengthAwarePaginator", "$", "paginator", ")", ":", "array", "{", "return", "[", "'total'", "=>", "$", "paginator", "->", "total", "(", ")", ",", "'count'", "=>", "$", "paginator", "->", "count", "(", ")", ","...
Resolve page info for connection. @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator @return array
[ "Resolve", "page", "info", "for", "connection", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/ConnectionField.php#L16-L32
train
nuwave/lighthouse
src/Pagination/ConnectionField.php
ConnectionField.edgeResolver
public function edgeResolver(LengthAwarePaginator $paginator): Collection { $firstItem = $paginator->firstItem(); return $paginator->values()->map(function ($item, $index) use ($firstItem) { return [ 'cursor' => Cursor::encode($firstItem + $index), 'node'...
php
public function edgeResolver(LengthAwarePaginator $paginator): Collection { $firstItem = $paginator->firstItem(); return $paginator->values()->map(function ($item, $index) use ($firstItem) { return [ 'cursor' => Cursor::encode($firstItem + $index), 'node'...
[ "public", "function", "edgeResolver", "(", "LengthAwarePaginator", "$", "paginator", ")", ":", "Collection", "{", "$", "firstItem", "=", "$", "paginator", "->", "firstItem", "(", ")", ";", "return", "$", "paginator", "->", "values", "(", ")", "->", "map", ...
Resolve edges for connection. @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator @return \Illuminate\Support\Collection
[ "Resolve", "edges", "for", "connection", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/ConnectionField.php#L40-L50
train
nuwave/lighthouse
src/Execution/DataLoader/RelationBatchLoader.php
RelationBatchLoader.resolve
public function resolve(): array { $modelRelationFetcher = $this->getRelationFetcher(); if ($this->first !== null) { $modelRelationFetcher->loadRelationsForPage($this->first, $this->page); } else { $modelRelationFetcher->loadRelations(); } return $mo...
php
public function resolve(): array { $modelRelationFetcher = $this->getRelationFetcher(); if ($this->first !== null) { $modelRelationFetcher->loadRelationsForPage($this->first, $this->page); } else { $modelRelationFetcher->loadRelations(); } return $mo...
[ "public", "function", "resolve", "(", ")", ":", "array", "{", "$", "modelRelationFetcher", "=", "$", "this", "->", "getRelationFetcher", "(", ")", ";", "if", "(", "$", "this", "->", "first", "!==", "null", ")", "{", "$", "modelRelationFetcher", "->", "lo...
Resolve the keys. @return mixed[]
[ "Resolve", "the", "keys", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/RelationBatchLoader.php#L82-L93
train
nuwave/lighthouse
src/Execution/DataLoader/RelationBatchLoader.php
RelationBatchLoader.getRelationFetcher
protected function getRelationFetcher(): ModelRelationFetcher { return new ModelRelationFetcher( $this->getParentModels(), [$this->relationName => function ($query) { return $this->resolveInfo ->builder ->addScopes($this->scopes...
php
protected function getRelationFetcher(): ModelRelationFetcher { return new ModelRelationFetcher( $this->getParentModels(), [$this->relationName => function ($query) { return $this->resolveInfo ->builder ->addScopes($this->scopes...
[ "protected", "function", "getRelationFetcher", "(", ")", ":", "ModelRelationFetcher", "{", "return", "new", "ModelRelationFetcher", "(", "$", "this", "->", "getParentModels", "(", ")", ",", "[", "$", "this", "->", "relationName", "=>", "function", "(", "$", "q...
Construct a new instance of a relation fetcher. @return \Nuwave\Lighthouse\Execution\DataLoader\ModelRelationFetcher
[ "Construct", "a", "new", "instance", "of", "a", "relation", "fetcher", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/RelationBatchLoader.php#L100-L111
train
nuwave/lighthouse
src/Schema/Directives/BaseDirective.php
BaseDirective.getResolverFromArgument
public function getResolverFromArgument(string $argumentName): Closure { [$className, $methodName] = $this->getMethodArgumentParts($argumentName); $namespacedClassName = $this->namespaceClassName($className); return Utils::constructResolver($namespacedClassName, $methodName); }
php
public function getResolverFromArgument(string $argumentName): Closure { [$className, $methodName] = $this->getMethodArgumentParts($argumentName); $namespacedClassName = $this->namespaceClassName($className); return Utils::constructResolver($namespacedClassName, $methodName); }
[ "public", "function", "getResolverFromArgument", "(", "string", "$", "argumentName", ")", ":", "Closure", "{", "[", "$", "className", ",", "$", "methodName", "]", "=", "$", "this", "->", "getMethodArgumentParts", "(", "$", "argumentName", ")", ";", "$", "nam...
Get a Closure that is defined through an argument on the directive. @param string $argumentName @return \Closure
[ "Get", "a", "Closure", "that", "is", "defined", "through", "an", "argument", "on", "the", "directive", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/BaseDirective.php#L88-L95
train
nuwave/lighthouse
src/Schema/Directives/BaseDirective.php
BaseDirective.getMethodArgumentParts
protected function getMethodArgumentParts(string $argumentName): array { $argumentParts = explode( '@', $this->directiveArgValue($argumentName) ); if ( count($argumentParts) !== 2 || empty($argumentParts[0]) || empty($argumentParts...
php
protected function getMethodArgumentParts(string $argumentName): array { $argumentParts = explode( '@', $this->directiveArgValue($argumentName) ); if ( count($argumentParts) !== 2 || empty($argumentParts[0]) || empty($argumentParts...
[ "protected", "function", "getMethodArgumentParts", "(", "string", "$", "argumentName", ")", ":", "array", "{", "$", "argumentParts", "=", "explode", "(", "'@'", ",", "$", "this", "->", "directiveArgValue", "(", "$", "argumentName", ")", ")", ";", "if", "(", ...
Split a single method argument into its parts. A method argument is expected to contain a class and a method name, separated by an @ symbol. e.g. "App\My\Class@methodName" This validates that exactly two parts are given and are not empty. @param string $argumentName @return string[] Contains two entries: [string $c...
[ "Split", "a", "single", "method", "argument", "into", "its", "parts", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/BaseDirective.php#L177-L195
train
nuwave/lighthouse
src/Schema/Directives/BaseDirective.php
BaseDirective.namespaceModelClass
protected function namespaceModelClass(string $modelClassCandidate): string { return $this->namespaceClassName( $modelClassCandidate, (array) config('lighthouse.namespaces.models'), function (string $classCandidate): bool { return is_subclass_of($classCand...
php
protected function namespaceModelClass(string $modelClassCandidate): string { return $this->namespaceClassName( $modelClassCandidate, (array) config('lighthouse.namespaces.models'), function (string $classCandidate): bool { return is_subclass_of($classCand...
[ "protected", "function", "namespaceModelClass", "(", "string", "$", "modelClassCandidate", ")", ":", "string", "{", "return", "$", "this", "->", "namespaceClassName", "(", "$", "modelClassCandidate", ",", "(", "array", ")", "config", "(", "'lighthouse.namespaces.mod...
Try adding the default model namespace and ensure the given class is a model. @param string $modelClassCandidate @return string
[ "Try", "adding", "the", "default", "model", "namespace", "and", "ensure", "the", "given", "class", "is", "a", "model", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/BaseDirective.php#L203-L212
train
nuwave/lighthouse
src/Schema/NodeRegistry.php
NodeRegistry.registerModel
public function registerModel(string $typeName, string $modelName): self { $this->nodeResolver[$typeName] = function ($id) use ($modelName) { return $modelName::find($id); }; return $this; }
php
public function registerModel(string $typeName, string $modelName): self { $this->nodeResolver[$typeName] = function ($id) use ($modelName) { return $modelName::find($id); }; return $this; }
[ "public", "function", "registerModel", "(", "string", "$", "typeName", ",", "string", "$", "modelName", ")", ":", "self", "{", "$", "this", "->", "nodeResolver", "[", "$", "typeName", "]", "=", "function", "(", "$", "id", ")", "use", "(", "$", "modelNa...
Register an Eloquent model that can be resolved as a Node. @param string $typeName @param string $modelName @return $this
[ "Register", "an", "Eloquent", "model", "that", "can", "be", "resolved", "as", "a", "Node", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/NodeRegistry.php#L79-L86
train
nuwave/lighthouse
src/Schema/NodeRegistry.php
NodeRegistry.resolve
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
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...
[ "public", "function", "resolve", "(", "$", "rootValue", ",", "array", "$", "args", ",", "GraphQLContext", "$", "context", ",", "ResolveInfo", "$", "resolveInfo", ")", "{", "[", "$", "decodedType", ",", "$", "decodedId", "]", "=", "$", "args", "[", "'id'"...
Get the appropriate resolver for the node and call it with the decoded id. @param mixed|null $rootValue @param array $args @param \Nuwave\Lighthouse\Support\Contracts\GraphQLContext $context @param \GraphQL\Type\Definition\ResolveInfo $resolveInfo @return mixed @throws \GraphQL\Error\Error
[ "Get", "the", "appropriate", "resolver", "for", "the", "node", "and", "call", "it", "with", "the", "decoded", "id", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/NodeRegistry.php#L99-L112
train
nuwave/lighthouse
src/Schema/AST/PartialParser.php
PartialParser.getFirstAndValidateType
protected static function getFirstAndValidateType(NodeList $list, string $expectedType): Node { if ($list->count() !== 1) { throw new ParseException('More than one definition was found in the passed in schema.'); } $node = $list[0]; return self::validateType($node, $exp...
php
protected static function getFirstAndValidateType(NodeList $list, string $expectedType): Node { if ($list->count() !== 1) { throw new ParseException('More than one definition was found in the passed in schema.'); } $node = $list[0]; return self::validateType($node, $exp...
[ "protected", "static", "function", "getFirstAndValidateType", "(", "NodeList", "$", "list", ",", "string", "$", "expectedType", ")", ":", "Node", "{", "if", "(", "$", "list", "->", "count", "(", ")", "!==", "1", ")", "{", "throw", "new", "ParseException", ...
Get the first Node from a given NodeList and validate it. @param \GraphQL\Language\AST\NodeList $list @param string $expectedType @return \GraphQL\Language\AST\Node @throws \Nuwave\Lighthouse\Exceptions\ParseException
[ "Get", "the", "first", "Node", "from", "a", "given", "NodeList", "and", "validate", "it", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/PartialParser.php#L297-L306
train
nuwave/lighthouse
src/Support/Pipeline.php
Pipeline.carry
protected function carry(): Closure { return function ($stack, $pipe) { return function ($passable) use ($stack, $pipe) { if ($this->always !== null) { $passable = ($this->always)($passable, $pipe); } $slice = parent::carry(); ...
php
protected function carry(): Closure { return function ($stack, $pipe) { return function ($passable) use ($stack, $pipe) { if ($this->always !== null) { $passable = ($this->always)($passable, $pipe); } $slice = parent::carry(); ...
[ "protected", "function", "carry", "(", ")", ":", "Closure", "{", "return", "function", "(", "$", "stack", ",", "$", "pipe", ")", "{", "return", "function", "(", "$", "passable", ")", "use", "(", "$", "stack", ",", "$", "pipe", ")", "{", "if", "(", ...
Get a \Closure that represents a slice of the application onion. @return \Closure
[ "Get", "a", "\\", "Closure", "that", "represents", "a", "slice", "of", "the", "application", "onion", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Pipeline.php#L33-L47
train
nuwave/lighthouse
src/GraphQL.php
GraphQL.executeRequest
public function executeRequest(GraphQLRequest $request): array { $result = $this->executeQuery( $request->query(), $this->createsContext->generate( app('request') ), $request->variables(), null, $request->operationName()...
php
public function executeRequest(GraphQLRequest $request): array { $result = $this->executeQuery( $request->query(), $this->createsContext->generate( app('request') ), $request->variables(), null, $request->operationName()...
[ "public", "function", "executeRequest", "(", "GraphQLRequest", "$", "request", ")", ":", "array", "{", "$", "result", "=", "$", "this", "->", "executeQuery", "(", "$", "request", "->", "query", "(", ")", ",", "$", "this", "->", "createsContext", "->", "g...
Execute a set of batched queries on the lighthouse schema and return a collection of ExecutionResults. @param \Nuwave\Lighthouse\Execution\GraphQLRequest $request @return mixed[]
[ "Execute", "a", "set", "of", "batched", "queries", "on", "the", "lighthouse", "schema", "and", "return", "a", "collection", "of", "ExecutionResults", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/GraphQL.php#L121-L134
train
nuwave/lighthouse
src/GraphQL.php
GraphQL.executeQuery
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
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...
[ "public", "function", "executeQuery", "(", "$", "query", ",", "GraphQLContext", "$", "context", ",", "?", "array", "$", "variables", "=", "[", "]", ",", "$", "rootValue", "=", "null", ",", "?", "string", "$", "operationName", "=", "null", ")", ":", "Ex...
Execute a GraphQL query on the Lighthouse schema and return the raw ExecutionResult. To render the ExecutionResult, you will probably want to call `->toArray($debug)` on it, with $debug being a combination of flags in \GraphQL\Error\Debug @param string|\GraphQL\Language\AST\DocumentNode $query @param \Nuwave\Light...
[ "Execute", "a", "GraphQL", "query", "on", "the", "Lighthouse", "schema", "and", "return", "the", "raw", "ExecutionResult", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/GraphQL.php#L167-L231
train
nuwave/lighthouse
src/GraphQL.php
GraphQL.prepSchema
public function prepSchema(): Schema { if (empty($this->executableSchema)) { $this->executableSchema = $this->schemaBuilder->build( $this->documentAST() ); } return $this->executableSchema; }
php
public function prepSchema(): Schema { if (empty($this->executableSchema)) { $this->executableSchema = $this->schemaBuilder->build( $this->documentAST() ); } return $this->executableSchema; }
[ "public", "function", "prepSchema", "(", ")", ":", "Schema", "{", "if", "(", "empty", "(", "$", "this", "->", "executableSchema", ")", ")", "{", "$", "this", "->", "executableSchema", "=", "$", "this", "->", "schemaBuilder", "->", "build", "(", "$", "t...
Ensure an executable GraphQL schema is present. @return \GraphQL\Type\Schema
[ "Ensure", "an", "executable", "GraphQL", "schema", "is", "present", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/GraphQL.php#L238-L247
train
nuwave/lighthouse
src/GraphQL.php
GraphQL.getValidationRules
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)), DisableIntrospection::cla...
php
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)), DisableIntrospection::cla...
[ "protected", "function", "getValidationRules", "(", ")", ":", "array", "{", "return", "[", "QueryComplexity", "::", "class", "=>", "new", "QueryComplexity", "(", "config", "(", "'lighthouse.security.max_query_complexity'", ",", "0", ")", ")", ",", "QueryDepth", ":...
Construct the validation rules with values given in the config. @return \GraphQL\Validator\Rules\ValidationRule[]
[ "Construct", "the", "validation", "rules", "with", "values", "given", "in", "the", "config", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/GraphQL.php#L254-L261
train
nuwave/lighthouse
src/GraphQL.php
GraphQL.documentAST
public function documentAST(): DocumentAST { if (empty($this->documentAST)) { $this->documentAST = config('lighthouse.cache.enable') ? app('cache') ->rememberForever( config('lighthouse.cache.key'), function (): ...
php
public function documentAST(): DocumentAST { if (empty($this->documentAST)) { $this->documentAST = config('lighthouse.cache.enable') ? app('cache') ->rememberForever( config('lighthouse.cache.key'), function (): ...
[ "public", "function", "documentAST", "(", ")", ":", "DocumentAST", "{", "if", "(", "empty", "(", "$", "this", "->", "documentAST", ")", ")", "{", "$", "this", "->", "documentAST", "=", "config", "(", "'lighthouse.cache.enable'", ")", "?", "app", "(", "'c...
Get instance of DocumentAST. @return \Nuwave\Lighthouse\Schema\AST\DocumentAST
[ "Get", "instance", "of", "DocumentAST", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/GraphQL.php#L268-L283
train
nuwave/lighthouse
src/GraphQL.php
GraphQL.buildAST
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
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 ...
[ "protected", "function", "buildAST", "(", ")", ":", "DocumentAST", "{", "$", "schemaString", "=", "$", "this", "->", "schemaSourceProvider", "->", "getSchemaString", "(", ")", ";", "// Allow to register listeners that add in additional schema definitions.", "// This can be ...
Get the schema string and build an AST out of it. @return \Nuwave\Lighthouse\Schema\AST\DocumentAST
[ "Get", "the", "schema", "string", "and", "build", "an", "AST", "out", "of", "it", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/GraphQL.php#L290-L316
train
nuwave/lighthouse
src/Schema/Directives/OrderByDirective.php
OrderByDirective.handleBuilder
public function handleBuilder($builder, $value) { foreach ($value as $orderByClause) { $builder->orderBy( $orderByClause['field'], $orderByClause['order'] ); } return $builder; }
php
public function handleBuilder($builder, $value) { foreach ($value as $orderByClause) { $builder->orderBy( $orderByClause['field'], $orderByClause['order'] ); } return $builder; }
[ "public", "function", "handleBuilder", "(", "$", "builder", ",", "$", "value", ")", "{", "foreach", "(", "$", "value", "as", "$", "orderByClause", ")", "{", "$", "builder", "->", "orderBy", "(", "$", "orderByClause", "[", "'field'", "]", ",", "$", "ord...
Apply an "ORDER BY" clause. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $builder @param mixed $value @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
[ "Apply", "an", "ORDER", "BY", "clause", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/OrderByDirective.php#L35-L45
train
nuwave/lighthouse
src/Schema/Directives/OrderByDirective.php
OrderByDirective.manipulateSchema
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
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 ($...
[ "public", "function", "manipulateSchema", "(", "InputValueDefinitionNode", "$", "argDefinition", ",", "FieldDefinitionNode", "$", "fieldDefinition", ",", "ObjectTypeDefinitionNode", "$", "parentType", ",", "DocumentAST", "$", "current", ")", "{", "$", "expectedOrderByClau...
Validate the input argument definition. @param \GraphQL\Language\AST\InputValueDefinitionNode $argDefinition @param \GraphQL\Language\AST\FieldDefinitionNode $fieldDefinition @param \GraphQL\Language\AST\ObjectTypeDefinitionNode $parentType @param \Nuwave\Lighthouse\Schema\AST\DocumentAST $current @return \Nuw...
[ "Validate", "the", "input", "argument", "definition", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/OrderByDirective.php#L56-L82
train
nuwave/lighthouse
src/LighthouseServiceProvider.php
LighthouseServiceProvider.loadRoutesFrom
protected function loadRoutesFrom($path): void { if (Str::contains($this->app->version(), 'Lumen')) { require realpath($path); return; } parent::loadRoutesFrom($path); }
php
protected function loadRoutesFrom($path): void { if (Str::contains($this->app->version(), 'Lumen')) { require realpath($path); return; } parent::loadRoutesFrom($path); }
[ "protected", "function", "loadRoutesFrom", "(", "$", "path", ")", ":", "void", "{", "if", "(", "Str", "::", "contains", "(", "$", "this", "->", "app", "->", "version", "(", ")", ",", "'Lumen'", ")", ")", "{", "require", "realpath", "(", "$", "path", ...
Load routes from provided path. @param string $path @return void
[ "Load", "routes", "from", "provided", "path", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/LighthouseServiceProvider.php#L87-L96
train
nuwave/lighthouse
src/Schema/Factories/NodeFactory.php
NodeFactory.handle
public function handle(TypeDefinitionNode $definition): Type { $nodeValue = new NodeValue($definition); return $this->pipeline ->send($nodeValue) ->through( $this->directiveFactory->createNodeMiddleware($definition) ) ->via('handleNode...
php
public function handle(TypeDefinitionNode $definition): Type { $nodeValue = new NodeValue($definition); return $this->pipeline ->send($nodeValue) ->through( $this->directiveFactory->createNodeMiddleware($definition) ) ->via('handleNode...
[ "public", "function", "handle", "(", "TypeDefinitionNode", "$", "definition", ")", ":", "Type", "{", "$", "nodeValue", "=", "new", "NodeValue", "(", "$", "definition", ")", ";", "return", "$", "this", "->", "pipeline", "->", "send", "(", "$", "nodeValue", ...
Transform node to type. @param \GraphQL\Language\AST\TypeDefinitionNode $definition @return \GraphQL\Type\Definition\Type
[ "Transform", "node", "to", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/NodeFactory.php#L84-L103
train
nuwave/lighthouse
src/Schema/Factories/NodeFactory.php
NodeFactory.resolveType
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
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); ...
[ "protected", "function", "resolveType", "(", "TypeDefinitionNode", "$", "typeDefinition", ")", ":", "Type", "{", "// Ignore TypeExtensionNode since they are merged before we get here", "switch", "(", "get_class", "(", "$", "typeDefinition", ")", ")", "{", "case", "EnumTyp...
Transform value to type. @param \GraphQL\Language\AST\TypeDefinitionNode $typeDefinition @return \GraphQL\Type\Definition\Type @throws \Nuwave\Lighthouse\Exceptions\DefinitionException
[ "Transform", "value", "to", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/NodeFactory.php#L113-L134
train
nuwave/lighthouse
src/Schema/Factories/NodeFactory.php
NodeFactory.resolveFieldsFunction
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
protected function resolveFieldsFunction($definition): Closure { return function () use ($definition): array { return (new Collection($definition->fields)) ->mapWithKeys(function (FieldDefinitionNode $fieldDefinition) use ($definition): array { $fieldValue = n...
[ "protected", "function", "resolveFieldsFunction", "(", "$", "definition", ")", ":", "Closure", "{", "return", "function", "(", ")", "use", "(", "$", "definition", ")", ":", "array", "{", "return", "(", "new", "Collection", "(", "$", "definition", "->", "fi...
Returns a closure that lazy loads the fields for a constructed type. @param \GraphQL\Language\AST\ObjectTypeDefinitionNode|\GraphQL\Language\AST\InterfaceTypeDefinitionNode $definition @return \Closure
[ "Returns", "a", "closure", "that", "lazy", "loads", "the", "fields", "for", "a", "constructed", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/NodeFactory.php#L226-L242
train
nuwave/lighthouse
src/Schema/SchemaBuilder.php
SchemaBuilder.build
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
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...
[ "public", "function", "build", "(", "$", "documentAST", ")", "{", "/** @var \\GraphQL\\Language\\AST\\TypeDefinitionNode $typeDefinition */", "foreach", "(", "$", "documentAST", "->", "typeDefinitions", "(", ")", "as", "$", "typeDefinition", ")", "{", "$", "type", "="...
Build an executable schema from AST. @param \Nuwave\Lighthouse\Schema\AST\DocumentAST $documentAST @return \GraphQL\Type\Schema
[ "Build", "an", "executable", "schema", "from", "AST", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/SchemaBuilder.php#L56-L111
train
nuwave/lighthouse
src/Schema/SchemaBuilder.php
SchemaBuilder.convertDirectives
protected function convertDirectives(DocumentAST $document): Collection { return $document->directiveDefinitions() ->map(function (DirectiveDefinitionNode $directive) { return new Directive([ 'name' => $directive->name->value, 'description'...
php
protected function convertDirectives(DocumentAST $document): Collection { return $document->directiveDefinitions() ->map(function (DirectiveDefinitionNode $directive) { return new Directive([ 'name' => $directive->name->value, 'description'...
[ "protected", "function", "convertDirectives", "(", "DocumentAST", "$", "document", ")", ":", "Collection", "{", "return", "$", "document", "->", "directiveDefinitions", "(", ")", "->", "map", "(", "function", "(", "DirectiveDefinitionNode", "$", "directive", ")", ...
Set custom client directives. @param \Nuwave\Lighthouse\Schema\AST\DocumentAST $document @return \Illuminate\Support\Collection<\GraphQL\Type\Definition\Directive>
[ "Set", "custom", "client", "directives", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/SchemaBuilder.php#L119-L151
train
nuwave/lighthouse
src/Defer/DeferrableDirective.php
DeferrableDirective.shouldDefer
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
protected function shouldDefer(TypeNode $fieldType, ResolveInfo $resolveInfo): bool { if (strtolower($resolveInfo->operation->operation) === 'mutation') { return false; } foreach ($resolveInfo->fieldNodes as $fieldNode) { $deferDirective = ASTHelper::directiveDefinit...
[ "protected", "function", "shouldDefer", "(", "TypeNode", "$", "fieldType", ",", "ResolveInfo", "$", "resolveInfo", ")", ":", "bool", "{", "if", "(", "strtolower", "(", "$", "resolveInfo", "->", "operation", "->", "operation", ")", "===", "'mutation'", ")", "...
Determine if field should be deferred. @param \GraphQL\Language\AST\TypeNode $fieldType @param \GraphQL\Type\Definition\ResolveInfo $resolveInfo @return bool @throws \Nuwave\Lighthouse\Exceptions\ParseClientException
[ "Determine", "if", "field", "should", "be", "deferred", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Defer/DeferrableDirective.php#L86-L123
train
nuwave/lighthouse
src/Schema/Directives/CanDirective.php
CanDirective.handleField
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
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) { ...
[ "public", "function", "handleField", "(", "FieldValue", "$", "value", ",", "Closure", "$", "next", ")", ":", "FieldValue", "{", "$", "previousResolver", "=", "$", "value", "->", "getResolver", "(", ")", ";", "return", "$", "next", "(", "$", "value", "->"...
Ensure the user is authorized to access this field. @param \Nuwave\Lighthouse\Schema\Values\FieldValue $value @param \Closure $next @return \Nuwave\Lighthouse\Schema\Values\FieldValue
[ "Ensure", "the", "user", "is", "authorized", "to", "access", "this", "field", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/CanDirective.php#L33-L60
train
nuwave/lighthouse
src/Execution/MutationExecutor.php
MutationExecutor.saveModelWithPotentialParent
protected static function saveModelWithPotentialParent(Model $model, Collection $args, ?Relation $parentRelation = null): Model { [$belongsTo, $remaining] = self::partitionArgsByRelationType( new ReflectionClass($model), $args, BelongsTo::class ); // Use ...
php
protected static function saveModelWithPotentialParent(Model $model, Collection $args, ?Relation $parentRelation = null): Model { [$belongsTo, $remaining] = self::partitionArgsByRelationType( new ReflectionClass($model), $args, BelongsTo::class ); // Use ...
[ "protected", "static", "function", "saveModelWithPotentialParent", "(", "Model", "$", "model", ",", "Collection", "$", "args", ",", "?", "Relation", "$", "parentRelation", "=", "null", ")", ":", "Model", "{", "[", "$", "belongsTo", ",", "$", "remaining", "]"...
Save a model that maybe has a parent. @param \Illuminate\Database\Eloquent\Model $model @param \Illuminate\Support\Collection $args @param \Illuminate\Database\Eloquent\Relations\Relation|null $parentRelation @return \Illuminate\Database\Eloquent\Model
[ "Save", "a", "model", "that", "maybe", "has", "a", "parent", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/MutationExecutor.php#L111-L180
train
nuwave/lighthouse
src/Execution/MutationExecutor.php
MutationExecutor.handleMultiRelationCreate
protected static function handleMultiRelationCreate(Collection $multiValues, Relation $relation): void { $multiValues->each(function ($singleValues) use ($relation): void { self::handleSingleRelationCreate(new Collection($singleValues), $relation); }); }
php
protected static function handleMultiRelationCreate(Collection $multiValues, Relation $relation): void { $multiValues->each(function ($singleValues) use ($relation): void { self::handleSingleRelationCreate(new Collection($singleValues), $relation); }); }
[ "protected", "static", "function", "handleMultiRelationCreate", "(", "Collection", "$", "multiValues", ",", "Relation", "$", "relation", ")", ":", "void", "{", "$", "multiValues", "->", "each", "(", "function", "(", "$", "singleValues", ")", "use", "(", "$", ...
Handle the creation with multiple relations. @param \Illuminate\Support\Collection $multiValues @param \Illuminate\Database\Eloquent\Relations\Relation $relation @return void
[ "Handle", "the", "creation", "with", "multiple", "relations", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/MutationExecutor.php#L189-L194
train
nuwave/lighthouse
src/Execution/MutationExecutor.php
MutationExecutor.handleSingleRelationCreate
protected static function handleSingleRelationCreate(Collection $singleValues, Relation $relation): void { self::executeCreate( $relation->getModel()->newInstance(), $singleValues, $relation ); }
php
protected static function handleSingleRelationCreate(Collection $singleValues, Relation $relation): void { self::executeCreate( $relation->getModel()->newInstance(), $singleValues, $relation ); }
[ "protected", "static", "function", "handleSingleRelationCreate", "(", "Collection", "$", "singleValues", ",", "Relation", "$", "relation", ")", ":", "void", "{", "self", "::", "executeCreate", "(", "$", "relation", "->", "getModel", "(", ")", "->", "newInstance"...
Handle the creation with a single relation. @param \Illuminate\Support\Collection $singleValues @param \Illuminate\Database\Eloquent\Relations\Relation $relation @return void
[ "Handle", "the", "creation", "with", "a", "single", "relation", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/MutationExecutor.php#L203-L210
train
nuwave/lighthouse
src/Execution/MutationExecutor.php
MutationExecutor.partitionArgsByRelationType
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
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(...
[ "protected", "static", "function", "partitionArgsByRelationType", "(", "ReflectionClass", "$", "modelReflection", ",", "Collection", "$", "args", ",", "string", "$", "relationClass", ")", ":", "Collection", "{", "return", "$", "args", "->", "partition", "(", "func...
Extract all the arguments that correspond to a relation of a certain type on the model. For example, if the args input looks like this: [ 'comments' => ['foo' => 'Bar'], 'name' => 'Ralf', ] and the model has a method "comments" that returns a HasMany relationship, the result will be: [ [ 'comments' => ['foo' => 'Bar...
[ "Extract", "all", "the", "arguments", "that", "correspond", "to", "a", "relation", "of", "a", "certain", "type", "on", "the", "model", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/MutationExecutor.php#L365-L385
train
nuwave/lighthouse
src/Schema/Directives/BuilderDirective.php
BuilderDirective.handleBuilder
public function handleBuilder($builder, $value) { return call_user_func( $this->getResolverFromArgument('method'), $builder, $value, $this->definitionNode ); }
php
public function handleBuilder($builder, $value) { return call_user_func( $this->getResolverFromArgument('method'), $builder, $value, $this->definitionNode ); }
[ "public", "function", "handleBuilder", "(", "$", "builder", ",", "$", "value", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "getResolverFromArgument", "(", "'method'", ")", ",", "$", "builder", ",", "$", "value", ",", "$", "this", "->", ...
Dynamically call a user-defined method to enhance the builder. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $builder @param mixed $value @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
[ "Dynamically", "call", "a", "user", "-", "defined", "method", "to", "enhance", "the", "builder", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/BuilderDirective.php#L26-L34
train
nuwave/lighthouse
src/Subscriptions/Broadcasters/PusherBroadcaster.php
PusherBroadcaster.hook
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 { $this...
php
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 { $this...
[ "public", "function", "hook", "(", "Request", "$", "request", ")", ":", "JsonResponse", "{", "(", "new", "Collection", "(", "$", "request", "->", "input", "(", "'events'", ",", "[", "]", ")", ")", ")", "->", "filter", "(", "function", "(", "$", "even...
Handle subscription web hook. @param \Illuminate\Http\Request $request @return \Illuminate\Http\JsonResponse
[ "Handle", "subscription", "web", "hook", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/Broadcasters/PusherBroadcaster.php#L74-L87
train
nuwave/lighthouse
src/Execution/DataLoader/BatchLoader.php
BatchLoader.instance
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
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 ...
[ "public", "static", "function", "instance", "(", "string", "$", "loaderClass", ",", "array", "$", "pathToField", ",", "array", "$", "constructorArgs", "=", "[", "]", ")", ":", "self", "{", "// The path to the field serves as the unique key for the instance", "$", "i...
Return an instance of a BatchLoader for a specific field. @param string $loaderClass The class name of the concrete BatchLoader to instantiate @param mixed[] $pathToField Path to the GraphQL field from the root, is used as a key for BatchLoader instances @param mixed[] $constructorArgs Those arguments are pas...
[ "Return", "an", "instance", "of", "a", "BatchLoader", "for", "a", "specific", "field", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/BatchLoader.php#L48-L77
train
nuwave/lighthouse
src/Execution/DataLoader/BatchLoader.php
BatchLoader.instanceKey
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
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 ...
[ "public", "static", "function", "instanceKey", "(", "array", "$", "path", ")", ":", "string", "{", "return", "(", "new", "Collection", "(", "$", "path", ")", ")", "->", "filter", "(", "function", "(", "$", "path", ")", ":", "bool", "{", "// Ignore nume...
Generate a unique key for the instance, using the path in the query. @param mixed[] $path @return string
[ "Generate", "a", "unique", "key", "for", "the", "instance", "using", "the", "path", "in", "the", "query", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/BatchLoader.php#L85-L95
train
nuwave/lighthouse
src/Execution/DataLoader/BatchLoader.php
BatchLoader.load
public function load($key, array $metaInfo = []): Deferred { $key = $this->buildKey($key); $this->keys[$key] = $metaInfo; return new Deferred(function () use ($key) { if (! $this->hasLoaded) { $this->results = $this->resolve(); $this->hasLoaded = ...
php
public function load($key, array $metaInfo = []): Deferred { $key = $this->buildKey($key); $this->keys[$key] = $metaInfo; return new Deferred(function () use ($key) { if (! $this->hasLoaded) { $this->results = $this->resolve(); $this->hasLoaded = ...
[ "public", "function", "load", "(", "$", "key", ",", "array", "$", "metaInfo", "=", "[", "]", ")", ":", "Deferred", "{", "$", "key", "=", "$", "this", "->", "buildKey", "(", "$", "key", ")", ";", "$", "this", "->", "keys", "[", "$", "key", "]", ...
Load object by key. @param mixed $key @param mixed[] $metaInfo @return \GraphQL\Deferred
[ "Load", "object", "by", "key", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/BatchLoader.php#L104-L117
train
nuwave/lighthouse
src/Support/Http/Middleware/AcceptJson.php
AcceptJson.handle
public function handle(Request $request, Closure $next) { $request->headers->set('Accept', 'application/json'); return $next($request); }
php
public function handle(Request $request, Closure $next) { $request->headers->set('Accept', 'application/json'); return $next($request); }
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "Closure", "$", "next", ")", "{", "$", "request", "->", "headers", "->", "set", "(", "'Accept'", ",", "'application/json'", ")", ";", "return", "$", "next", "(", "$", "request", ")", ...
Force the Accept header of the request. @param \Illuminate\Http\Request $request @param \Closure $next @return \Illuminate\Http\JsonResponse
[ "Force", "the", "Accept", "header", "of", "the", "request", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Http/Middleware/AcceptJson.php#L26-L31
train
nuwave/lighthouse
src/Support/Http/Responses/ResponseStream.php
ResponseStream.chunk
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', 'Content-Length...
php
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', 'Content-Length...
[ "protected", "function", "chunk", "(", "array", "$", "data", ",", "bool", "$", "terminating", ")", ":", "string", "{", "$", "json", "=", "json_encode", "(", "$", "data", ",", "0", ")", ";", "$", "length", "=", "$", "terminating", "?", "strlen", "(", ...
Format chunked data. @param array $data @param bool $terminating @return string
[ "Format", "chunked", "data", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Http/Responses/ResponseStream.php#L86-L102
train
nuwave/lighthouse
src/Support/Http/Responses/ResponseStream.php
ResponseStream.emit
protected function emit(string $chunk): void { echo $chunk; $this->flush(Closure::fromCallable('ob_flush')); $this->flush(Closure::fromCallable('flush')); }
php
protected function emit(string $chunk): void { echo $chunk; $this->flush(Closure::fromCallable('ob_flush')); $this->flush(Closure::fromCallable('flush')); }
[ "protected", "function", "emit", "(", "string", "$", "chunk", ")", ":", "void", "{", "echo", "$", "chunk", ";", "$", "this", "->", "flush", "(", "Closure", "::", "fromCallable", "(", "'ob_flush'", ")", ")", ";", "$", "this", "->", "flush", "(", "Clos...
Stream chunked data to client. @param string $chunk @return void
[ "Stream", "chunked", "data", "to", "client", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Http/Responses/ResponseStream.php#L110-L116
train
nuwave/lighthouse
src/Subscriptions/SubscriptionRegistry.php
SubscriptionRegistry.subscriptions
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
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...
[ "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", "(", ")", ...
Get registered subscriptions. @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber @return \Illuminate\Support\Collection
[ "Get", "registered", "subscriptions", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/SubscriptionRegistry.php#L131-L158
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.typeExtensionUniqueKey
protected function typeExtensionUniqueKey(TypeExtensionNode $typeExtensionNode): string { $fieldNames = (new Collection($typeExtensionNode->fields)) ->map(function ($field): string { return $field->name->value; }) ->implode(':'); return $typeExten...
php
protected function typeExtensionUniqueKey(TypeExtensionNode $typeExtensionNode): string { $fieldNames = (new Collection($typeExtensionNode->fields)) ->map(function ($field): string { return $field->name->value; }) ->implode(':'); return $typeExten...
[ "protected", "function", "typeExtensionUniqueKey", "(", "TypeExtensionNode", "$", "typeExtensionNode", ")", ":", "string", "{", "$", "fieldNames", "=", "(", "new", "Collection", "(", "$", "typeExtensionNode", "->", "fields", ")", ")", "->", "map", "(", "function...
Return a unique key that identifies a type extension. @param \GraphQL\Language\AST\TypeExtensionNode $typeExtensionNode @return string
[ "Return", "a", "unique", "key", "that", "identifies", "a", "type", "extension", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L71-L80
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.fromSource
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
public static function fromSource(string $schema): self { try { return new static( Parser::parse( $schema, // Ignore location since it only bloats the AST ['noLocation' => true] ) ); }...
[ "public", "static", "function", "fromSource", "(", "string", "$", "schema", ")", ":", "self", "{", "try", "{", "return", "new", "static", "(", "Parser", "::", "parse", "(", "$", "schema", ",", "// Ignore location since it only bloats the AST", "[", "'noLocation'...
Create a new DocumentAST instance from a schema. @param string $schema @return static @throws \Nuwave\Lighthouse\Exceptions\ParseException
[ "Create", "a", "new", "DocumentAST", "instance", "from", "a", "schema", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L90-L107
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.serialize
public function serialize(): string { return serialize( $this->definitionMap ->mapWithKeys(function (DefinitionNode $node, string $key): array { return [$key => AST::toArray($node)]; }) ); }
php
public function serialize(): string { return serialize( $this->definitionMap ->mapWithKeys(function (DefinitionNode $node, string $key): array { return [$key => AST::toArray($node)]; }) ); }
[ "public", "function", "serialize", "(", ")", ":", "string", "{", "return", "serialize", "(", "$", "this", "->", "definitionMap", "->", "mapWithKeys", "(", "function", "(", "DefinitionNode", "$", "node", ",", "string", "$", "key", ")", ":", "array", "{", ...
Strip out irrelevant information to make serialization more efficient. @return string
[ "Strip", "out", "irrelevant", "information", "to", "make", "serialization", "more", "efficient", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L114-L122
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.unserialize
public function unserialize($serialized): void { $this->definitionMap = unserialize($serialized) ->mapWithKeys(function (array $node, string $key): array { return [$key => AST::fromArray($node)]; }); }
php
public function unserialize($serialized): void { $this->definitionMap = unserialize($serialized) ->mapWithKeys(function (array $node, string $key): array { return [$key => AST::fromArray($node)]; }); }
[ "public", "function", "unserialize", "(", "$", "serialized", ")", ":", "void", "{", "$", "this", "->", "definitionMap", "=", "unserialize", "(", "$", "serialized", ")", "->", "mapWithKeys", "(", "function", "(", "array", "$", "node", ",", "string", "$", ...
Construct from the string representation. @param string $serialized @return void
[ "Construct", "from", "the", "string", "representation", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L130-L136
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.typeDefinitions
public function typeDefinitions(): Collection { return $this->definitionMap ->filter(function (DefinitionNode $node) { return $node instanceof ScalarTypeDefinitionNode || $node instanceof ObjectTypeDefinitionNode || $node instanceof Interfa...
php
public function typeDefinitions(): Collection { return $this->definitionMap ->filter(function (DefinitionNode $node) { return $node instanceof ScalarTypeDefinitionNode || $node instanceof ObjectTypeDefinitionNode || $node instanceof Interfa...
[ "public", "function", "typeDefinitions", "(", ")", ":", "Collection", "{", "return", "$", "this", "->", "definitionMap", "->", "filter", "(", "function", "(", "DefinitionNode", "$", "node", ")", "{", "return", "$", "node", "instanceof", "ScalarTypeDefinitionNode...
Get all type definitions from the document. @return \Illuminate\Support\Collection<\GraphQL\Language\AST\TypeDefinitionNode>
[ "Get", "all", "type", "definitions", "from", "the", "document", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L143-L154
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.extensionsForType
public function extensionsForType(string $extendedTypeName): Collection { return $this->typeExtensionsMap ->filter(function (TypeExtensionNode $typeExtension) use ($extendedTypeName): bool { return $extendedTypeName === $typeExtension->name->value; }); }
php
public function extensionsForType(string $extendedTypeName): Collection { return $this->typeExtensionsMap ->filter(function (TypeExtensionNode $typeExtension) use ($extendedTypeName): bool { return $extendedTypeName === $typeExtension->name->value; }); }
[ "public", "function", "extensionsForType", "(", "string", "$", "extendedTypeName", ")", ":", "Collection", "{", "return", "$", "this", "->", "typeExtensionsMap", "->", "filter", "(", "function", "(", "TypeExtensionNode", "$", "typeExtension", ")", "use", "(", "$...
Get all extensions that apply to a named type. @param string $extendedTypeName @return \Illuminate\Support\Collection<\GraphQL\Language\AST\TypeExtensionNode>
[ "Get", "all", "extensions", "that", "apply", "to", "a", "named", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L172-L178
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.objectTypeDefinition
public function objectTypeDefinition(string $name): ?ObjectTypeDefinitionNode { return $this->objectTypeDefinitions() ->first(function (ObjectTypeDefinitionNode $objectType) use ($name): bool { return $objectType->name->value === $name; }); }
php
public function objectTypeDefinition(string $name): ?ObjectTypeDefinitionNode { return $this->objectTypeDefinitions() ->first(function (ObjectTypeDefinitionNode $objectType) use ($name): bool { return $objectType->name->value === $name; }); }
[ "public", "function", "objectTypeDefinition", "(", "string", "$", "name", ")", ":", "?", "ObjectTypeDefinitionNode", "{", "return", "$", "this", "->", "objectTypeDefinitions", "(", ")", "->", "first", "(", "function", "(", "ObjectTypeDefinitionNode", "$", "objectT...
Get a single object type definition by name. @param string $name @return \GraphQL\Language\AST\ObjectTypeDefinitionNode|null
[ "Get", "a", "single", "object", "type", "definition", "by", "name", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L206-L212
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.definitionsByType
protected function definitionsByType(string $typeClassName): Collection { return $this->definitionMap ->filter(function (Node $node) use ($typeClassName) { return $node instanceof $typeClassName; }); }
php
protected function definitionsByType(string $typeClassName): Collection { return $this->definitionMap ->filter(function (Node $node) use ($typeClassName) { return $node instanceof $typeClassName; }); }
[ "protected", "function", "definitionsByType", "(", "string", "$", "typeClassName", ")", ":", "Collection", "{", "return", "$", "this", "->", "definitionMap", "->", "filter", "(", "function", "(", "Node", "$", "node", ")", "use", "(", "$", "typeClassName", ")...
Get all definitions of a given type. @param string $typeClassName @return \Illuminate\Support\Collection
[ "Get", "all", "definitions", "of", "a", "given", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L280-L286
train
nuwave/lighthouse
src/Schema/AST/DocumentAST.php
DocumentAST.addFieldToQueryType
public function addFieldToQueryType(FieldDefinitionNode $field): self { $query = $this->queryTypeDefinition(); $query->fields = ASTHelper::mergeNodeList($query->fields, [$field]); $this->setDefinition($query); return $this; }
php
public function addFieldToQueryType(FieldDefinitionNode $field): self { $query = $this->queryTypeDefinition(); $query->fields = ASTHelper::mergeNodeList($query->fields, [$field]); $this->setDefinition($query); return $this; }
[ "public", "function", "addFieldToQueryType", "(", "FieldDefinitionNode", "$", "field", ")", ":", "self", "{", "$", "query", "=", "$", "this", "->", "queryTypeDefinition", "(", ")", ";", "$", "query", "->", "fields", "=", "ASTHelper", "::", "mergeNodeList", "...
Add a single field to the query type. @param \GraphQL\Language\AST\FieldDefinitionNode $field @return $this
[ "Add", "a", "single", "field", "to", "the", "query", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/DocumentAST.php#L294-L302
train
nuwave/lighthouse
src/Schema/Directives/SearchDirective.php
SearchDirective.handleBuilder
public function handleBuilder($builder, $value) { $within = $this->directiveArgValue('within'); /** @var \Illuminate\Database\Eloquent\Model $modelClass */ $modelClass = get_class( $builder->getModel() ); /** @var \Laravel\Scout\Builder $builder */ $buil...
php
public function handleBuilder($builder, $value) { $within = $this->directiveArgValue('within'); /** @var \Illuminate\Database\Eloquent\Model $modelClass */ $modelClass = get_class( $builder->getModel() ); /** @var \Laravel\Scout\Builder $builder */ $buil...
[ "public", "function", "handleBuilder", "(", "$", "builder", ",", "$", "value", ")", "{", "$", "within", "=", "$", "this", "->", "directiveArgValue", "(", "'within'", ")", ";", "/** @var \\Illuminate\\Database\\Eloquent\\Model $modelClass */", "$", "modelClass", "=",...
Apply a scout search to the builder. @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $builder @param mixed $value @return \Laravel\Scout\Builder
[ "Apply", "a", "scout", "search", "to", "the", "builder", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/SearchDirective.php#L26-L43
train
nuwave/lighthouse
src/Support/DriverManager.php
DriverManager.driver
public function driver(?string $name = null) { $name = $name ?: $this->getDefaultDriver(); return $this->drivers[$name] = $this->get($name); }
php
public function driver(?string $name = null) { $name = $name ?: $this->getDefaultDriver(); return $this->drivers[$name] = $this->get($name); }
[ "public", "function", "driver", "(", "?", "string", "$", "name", "=", "null", ")", "{", "$", "name", "=", "$", "name", "?", ":", "$", "this", "->", "getDefaultDriver", "(", ")", ";", "return", "$", "this", "->", "drivers", "[", "$", "name", "]", ...
Get a driver instance by name. @param string|null $name @return mixed
[ "Get", "a", "driver", "instance", "by", "name", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/DriverManager.php#L56-L61
train
nuwave/lighthouse
src/Support/DriverManager.php
DriverManager.validateDriver
protected function validateDriver($driver) { $interface = $this->interface(); if (! (new ReflectionClass($driver))->implementsInterface($interface)) { throw new InvalidDriverException(get_class($driver)." does not implement {$interface}"); } return $driver; }
php
protected function validateDriver($driver) { $interface = $this->interface(); if (! (new ReflectionClass($driver))->implementsInterface($interface)) { throw new InvalidDriverException(get_class($driver)." does not implement {$interface}"); } return $driver; }
[ "protected", "function", "validateDriver", "(", "$", "driver", ")", "{", "$", "interface", "=", "$", "this", "->", "interface", "(", ")", ";", "if", "(", "!", "(", "new", "ReflectionClass", "(", "$", "driver", ")", ")", "->", "implementsInterface", "(", ...
Validate driver implements the proper interface. @param mixed $driver @return mixed @throws \Nuwave\Lighthouse\Exceptions\InvalidDriverException
[ "Validate", "driver", "implements", "the", "proper", "interface", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/DriverManager.php#L171-L180
train
nuwave/lighthouse
src/Subscriptions/BroadcastManager.php
BroadcastManager.createPusherDriver
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
protected function createPusherDriver(array $config): PusherBroadcaster { $connection = $config['connection'] ?? 'pusher'; $driverConfig = config("broadcasting.connections.{$connection}"); if (empty($driverConfig) || $driverConfig['driver'] !== 'pusher') { throw new RuntimeExcep...
[ "protected", "function", "createPusherDriver", "(", "array", "$", "config", ")", ":", "PusherBroadcaster", "{", "$", "connection", "=", "$", "config", "[", "'connection'", "]", "??", "'pusher'", ";", "$", "driverConfig", "=", "config", "(", "\"broadcasting.conne...
Create instance of pusher driver. @param mixed[] $config @return \Nuwave\Lighthouse\Subscriptions\Broadcasters\PusherBroadcaster @throws \Pusher\PusherException
[ "Create", "instance", "of", "pusher", "driver", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/BroadcastManager.php#L58-L75
train
nuwave/lighthouse
src/Schema/Types/Scalars/DateTime.php
DateTime.serialize
public function serialize($value): string { if ($value instanceof Carbon) { return $value->toDateTimeString(); } return $this ->tryParsingDateTime($value, InvariantViolation::class) ->toDateTimeString(); }
php
public function serialize($value): string { if ($value instanceof Carbon) { return $value->toDateTimeString(); } return $this ->tryParsingDateTime($value, InvariantViolation::class) ->toDateTimeString(); }
[ "public", "function", "serialize", "(", "$", "value", ")", ":", "string", "{", "if", "(", "$", "value", "instanceof", "Carbon", ")", "{", "return", "$", "value", "->", "toDateTimeString", "(", ")", ";", "}", "return", "$", "this", "->", "tryParsingDateTi...
Serialize an internal value, ensuring it is a valid datetime string. @param \Carbon\Carbon|string $value @return string
[ "Serialize", "an", "internal", "value", "ensuring", "it", "is", "a", "valid", "datetime", "string", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Types/Scalars/DateTime.php#L21-L30
train
nuwave/lighthouse
src/Support/Http/Responses/Stream.php
Stream.chunkError
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 { return Str::startsWith(implode('.', $error[...
php
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 { return Str::startsWith(implode('.', $error[...
[ "protected", "function", "chunkError", "(", "string", "$", "path", ",", "array", "$", "data", ")", ":", "?", "array", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'errors'", "]", ")", ")", "{", "return", "null", ";", "}", "return", "(", ...
Get error from chunk if it exists. @param string $path @param array $data @return array|null
[ "Get", "error", "from", "chunk", "if", "it", "exists", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Http/Responses/Stream.php#L17-L29
train
nuwave/lighthouse
src/Pagination/PaginatorField.php
PaginatorField.paginatorInfoResolver
public function paginatorInfoResolver(LengthAwarePaginator $root): array { return [ 'count' => $root->count(), 'currentPage' => $root->currentPage(), 'firstItem' => $root->firstItem(), 'hasMorePages' => $root->hasMorePages(), 'lastItem' => $root->l...
php
public function paginatorInfoResolver(LengthAwarePaginator $root): array { return [ 'count' => $root->count(), 'currentPage' => $root->currentPage(), 'firstItem' => $root->firstItem(), 'hasMorePages' => $root->hasMorePages(), 'lastItem' => $root->l...
[ "public", "function", "paginatorInfoResolver", "(", "LengthAwarePaginator", "$", "root", ")", ":", "array", "{", "return", "[", "'count'", "=>", "$", "root", "->", "count", "(", ")", ",", "'currentPage'", "=>", "$", "root", "->", "currentPage", "(", ")", "...
Resolve paginator info for connection. @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $root @return array
[ "Resolve", "paginator", "info", "for", "connection", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/PaginatorField.php#L16-L28
train
nuwave/lighthouse
src/Subscriptions/Iterators/SyncIterator.php
SyncIterator.process
public function process(Collection $items, Closure $cb, Closure $error = null): void { $items->each(function ($item) use ($cb, $error): void { try { $cb($item); } catch (Exception $e) { if (! $error) { throw $e; } ...
php
public function process(Collection $items, Closure $cb, Closure $error = null): void { $items->each(function ($item) use ($cb, $error): void { try { $cb($item); } catch (Exception $e) { if (! $error) { throw $e; } ...
[ "public", "function", "process", "(", "Collection", "$", "items", ",", "Closure", "$", "cb", ",", "Closure", "$", "error", "=", "null", ")", ":", "void", "{", "$", "items", "->", "each", "(", "function", "(", "$", "item", ")", "use", "(", "$", "cb"...
Process collection of items. @param \Illuminate\Support\Collection $items @param \Closure $cb @param \Closure|null $error @return void
[ "Process", "collection", "of", "items", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/Iterators/SyncIterator.php#L20-L33
train
nuwave/lighthouse
src/Schema/Factories/DirectiveFactory.php
DirectiveFactory.create
public function create(string $directiveName, $definitionNode = null): Directive { $directive = $this->resolve($directiveName) ?? $this->createOrFail($directiveName); return $definitionNode ? $this->hydrate($directive, $definitionNode) : $directive; }
php
public function create(string $directiveName, $definitionNode = null): Directive { $directive = $this->resolve($directiveName) ?? $this->createOrFail($directiveName); return $definitionNode ? $this->hydrate($directive, $definitionNode) : $directive; }
[ "public", "function", "create", "(", "string", "$", "directiveName", ",", "$", "definitionNode", "=", "null", ")", ":", "Directive", "{", "$", "directive", "=", "$", "this", "->", "resolve", "(", "$", "directiveName", ")", "??", "$", "this", "->", "creat...
Create a directive by the given directive name. @param string $directiveName @param \GraphQL\Language\AST\TypeSystemDefinitionNode|null $definitionNode @return \Nuwave\Lighthouse\Support\Contracts\Directive
[ "Create", "a", "directive", "by", "the", "given", "directive", "name", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/DirectiveFactory.php#L96-L103
train
nuwave/lighthouse
src/Schema/Factories/DirectiveFactory.php
DirectiveFactory.resolve
protected function resolve(string $directiveName): ?Directive { if ($className = Arr::get($this->resolved, $directiveName)) { return app($className); } return null; }
php
protected function resolve(string $directiveName): ?Directive { if ($className = Arr::get($this->resolved, $directiveName)) { return app($className); } return null; }
[ "protected", "function", "resolve", "(", "string", "$", "directiveName", ")", ":", "?", "Directive", "{", "if", "(", "$", "className", "=", "Arr", "::", "get", "(", "$", "this", "->", "resolved", ",", "$", "directiveName", ")", ")", "{", "return", "app...
Create a directive from resolved directive classes. @param string $directiveName @return \Nuwave\Lighthouse\Support\Contracts\Directive|null
[ "Create", "a", "directive", "from", "resolved", "directive", "classes", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/DirectiveFactory.php#L111-L118
train
nuwave/lighthouse
src/Schema/Factories/DirectiveFactory.php
DirectiveFactory.hydrate
protected function hydrate(Directive $directive, $definitionNode): Directive { return $directive instanceof BaseDirective ? $directive->hydrate($definitionNode) : $directive; }
php
protected function hydrate(Directive $directive, $definitionNode): Directive { return $directive instanceof BaseDirective ? $directive->hydrate($definitionNode) : $directive; }
[ "protected", "function", "hydrate", "(", "Directive", "$", "directive", ",", "$", "definitionNode", ")", ":", "Directive", "{", "return", "$", "directive", "instanceof", "BaseDirective", "?", "$", "directive", "->", "hydrate", "(", "$", "definitionNode", ")", ...
Set the given definition on the directive. @param \Nuwave\Lighthouse\Support\Contracts\Directive $directive @param \GraphQL\Language\AST\TypeSystemDefinitionNode $definitionNode @return \Nuwave\Lighthouse\Support\Contracts\Directive
[ "Set", "the", "given", "definition", "on", "the", "directive", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/DirectiveFactory.php#L193-L198
train
nuwave/lighthouse
src/Schema/Factories/DirectiveFactory.php
DirectiveFactory.createAssociatedDirectivesOfType
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
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); }) ...
[ "protected", "function", "createAssociatedDirectivesOfType", "(", "Node", "$", "node", ",", "string", "$", "directiveClass", ")", ":", "Collection", "{", "return", "(", "new", "Collection", "(", "$", "node", "->", "directives", ")", ")", "->", "map", "(", "f...
Get all directives of a certain type that are associated with an AST node. @param \GraphQL\Language\AST\Node $node @param string $directiveClass @return \Illuminate\Support\Collection <$directiveClass>
[ "Get", "all", "directives", "of", "a", "certain", "type", "that", "are", "associated", "with", "an", "AST", "node", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/DirectiveFactory.php#L207-L216
train
nuwave/lighthouse
src/Schema/Factories/DirectiveFactory.php
DirectiveFactory.createSingleDirectiveOfType
protected function createSingleDirectiveOfType(Node $node, string $directiveClass): ?Directive { $directives = $this->createAssociatedDirectivesOfType($node, $directiveClass); if ($directives->count() > 1) { $directiveNames = $directives->implode(', '); throw new DirectiveE...
php
protected function createSingleDirectiveOfType(Node $node, string $directiveClass): ?Directive { $directives = $this->createAssociatedDirectivesOfType($node, $directiveClass); if ($directives->count() > 1) { $directiveNames = $directives->implode(', '); throw new DirectiveE...
[ "protected", "function", "createSingleDirectiveOfType", "(", "Node", "$", "node", ",", "string", "$", "directiveClass", ")", ":", "?", "Directive", "{", "$", "directives", "=", "$", "this", "->", "createAssociatedDirectivesOfType", "(", "$", "node", ",", "$", ...
Get a single directive of a type that belongs to an AST node. Use this for directives types that can only occur once, such as field resolvers. This throws if more than one such directive is found. @param \GraphQL\Language\AST\Node $node @param string $directiveClass @return \Nuwave\Lighthouse\Support\Contracts\Di...
[ "Get", "a", "single", "directive", "of", "a", "type", "that", "belongs", "to", "an", "AST", "node", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/DirectiveFactory.php#L230-L243
train
nuwave/lighthouse
src/Schema/Factories/ArgumentFactory.php
ArgumentFactory.handle
public function handle(ArgumentValue $argumentValue): array { $definition = $argumentValue->getAstNode(); $argumentType = $argumentValue->getType(); $fieldArgument = [ 'name' => $argumentValue->getName(), 'description' => data_get($definition->description, 'value'),...
php
public function handle(ArgumentValue $argumentValue): array { $definition = $argumentValue->getAstNode(); $argumentType = $argumentValue->getType(); $fieldArgument = [ 'name' => $argumentValue->getName(), 'description' => data_get($definition->description, 'value'),...
[ "public", "function", "handle", "(", "ArgumentValue", "$", "argumentValue", ")", ":", "array", "{", "$", "definition", "=", "$", "argumentValue", "->", "getAstNode", "(", ")", ";", "$", "argumentType", "=", "$", "argumentValue", "->", "getType", "(", ")", ...
Convert argument definition to type. @param \Nuwave\Lighthouse\Schema\Values\ArgumentValue $argumentValue @return array
[ "Convert", "argument", "definition", "to", "type", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/ArgumentFactory.php#L17-L45
train
nuwave/lighthouse
src/Schema/Directives/WithDirective.php
WithDirective.handleField
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
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 { ...
[ "public", "function", "handleField", "(", "FieldValue", "$", "value", ",", "Closure", "$", "next", ")", ":", "FieldValue", "{", "$", "resolver", "=", "$", "value", "->", "getResolver", "(", ")", ";", "return", "$", "next", "(", "$", "value", "->", "set...
Eager load a relation on the parent instance. @param \Nuwave\Lighthouse\Schema\Values\FieldValue $value @param \Closure $next @return \Nuwave\Lighthouse\Schema\Values\FieldValue
[ "Eager", "load", "a", "relation", "on", "the", "parent", "instance", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/WithDirective.php#L34-L66
train
nuwave/lighthouse
src/Execution/ErrorBuffer.php
ErrorBuffer.defaultExceptionResolver
protected function defaultExceptionResolver(): Closure { return function (string $errorMessage) { return (new GenericException($errorMessage)) ->setExtensions([$this->errorType => $this->errors]) ->setCategory($this->errorType); }; }
php
protected function defaultExceptionResolver(): Closure { return function (string $errorMessage) { return (new GenericException($errorMessage)) ->setExtensions([$this->errorType => $this->errors]) ->setCategory($this->errorType); }; }
[ "protected", "function", "defaultExceptionResolver", "(", ")", ":", "Closure", "{", "return", "function", "(", "string", "$", "errorMessage", ")", "{", "return", "(", "new", "GenericException", "(", "$", "errorMessage", ")", ")", "->", "setExtensions", "(", "[...
Construct a default exception resolver. @return \Closure
[ "Construct", "a", "default", "exception", "resolver", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/ErrorBuffer.php#L45-L52
train
nuwave/lighthouse
src/Execution/ErrorBuffer.php
ErrorBuffer.push
public function push(string $errorMessage, ?string $key = null): self { if ($key === null) { $this->errors[] = $errorMessage; } else { $this->errors[$key][] = $errorMessage; } return $this; }
php
public function push(string $errorMessage, ?string $key = null): self { if ($key === null) { $this->errors[] = $errorMessage; } else { $this->errors[$key][] = $errorMessage; } return $this; }
[ "public", "function", "push", "(", "string", "$", "errorMessage", ",", "?", "string", "$", "key", "=", "null", ")", ":", "self", "{", "if", "(", "$", "key", "===", "null", ")", "{", "$", "this", "->", "errors", "[", "]", "=", "$", "errorMessage", ...
Push an error message into the buffer. @param string $errorMessage @param string|null $key @return $this
[ "Push", "an", "error", "message", "into", "the", "buffer", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/ErrorBuffer.php#L85-L94
train
nuwave/lighthouse
src/Execution/ErrorBuffer.php
ErrorBuffer.flush
public function flush(string $errorMessage): void { if (! $this->hasErrors()) { return; } $exception = $this->resolveException($errorMessage, $this); $this->clearErrors(); throw $exception; }
php
public function flush(string $errorMessage): void { if (! $this->hasErrors()) { return; } $exception = $this->resolveException($errorMessage, $this); $this->clearErrors(); throw $exception; }
[ "public", "function", "flush", "(", "string", "$", "errorMessage", ")", ":", "void", "{", "if", "(", "!", "$", "this", "->", "hasErrors", "(", ")", ")", "{", "return", ";", "}", "$", "exception", "=", "$", "this", "->", "resolveException", "(", "$", ...
Flush the errors. @param string $errorMessage @return void @throws \Exception
[ "Flush", "the", "errors", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/ErrorBuffer.php#L104-L115
train
nuwave/lighthouse
src/Schema/Values/FieldValue.php
FieldValue.getReturnType
public function getReturnType(): Type { if (! isset($this->returnType)) { $this->returnType = app(DefinitionNodeConverter::class)->toType( $this->field->type ); } return $this->returnType; }
php
public function getReturnType(): Type { if (! isset($this->returnType)) { $this->returnType = app(DefinitionNodeConverter::class)->toType( $this->field->type ); } return $this->returnType; }
[ "public", "function", "getReturnType", "(", ")", ":", "Type", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "returnType", ")", ")", "{", "$", "this", "->", "returnType", "=", "app", "(", "DefinitionNodeConverter", "::", "class", ")", "->", "toT...
Get an instance of the return type of the field. @return \GraphQL\Type\Definition\Type
[ "Get", "an", "instance", "of", "the", "return", "type", "of", "the", "field", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Values/FieldValue.php#L119-L128
train
nuwave/lighthouse
src/Pagination/PaginationUtils.php
PaginationUtils.calculateCurrentPage
public static function calculateCurrentPage(int $first, int $after, int $defaultPage = 1): int { return $first && $after ? (int) floor(($first + $after) / $first) : $defaultPage; }
php
public static function calculateCurrentPage(int $first, int $after, int $defaultPage = 1): int { return $first && $after ? (int) floor(($first + $after) / $first) : $defaultPage; }
[ "public", "static", "function", "calculateCurrentPage", "(", "int", "$", "first", ",", "int", "$", "after", ",", "int", "$", "defaultPage", "=", "1", ")", ":", "int", "{", "return", "$", "first", "&&", "$", "after", "?", "(", "int", ")", "floor", "("...
Calculate the current page to inform the user about the pagination state. @param int $first @param int $after @param int $defaultPage @return int
[ "Calculate", "the", "current", "page", "to", "inform", "the", "user", "about", "the", "pagination", "state", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/PaginationUtils.php#L18-L23
train
nuwave/lighthouse
src/Schema/TypeRegistry.php
TypeRegistry.register
public function register(Type $type): self { $this->types[$type->name] = $type; return $this; }
php
public function register(Type $type): self { $this->types[$type->name] = $type; return $this; }
[ "public", "function", "register", "(", "Type", "$", "type", ")", ":", "self", "{", "$", "this", "->", "types", "[", "$", "type", "->", "name", "]", "=", "$", "type", ";", "return", "$", "this", ";", "}" ]
Register type with registry. @param \GraphQL\Type\Definition\Type $type @return $this
[ "Register", "type", "with", "registry", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/TypeRegistry.php#L30-L35
train
nuwave/lighthouse
src/Schema/TypeRegistry.php
TypeRegistry.get
public function get(string $typeName): Type { if (! isset($this->types[$typeName])) { throw new InvariantViolation("No type {$typeName} was registered."); } return $this->types[$typeName]; }
php
public function get(string $typeName): Type { if (! isset($this->types[$typeName])) { throw new InvariantViolation("No type {$typeName} was registered."); } return $this->types[$typeName]; }
[ "public", "function", "get", "(", "string", "$", "typeName", ")", ":", "Type", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "types", "[", "$", "typeName", "]", ")", ")", "{", "throw", "new", "InvariantViolation", "(", "\"No type {$typeName} was ...
Resolve type instance by name. @param string $typeName @return \GraphQL\Type\Definition\Type @throws \GraphQL\Error\InvariantViolation
[ "Resolve", "type", "instance", "by", "name", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/TypeRegistry.php#L45-L52
train
nuwave/lighthouse
src/Pagination/PaginationManipulator.php
PaginationManipulator.transformToPaginatedField
public static function transformToPaginatedField( PaginationType $paginationType, FieldDefinitionNode $fieldDefinition, ObjectTypeDefinitionNode $parentType, DocumentAST $current, ?int $defaultCount = null, ?int $maxCount = null ): DocumentAST { if ($paginatio...
php
public static function transformToPaginatedField( PaginationType $paginationType, FieldDefinitionNode $fieldDefinition, ObjectTypeDefinitionNode $parentType, DocumentAST $current, ?int $defaultCount = null, ?int $maxCount = null ): DocumentAST { if ($paginatio...
[ "public", "static", "function", "transformToPaginatedField", "(", "PaginationType", "$", "paginationType", ",", "FieldDefinitionNode", "$", "fieldDefinition", ",", "ObjectTypeDefinitionNode", "$", "parentType", ",", "DocumentAST", "$", "current", ",", "?", "int", "$", ...
Transform the definition for a field to a field with pagination. This makes either an offset-based Paginator or a cursor-based Connection. The types in between are automatically generated and applied to the schema. @param \Nuwave\Lighthouse\Pagination\PaginationType $paginationType @param \GraphQL\Language\AST\Fie...
[ "Transform", "the", "definition", "for", "a", "field", "to", "a", "field", "with", "pagination", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/PaginationManipulator.php#L27-L40
train
nuwave/lighthouse
src/Pagination/PaginationManipulator.php
PaginationManipulator.countArgument
protected static function countArgument(string $argumentName, ?int $defaultCount = null, ?int $maxCount = null): string { $description = '"Limits number of fetched elements.'; if ($maxCount) { $description .= ' Maximum allowed value: '.$maxCount.'.'; } $description .= "\"...
php
protected static function countArgument(string $argumentName, ?int $defaultCount = null, ?int $maxCount = null): string { $description = '"Limits number of fetched elements.'; if ($maxCount) { $description .= ' Maximum allowed value: '.$maxCount.'.'; } $description .= "\"...
[ "protected", "static", "function", "countArgument", "(", "string", "$", "argumentName", ",", "?", "int", "$", "defaultCount", "=", "null", ",", "?", "int", "$", "maxCount", "=", "null", ")", ":", "string", "{", "$", "description", "=", "'\"Limits number of f...
Build the count argument definition string, considering default and max values. @param string $argumentName @param int|null $defaultCount @param int|null $maxCount @return string
[ "Build", "the", "count", "argument", "definition", "string", "considering", "default", "and", "max", "values", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/PaginationManipulator.php#L148-L163
train
nuwave/lighthouse
src/Schema/Types/Scalars/Upload.php
Upload.parseValue
public function parseValue($value): UploadedFile { if (! $value instanceof UploadedFile) { throw new Error( 'Could not get uploaded file, be sure to conform to GraphQL multipart request specification: https://github.com/jaydenseric/graphql-multipart-request-spec Instead got: '.Ut...
php
public function parseValue($value): UploadedFile { if (! $value instanceof UploadedFile) { throw new Error( 'Could not get uploaded file, be sure to conform to GraphQL multipart request specification: https://github.com/jaydenseric/graphql-multipart-request-spec Instead got: '.Ut...
[ "public", "function", "parseValue", "(", "$", "value", ")", ":", "UploadedFile", "{", "if", "(", "!", "$", "value", "instanceof", "UploadedFile", ")", "{", "throw", "new", "Error", "(", "'Could not get uploaded file, be sure to conform to GraphQL multipart request speci...
Parse a externally provided variable value into a Carbon instance. @param mixed $value @return \Illuminate\Http\UploadedFile @throws \GraphQL\Error\Error
[ "Parse", "a", "externally", "provided", "variable", "value", "into", "a", "Carbon", "instance", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Types/Scalars/Upload.php#L36-L45
train
nuwave/lighthouse
src/Pagination/Cursor.php
Cursor.decode
public static function decode(array $args): int { if ($cursor = Arr::get($args, 'after')) { return (int) base64_decode($cursor); } return 0; }
php
public static function decode(array $args): int { if ($cursor = Arr::get($args, 'after')) { return (int) base64_decode($cursor); } return 0; }
[ "public", "static", "function", "decode", "(", "array", "$", "args", ")", ":", "int", "{", "if", "(", "$", "cursor", "=", "Arr", "::", "get", "(", "$", "args", ",", "'after'", ")", ")", "{", "return", "(", "int", ")", "base64_decode", "(", "$", "...
Decode cursor from query arguments. If no 'after' argument is provided or the contents are not a valid base64 string, this will return 0. That will effectively reset pagination, so the user gets the first slice. @param array $args @return int
[ "Decode", "cursor", "from", "query", "arguments", "." ]
f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8
https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Pagination/Cursor.php#L28-L35
train
babenkoivan/scout-elasticsearch-driver
src/Console/SearchableModelMakeCommand.php
SearchableModelMakeCommand.buildClass
protected function buildClass($name) { $stub = parent::buildClass($name); $indexConfigurator = $this->getIndexConfigurator(); $stub = str_replace( 'DummyIndexConfigurator', $indexConfigurator ? "{$indexConfigurator}::class" : 'null', $stub ); $searc...
php
protected function buildClass($name) { $stub = parent::buildClass($name); $indexConfigurator = $this->getIndexConfigurator(); $stub = str_replace( 'DummyIndexConfigurator', $indexConfigurator ? "{$indexConfigurator}::class" : 'null', $stub ); $searc...
[ "protected", "function", "buildClass", "(", "$", "name", ")", "{", "$", "stub", "=", "parent", "::", "buildClass", "(", "$", "name", ")", ";", "$", "indexConfigurator", "=", "$", "this", "->", "getIndexConfigurator", "(", ")", ";", "$", "stub", "=", "s...
Build the class. @param string $name @return string
[ "Build", "the", "class", "." ]
f078a6f9d35b44e4ff440ea31e583973596e9726
https://github.com/babenkoivan/scout-elasticsearch-driver/blob/f078a6f9d35b44e4ff440ea31e583973596e9726/src/Console/SearchableModelMakeCommand.php#L78-L97
train
babenkoivan/scout-elasticsearch-driver
src/ElasticEngine.php
ElasticEngine.buildSearchQueryPayloadCollection
public function buildSearchQueryPayloadCollection(Builder $builder, array $options = []) { $payloadCollection = collect(); if ($builder instanceof SearchBuilder) { $searchRules = $builder->rules ?: $builder->model->getSearchRules(); foreach ($searchRules as $rule) { ...
php
public function buildSearchQueryPayloadCollection(Builder $builder, array $options = []) { $payloadCollection = collect(); if ($builder instanceof SearchBuilder) { $searchRules = $builder->rules ?: $builder->model->getSearchRules(); foreach ($searchRules as $rule) { ...
[ "public", "function", "buildSearchQueryPayloadCollection", "(", "Builder", "$", "builder", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "payloadCollection", "=", "collect", "(", ")", ";", "if", "(", "$", "builder", "instanceof", "SearchBuilder",...
Build the payload collection. @param \Laravel\Scout\Builder $builder @param array $options @return \Illuminate\Support\Collection
[ "Build", "the", "payload", "collection", "." ]
f078a6f9d35b44e4ff440ea31e583973596e9726
https://github.com/babenkoivan/scout-elasticsearch-driver/blob/f078a6f9d35b44e4ff440ea31e583973596e9726/src/ElasticEngine.php#L98-L157
train
babenkoivan/scout-elasticsearch-driver
src/ElasticEngine.php
ElasticEngine.count
public function count(Builder $builder) { $count = 0; $this ->buildSearchQueryPayloadCollection($builder, ['highlight' => false]) ->each(function ($payload) use (&$count) { $result = ElasticClient::count($payload); $count = $result['count']; ...
php
public function count(Builder $builder) { $count = 0; $this ->buildSearchQueryPayloadCollection($builder, ['highlight' => false]) ->each(function ($payload) use (&$count) { $result = ElasticClient::count($payload); $count = $result['count']; ...
[ "public", "function", "count", "(", "Builder", "$", "builder", ")", "{", "$", "count", "=", "0", ";", "$", "this", "->", "buildSearchQueryPayloadCollection", "(", "$", "builder", ",", "[", "'highlight'", "=>", "false", "]", ")", "->", "each", "(", "funct...
Return the number of documents found. @param \Laravel\Scout\Builder $builder @return int
[ "Return", "the", "number", "of", "documents", "found", "." ]
f078a6f9d35b44e4ff440ea31e583973596e9726
https://github.com/babenkoivan/scout-elasticsearch-driver/blob/f078a6f9d35b44e4ff440ea31e583973596e9726/src/ElasticEngine.php#L246-L263
train
babenkoivan/scout-elasticsearch-driver
src/ElasticEngine.php
ElasticEngine.searchRaw
public function searchRaw(Model $model, $query) { $payload = (new TypePayload($model)) ->setIfNotEmpty('body', $query) ->get(); return ElasticClient::search($payload); }
php
public function searchRaw(Model $model, $query) { $payload = (new TypePayload($model)) ->setIfNotEmpty('body', $query) ->get(); return ElasticClient::search($payload); }
[ "public", "function", "searchRaw", "(", "Model", "$", "model", ",", "$", "query", ")", "{", "$", "payload", "=", "(", "new", "TypePayload", "(", "$", "model", ")", ")", "->", "setIfNotEmpty", "(", "'body'", ",", "$", "query", ")", "->", "get", "(", ...
Make a raw search. @param \Illuminate\Database\Eloquent\Model $model @param array $query @return mixed
[ "Make", "a", "raw", "search", "." ]
f078a6f9d35b44e4ff440ea31e583973596e9726
https://github.com/babenkoivan/scout-elasticsearch-driver/blob/f078a6f9d35b44e4ff440ea31e583973596e9726/src/ElasticEngine.php#L272-L279
train
babenkoivan/scout-elasticsearch-driver
src/Payloads/RawPayload.php
RawPayload.setIfNotEmpty
public function setIfNotEmpty($key, $value) { if (empty($value)) { return $this; } return $this->set($key, $value); }
php
public function setIfNotEmpty($key, $value) { if (empty($value)) { return $this; } return $this->set($key, $value); }
[ "public", "function", "setIfNotEmpty", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "empty", "(", "$", "value", ")", ")", "{", "return", "$", "this", ";", "}", "return", "$", "this", "->", "set", "(", "$", "key", ",", "$", "value", ...
Set a value if it's not empty. @param string $key @param mixed $value @return $this
[ "Set", "a", "value", "if", "it", "s", "not", "empty", "." ]
f078a6f9d35b44e4ff440ea31e583973596e9726
https://github.com/babenkoivan/scout-elasticsearch-driver/blob/f078a6f9d35b44e4ff440ea31e583973596e9726/src/Payloads/RawPayload.php#L39-L46
train
babenkoivan/scout-elasticsearch-driver
src/Payloads/RawPayload.php
RawPayload.setIfNotNull
public function setIfNotNull($key, $value) { if (is_null($value)) { return $this; } return $this->set($key, $value); }
php
public function setIfNotNull($key, $value) { if (is_null($value)) { return $this; } return $this->set($key, $value); }
[ "public", "function", "setIfNotNull", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "return", "$", "this", ";", "}", "return", "$", "this", "->", "set", "(", "$", "key", ",", "$", "value", ...
Set a value if it's not null. @param string $key @param mixed $value @return $this
[ "Set", "a", "value", "if", "it", "s", "not", "null", "." ]
f078a6f9d35b44e4ff440ea31e583973596e9726
https://github.com/babenkoivan/scout-elasticsearch-driver/blob/f078a6f9d35b44e4ff440ea31e583973596e9726/src/Payloads/RawPayload.php#L55-L62
train