Passed
Pull Request — master (#301)
by Christoffer
03:37
created

AbstractFieldResolver::getResolveCallback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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