Completed
Push — master ( c56c43...dca9cd )
by Hans
02:19
created

Field::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 4
crap 1
1
<?php
2
3
namespace HansOtt\GraphQL\Schema;
4
5
final class Field extends NodeBase
6
{
7
    public $name;
8
    public $type;
9
    public $arguments;
10
11
    /**
12
     * @param string $name
13
     * @param Type $type
14
     * @param Argument[] $arguments
15
     * @param Location|null $location
16
     */
17 9
    public function __construct($name, Type $type, array $arguments = array(), Location $location = null)
18
    {
19 9
        parent::__construct($location);
20 9
        $this->name = (string) $name;
21 9
        $this->type = $type;
22 9
        $this->arguments = $arguments;
23 9
    }
24
25
    public function getChildren()
26
    {
27
        return array_merge(
28
            array($this->type),
29
            $this->arguments
30
        );
31
    }
32
}
33