Automattic\WooCommerce\Vendor\GraphQL\Server

StandardServer::executeRequestpublicWC 1.0

Executes a Automattic\WooCommerce\Vendor\GraphQL operation and returns an execution result (or promise when promise adapter is different from SyncPromiseAdapter).

When $parsedBody is not set, it uses PHP globals to parse a request. It is possible to implement request parsing elsewhere (e.g. using framework Request instance) and then pass it to the server.

PSR-7 compatible method executePsrRequest() does exactly this.

Method of the class: StandardServer{}

No Hooks.

Returns

ExecutionResult|Array. ExecutionResult>|Promise

Usage

$StandardServer = new StandardServer();
$StandardServer->executeRequest( $parsedBody );
$parsedBody(OperationParams|array)
.
Default: null

StandardServer::executeRequest() code WC 10.9.4

public function executeRequest($parsedBody = null)
{
    if ($parsedBody === null) {
        $parsedBody = $this->helper->parseHttpRequest();
    }

    if (is_array($parsedBody)) {
        return $this->helper->executeBatch($this->config, $parsedBody);
    }

    return $this->helper->executeOperation($this->config, $parsedBody);
}