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::getAliases()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 0
crap 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