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   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 25
Duplicated Lines 40 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 0
dl 10
loc 25
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B toMappingDefinition() 0 11 5
A cleanIdFetcher() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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