CallableResolver::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Arthem\GraphQLMapper\Schema\Resolve;
4
5
use Arthem\GraphQLMapper\Mapping\Field;
6
use GraphQL\Type\Definition\ResolveInfo;
7
8
class CallableResolver extends SingletonResolver
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function getName()
14
    {
15
        return 'callable';
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function createFunction(array $config, Field $field)
22
    {
23
        return function ($node, array $arguments, ResolveInfo $info) {
24
            $resolveConfig = $this->getResolveConfig($info);
25
26
            $function = $resolveConfig['function'];
27
28
            return call_user_func_array($function, $arguments);
29
        };
30
    }
31
}
32