SelectionInlineFragment   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 46.15%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 37
loc 37
ccs 6
cts 13
cp 0.4615
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 11 11 1
A getChildren() 12 12 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
namespace HansOtt\GraphQL\Query;
4
5 View Code Duplication
final class SelectionInlineFragment extends NodeBase implements Selection
0 ignored issues
show
Duplication introduced by
This class 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...
6
{
7
    public $typeCondition;
8
    public $directives;
9
    public $selectionSet;
10
11
    /**
12
     * @param TypeCondition|null $typeCondition
13
     * @param Directive[] $directives
14
     * @param SelectionSet $selectionSet
15
     * @param Location|null $location
16
     */
17 3
    public function __construct(
18
        TypeCondition $typeCondition = null,
19
        array $directives = array(),
20
        SelectionSet $selectionSet,
21
        Location $location = null
22
    ) {
23 3
        parent::__construct($location);
24 3
        $this->typeCondition = $typeCondition;
25 3
        $this->directives = $directives;
26 3
        $this->selectionSet = $selectionSet;
27 3
    }
28
29
    public function getChildren()
30
    {
31
        $children = array($this->typeCondition);
32
33
        foreach ($this->directives as $directive) {
34
            $children[] = $directive;
35
        }
36
37
        $children[] = $this->selectionSet;
38
39
        return $children;
40
    }
41
}
42