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

GlobalIdField::toFieldDefinition()   B

Complexity

Conditions 6
Paths 4

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 2
Bugs 1 Features 2
Metric Value
c 2
b 1
f 2
dl 0
loc 24
ccs 0
cts 22
cp 0
rs 8.5125
cc 6
eloc 16
nc 4
nop 1
crap 42
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\ResolveInfo;
16
use GraphQL\Type\Definition\Type;
17
use Overblog\GraphQLBundle\Definition\FieldInterface;
18
19
class GlobalIdField implements FieldInterface
20
{
21
    public function toFieldDefinition(array $config)
22
    {
23
        Config::validate($config, [
24
            'name' => Config::STRING | Config::REQUIRED,
25
            'typeName' => Config::STRING,
26
            'idFetcher' => Config::CALLBACK,
27
        ]);
28
29
        $name = $config['name'];
30
        $typeName = isset($config['typeName']) ? $config['typeName'] : null;
31
        $idFetcher = isset($config['idFetcher']) ? $config['idFetcher'] : null;
32
33
        return [
34
            'name' => $name,
35
            'description' => 'The ID of an object',
36
            'type' => Type::nonNull(Type::id()),
37
            'resolve' => function ($obj, $args, ResolveInfo $info) use ($idFetcher, $typeName) {
38
                return GlobalId::toGlobalId(
39
                    !empty($typeName) ? $typeName : $info->parentType->name,
40
                    is_callable($idFetcher) ? call_user_func_array($idFetcher, [$obj, $info]) : (is_object($obj) ? $obj->id : $obj['id'])
41
                );
42
            },
43
        ];
44
    }
45
}
46