Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 8ac73c...b87729 )
by Jérémiah
21s queued 14s
created

MutationFieldResolver   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 15
dl 0
loc 38
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setObjectOrArrayValue() 0 6 3
A getAliases() 0 3 1
A __construct() 0 4 1
A __invoke() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\GraphQL\Relay\Mutation;
6
7
use GraphQL\Executor\Promise\PromiseAdapter;
8
use Overblog\GraphQLBundle\Definition\ArgumentFactory;
9
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
10
use Overblog\GraphQLBundle\Definition\Resolver\ResolverInterface;
11
12
final class MutationFieldResolver implements ResolverInterface, AliasedInterface
13
{
14
    private $promiseAdapter;
15
16
    private $argumentFactory;
17
18
    public function __construct(PromiseAdapter $promiseAdapter, ArgumentFactory $argumentFactory)
19 9
    {
20
        $this->promiseAdapter = $promiseAdapter;
21 9
        $this->argumentFactory = $argumentFactory;
22 9
    }
23 9
24
    public function __invoke($args, $context, $info, \Closure $mutateAndGetPayloadCallback)
25 7
    {
26
        $input = $this->argumentFactory->create($args['input']);
27 7
28
        return $this->promiseAdapter->createFulfilled($mutateAndGetPayloadCallback($input, $context, $info))
29 7
            ->then(function ($payload) use ($input) {
30
                $this->setObjectOrArrayValue($payload, 'clientMutationId', $input['clientMutationId']);
31 7
32
                return $payload;
33 7
            });
34 7
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public static function getAliases(): array
40 35
    {
41
        return ['__invoke' => 'relay_mutation_field'];
42 35
    }
43
44
    private function setObjectOrArrayValue(&$objectOrArray, $fieldName, $value): void
45
    {
46
        if (\is_array($objectOrArray)) {
47
            $objectOrArray[$fieldName] = $value;
48
        } elseif (\is_object($objectOrArray)) {
49
            $objectOrArray->$fieldName = $value;
50
        }
51
    }
52
}
53