SelectionInlineFragment::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 4
crap 1
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