-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOperator.php
41 lines (34 loc) · 1.15 KB
/
Operator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php declare(strict_types = 1);
namespace LastDragon_ru\LaraASP\GraphQL\Builder\Contracts;
use LastDragon_ru\LaraASP\GraphQL\Builder\Exceptions\OperatorUnsupportedBuilder;
use LastDragon_ru\LaraASP\GraphQL\Builder\Field;
use Nuwave\Lighthouse\Execution\Arguments\Argument;
use Nuwave\Lighthouse\Support\Contracts\Directive;
/**
* Operator must also implement individual {@see Scope}.
*/
interface Operator extends Directive {
/**
* Must be a valid GraphQL Object Field name.
*/
public static function getName(): string;
public function isAvailable(TypeProvider $provider, TypeSource $source, Context $context): bool;
public function getFieldType(TypeProvider $provider, TypeSource $source, Context $context): ?string;
public function getFieldDescription(): ?string;
/**
* @template TBuilder of object
*
* @param TBuilder $builder
*
* @throws OperatorUnsupportedBuilder if `$builder` is not supported
*
* @return TBuilder
*/
public function call(
Handler $handler,
object $builder,
Field $field,
Argument $argument,
Context $context,
): object;
}