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
Pull Request — master (#4)
by Jérémiah
06:39
created

PluralIdentifyingRootField::toFieldDefinition()   B

Complexity

Conditions 4
Paths 2

Size

Total Lines 41
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 3
Bugs 2 Features 2
Metric Value
c 3
b 2
f 2
dl 0
loc 41
ccs 0
cts 36
cp 0
rs 8.5806
cc 4
eloc 26
nc 2
nop 1
crap 20
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\Relay\Node;
13
14
use GraphQL\Type\Definition\Config;
15
use GraphQL\Type\Definition\Type;
16
use Overblog\GraphQLBundle\Definition\FieldInterface;
17
18
class PluralIdentifyingRootField implements FieldInterface
19
{
20
    public function toFieldDefinition(array $config)
21
    {
22
        Config::validate($config, [
23
            'name' => Config::STRING,
24
            'argName' => Config::STRING | Config::REQUIRED,
25
            'inputType' => Config::OBJECT_TYPE | Config::CALLBACK | Config::REQUIRED,
26
            'outputType' => Config::OBJECT_TYPE | Config::CALLBACK | Config::REQUIRED,
27
            'resolveSingleInput' => Config::CALLBACK | Config::REQUIRED,
28
            'description' => Config::STRING,
29
        ]);
30
31
        $inputArgs = [
32
            $config['argName'] => [
33
                'type' => Type::nonNull(
34
                    Type::listOf(
35
                        Type::nonNull($config['inputType'])
36
                    )
37
                ),
38
            ],
39
        ];
40
41
        return [
42
            'name' => $config['name'],
43
            'description' => isset($config['description']) ? $config['description'] : null,
44
            'type' => Type::listOf($config['outputType']),
45
            'args' => $inputArgs,
46
            'resolve' => function ($obj, $args, $info) use ($config) {
47
                $inputs = $args[$config['argName']];
48
49
                $data = [];
50
51
                foreach ($inputs as $input) {
52
                    $data[$input] = is_callable($config['resolveSingleInput']) ?
53
                        call_user_func_array($config['resolveSingleInput'], [$input, $info]) :
54
                        null;
55
                }
56
57
                return $data;
58
            },
59
        ];
60
    }
61
}
62