Passed
Push — master ( c85183...4934b6 )
by Christoffer
03:11
created

AbstractFieldResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A getResolveCallback() 0 4 1
1
<?php
2
3
namespace Digia\GraphQL\Schema\Resolver;
4
5
use Digia\GraphQL\Execution\ResolveInfo;
6
7
abstract class AbstractFieldResolver implements ResolverInterface
8
{
9
    use ResolverTrait;
10
11
    /**
12
     * @param mixed            $rootValue
13
     * @param array            $arguments
14
     * @param mixed            $context
15
     * @param ResolveInfo|null $info
16
     * @return mixed
17
     */
18
    abstract public function resolve($rootValue, array $arguments, $context = null, ?ResolveInfo $info = null);
19
20
    /**
21
     * @return mixed
22
     */
23
    public function __invoke()
24
    {
25
        return $this->resolve(...\func_get_args());
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function getResolveCallback(): ?callable
32
    {
33
        return function ($rootValue, array $arguments, $context = null, ?ResolveInfo $info = null) {
34
            return $this->resolve($rootValue, $arguments, $context, $info);
35
        };
36
    }
37
}
38