Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class ArrayResolver implements ResolverInterface |
||
6 | { |
||
7 | protected const TYPE_RESOLVER_KEY = '__resolveType'; |
||
8 | |||
9 | /** |
||
10 | * @var callable[] |
||
11 | */ |
||
12 | protected $resolvers; |
||
13 | |||
14 | /** |
||
15 | * MapResolver constructor. |
||
16 | * @param callable[] $resolvers |
||
17 | */ |
||
18 | public function __construct(array $resolvers) |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @param string $fieldName |
||
25 | * @param callable $resolver |
||
26 | */ |
||
27 | public function addResolver(string $fieldName, callable $resolver) |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param string $fieldName |
||
34 | * @return callable|null |
||
35 | */ |
||
36 | public function getResolveCallback(string $fieldName): ?callable |
||
37 | { |
||
38 | return $this->resolvers[$fieldName] ?? null; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @inheritdoc |
||
43 | */ |
||
44 | public function getTypeResolver(): ?callable |
||
47 | } |
||
48 | } |
||
49 |