CallableResolver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 24
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A createFunction() 0 10 1
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