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 (#7)
by Jérémiah
09:02
created

PluralIdentifyingRootField::toFieldDefinition()   B

Complexity

Conditions 4
Paths 2

Size

Total Lines 41
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 31
CRAP Score 4.0004

Importance

Changes 3
Bugs 2 Features 2
Metric Value
c 3
b 2
f 2
dl 0
loc 41
ccs 31
cts 32
cp 0.9688
rs 8.5806
cc 4
eloc 26
nc 2
nop 1
crap 4.0004
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\Builder\MappingInterface;
17
18
class PluralIdentifyingRootField implements MappingInterface
19
{
20 2
    public function toMappingDefinition(array $config)
21
    {
22 2
        Config::validate($config, [
23 2
            'name' => Config::STRING,
24 2
            'argName' => Config::STRING | Config::REQUIRED,
25 2
            'inputType' => Config::OBJECT_TYPE | Config::CALLBACK | Config::REQUIRED,
26 2
            'outputType' => Config::OBJECT_TYPE | Config::CALLBACK | Config::REQUIRED,
27 2
            'resolveSingleInput' => Config::CALLBACK | Config::REQUIRED,
28 2
            'description' => Config::STRING,
29 2
        ]);
30
31
        $inputArgs = [
32 2
            $config['argName'] => [
33 2
                'type' => Type::nonNull(
34 2
                    Type::listOf(
35 2
                        Type::nonNull($config['inputType'])
36 2
                    )
37 2
                ),
38 2
            ],
39 2
        ];
40
41
        return [
42 2
            'name' => $config['name'],
43 2
            'description' => isset($config['description']) ? $config['description'] : null,
44 2
            'type' => Type::listOf($config['outputType']),
45 2
            'args' => $inputArgs,
46 2
            'resolve' => function ($obj, $args, $info) use ($config) {
47 1
                $inputs = $args[$config['argName']];
48
49 1
                $data = [];
50
51 1
                foreach ($inputs as $input) {
52 1
                    $data[$input] = is_callable($config['resolveSingleInput']) ?
53 1
                        call_user_func_array($config['resolveSingleInput'], [$input, $info]) :
54
                        null;
55 1
                }
56
57 1
                return $data;
58 2
            },
59 2
        ];
60
    }
61
}
62