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

NodeField::toFieldDefinition()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 30
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 2.0034

Importance

Changes 2
Bugs 1 Features 2
Metric Value
c 2
b 1
f 2
dl 0
loc 30
ccs 19
cts 21
cp 0.9048
rs 8.8571
cc 2
eloc 19
nc 1
nop 1
crap 2.0034
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 NodeField implements MappingInterface
19
{
20 11
    public function toMappingDefinition(array $config)
21
    {
22 11
        Config::validate($config, [
23 11
            'name' => Config::STRING | Config::REQUIRED,
24 11
            'idFetcher' => Config::CALLBACK | Config::REQUIRED,
25 11
            'nodeInterfaceType' => Config::OBJECT_TYPE | Config::CALLBACK | Config::REQUIRED,
26 11
        ]);
27
28 11
        $name = $config['name'];
29 11
        $idFetcher = $config['idFetcher'];
30 11
        $nodeInterfaceType = $config['nodeInterfaceType'];
31
32
        return [
33 11
            'name' => $name,
34 11
            'description' => 'Fetches an object given its ID',
35 11
            'type' => $nodeInterfaceType,
36
            'args' => [
37 11
                'id' => ['type' => Type::nonNull(Type::id()), 'description' => 'The ID of an object'],
38 11
            ],
39 11
            'resolve' => function ($obj, $args, $info) use ($idFetcher) {
40 8
                return call_user_func_array($idFetcher, [$args['id'], $info]);
41 11
            },
42 11
        ];
43
    }
44
}
45