1
<?php
2

3
namespace Nuwave\Lighthouse\Schema\Directives;
4

5
use Nuwave\Lighthouse\Support\Contracts\ArgTransformerDirective;
6
use Nuwave\Lighthouse\Support\Contracts\Directive;
7

8
class TransformArgsDirective extends ArgTraversalDirective
9
{
10 1
    public static function definition(): string
11
    {
12
        return /** @lang GraphQL */ <<<'GRAPHQL'
13 1
"""
14
Transform the arguments of a field.
15
"""
16
directive @transformArgs on FIELD_DEFINITION
17
GRAPHQL;
18
    }
19

20 1
    protected function applyDirective(Directive $directive, $value)
21
    {
22 1
        if ($directive instanceof ArgTransformerDirective) {
23 1
            return $directive->transform($value);
24
        }
25

26 1
        return $value;
27
    }
28
}

Read our documentation on viewing source code .

Loading