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

Passed
Pull Request — master (#234)
by Jérémiah
04:38
created

GlobalIdFieldDefinition::toMappingDefinition()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
ccs 0
cts 7
cp 0
rs 8.8571
cc 5
eloc 8
nc 16
nop 1
crap 30
1
<?php
2
3
namespace Overblog\GraphQLBundle\Relay\Node;
4
5
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;
6
use Overblog\GraphQLBundle\GraphQL\Relay\Node\GlobalIdFieldResolver;
7
8
final class GlobalIdFieldDefinition implements MappingInterface
9
{
10
    public function toMappingDefinition(array $config)
11
    {
12
        $typeName = isset($config['typeName']) && is_string($config['typeName']) ? var_export($config['typeName'], true) : 'null';
13
        $idFetcher = isset($config['idFetcher']) && is_string($config['idFetcher']) ? $this->cleanIdFetcher($config['idFetcher']) : 'null';
14
        $resolver = addslashes(GlobalIdFieldResolver::class);
15
16
        return [
17
            'description' => 'The ID of an object',
18
            'type' => 'ID!',
19
            'resolve' => "@=resolver('$resolver', [value, info, $idFetcher, $typeName])",
20
        ];
21
    }
22
23 View Code Duplication
    private function cleanIdFetcher($idFetcher)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        $cleanIdFetcher = $idFetcher;
26
27
        if (0 === strpos($idFetcher, '@=')) {
28
            $cleanIdFetcher = substr($idFetcher, 2);
29
        }
30
31
        return $cleanIdFetcher;
32
    }
33
}
34