Automattic\WooCommerce\Vendor\GraphQL\Utils

ASTDefinitionBuilder::buildDirectivepublicWC 1.0

Method of the class: ASTDefinitionBuilder{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ASTDefinitionBuilder = new ASTDefinitionBuilder();
$ASTDefinitionBuilder->buildDirective( $directiveNode ): Directive;
$directiveNode(DirectiveDefinitionNode) (required)
.

ASTDefinitionBuilder::buildDirective() code WC 10.9.1

public function buildDirective(DirectiveDefinitionNode $directiveNode): Directive
{
    $locations = [];
    foreach ($directiveNode->locations as $location) {
        $locations[] = $location->value;
    }

    return new Directive([
        'name' => $directiveNode->name->value,
        'description' => $directiveNode->description->value ?? null,
        'args' => $this->makeInputValues($directiveNode->arguments),
        'isRepeatable' => $directiveNode->repeatable,
        'locations' => $locations,
        'astNode' => $directiveNode,
    ]);
}