ServerConfig
in package
Server configuration class.
Could be passed directly to server constructor. List of options accepted by create method is described in docs.
Usage example:
$config = Automattic\WooCommerce\Vendor\GraphQL\Server\ServerConfig::create()
->setSchema($mySchema)
->setContext($myContext);
$server = new Automattic\WooCommerce\Vendor\GraphQL\Server\StandardServer($config);
Tags
Table of Contents
- $context : mixed|callable
- $debugFlag : int
- $errorFormatter : callable|null
- $errorsHandler : callable|null
- $fieldResolver : callable|null
- $persistedQueryLoader : callable|null
- $promiseAdapter : PromiseAdapter|null
- $queryBatching : bool
- $rootValue : mixed|callable
- $schema : Schema|null
- $validationRules : array<string|int, ValidationRule>|callable|null
- create() : self
- Converts an array of options to instance of ServerConfig (or just returns empty config when array is not passed).
- getContext() : mixed|callable
- getDebugFlag() : int
- getErrorFormatter() : callable|null
- getErrorsHandler() : callable|null
- getFieldResolver() : callable|null
- getPersistedQueryLoader() : callable|null
- getPromiseAdapter() : PromiseAdapter|null
- getQueryBatching() : bool
- getRootValue() : mixed|callable
- getSchema() : Schema|null
- getValidationRules() : array<string|int, ValidationRule>|callable|null
- setContext() : self
- setDebugFlag() : self
- Set response debug flags.
- setErrorFormatter() : self
- setErrorsHandler() : self
- setFieldResolver() : self
- setPersistedQueryLoader() : self
- setPromiseAdapter() : self
- setQueryBatching() : self
- Allow batching queries (disabled by default).
- setRootValue() : self
- setSchema() : self
- setValidationRules() : self
- Set validation rules for this server.
Properties
$context
private
mixed|callable
$context
$debugFlag
private
int
$debugFlag
= AutomatticWooCommerceVendorGraphQLErrorDebugFlag::NONE
$errorFormatter
private
callable|null
$errorFormatter
Tags
$errorsHandler
private
callable|null
$errorsHandler
Tags
$fieldResolver
private
callable|null
$fieldResolver
$persistedQueryLoader
private
callable|null
$persistedQueryLoader
Tags
$promiseAdapter
private
PromiseAdapter|null
$promiseAdapter
= null
$queryBatching
private
bool
$queryBatching
= false
$rootValue
private
mixed|callable
$rootValue
Tags
$schema
private
Schema|null
$schema
= null
$validationRules
private
array<string|int, ValidationRule>|callable|null
$validationRules
Tags
Methods
create()
Converts an array of options to instance of ServerConfig (or just returns empty config when array is not passed).
public
static create([array<string, mixed> $config = [] ]) : self
Parameters
- $config : array<string, mixed> = []
Tags
Return values
self —getContext()
public
getContext() : mixed|callable
Return values
mixed|callable —getDebugFlag()
public
getDebugFlag() : int
Return values
int —getErrorFormatter()
public
getErrorFormatter() : callable|null
Tags
Return values
callable|null —getErrorsHandler()
public
getErrorsHandler() : callable|null
Tags
Return values
callable|null —getFieldResolver()
public
getFieldResolver() : callable|null
Return values
callable|null —getPersistedQueryLoader()
public
getPersistedQueryLoader() : callable|null
Tags
Return values
callable|null —getPromiseAdapter()
public
getPromiseAdapter() : PromiseAdapter|null
Return values
PromiseAdapter|null —getQueryBatching()
public
getQueryBatching() : bool
Return values
bool —getRootValue()
public
getRootValue() : mixed|callable
Tags
Return values
mixed|callable —getSchema()
public
getSchema() : Schema|null
Return values
Schema|null —getValidationRules()
public
getValidationRules() : array<string|int, ValidationRule>|callable|null
Tags
Return values
array<string|int, ValidationRule>|callable|null —setContext()
public
setContext(mixed|callable $context) : self
Parameters
- $context : mixed|callable
Return values
self —setDebugFlag()
Set response debug flags.
public
setDebugFlag([int $debugFlag = DebugFlag::INCLUDE_DEBUG_MESSAGE ]) : self
Parameters
- $debugFlag : int = DebugFlag::INCLUDE_DEBUG_MESSAGE
Tags
Return values
self —setErrorFormatter()
public
setErrorFormatter(callable $errorFormatter) : self
Parameters
- $errorFormatter : callable
Tags
Return values
self —setErrorsHandler()
public
setErrorsHandler(callable $handler) : self
Parameters
- $handler : callable
Tags
Return values
self —setFieldResolver()
public
setFieldResolver(callable $fieldResolver) : self
Parameters
- $fieldResolver : callable
Return values
self —setPersistedQueryLoader()
public
setPersistedQueryLoader(callable|null $persistedQueryLoader) : self
Parameters
- $persistedQueryLoader : callable|null
Tags
Return values
self —setPromiseAdapter()
public
setPromiseAdapter(PromiseAdapter $promiseAdapter) : self
Parameters
- $promiseAdapter : PromiseAdapter
Return values
self —setQueryBatching()
Allow batching queries (disabled by default).
public
setQueryBatching(bool $enableBatching) : self
Parameters
- $enableBatching : bool
Return values
self —setRootValue()
public
setRootValue(mixed|callable $rootValue) : self
Parameters
- $rootValue : mixed|callable
Tags
Return values
self —setSchema()
public
setSchema(Schema $schema) : self
Parameters
- $schema : Schema
Return values
self —setValidationRules()
Set validation rules for this server.
public
setValidationRules(array<string|int, ValidationRule>|callable|null $validationRules) : self
Parameters
- $validationRules : array<string|int, ValidationRule>|callable|null
