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
Push — master ( 024700...341ac6 )
by Jérémiah
04:30
created

GlobalIdFieldDefinition::toMappingDefinition()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 8.8571
cc 5
eloc 7
nc 16
nop 1
crap 5
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 Overblog\GraphQLBundle\Definition\Builder\MappingInterface;
15
use Overblog\GraphQLBundle\Definition\Type;
16
17
class GlobalIdFieldDefinition implements MappingInterface
18
{
19 1
    public function toMappingDefinition(array $config)
20
    {
21 1
        $typeName = isset($config['typeName']) && is_string($config['typeName']) ? var_export($config['typeName'], true) : 'null';
22 1
        $idFetcher = isset($config['idFetcher']) && is_string($config['idFetcher']) ? $this->cleanIdFetcher($config['idFetcher']) : 'null';
23
24
        return [
25 1
            'description' => 'The ID of an object',
26 1
            'type' => 'ID!',
27 1
            'resolve' => "@=resolver('relay_globalid_field', [value, info, $idFetcher, $typeName])",
28 1
        ];
29
    }
30
31 1 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...
32
    {
33 1
        $cleanIdFetcher = $idFetcher;
34
35 1
        if (0 === strpos($idFetcher, '@=')) {
36 1
            $cleanIdFetcher = substr($idFetcher, 2);
37 1
        }
38
39 1
        return $cleanIdFetcher;
40
    }
41
}
42