Completed
Push — master ( 0e0bd4...d314c1 )
by Christoffer
03:35 queued 01:20
created

FieldContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Validation\Conflict;
4
5
use Digia\GraphQL\Language\Node\FieldNode;
6
use Digia\GraphQL\Type\Definition\CompositeTypeInterface;
7
use Digia\GraphQL\Type\Definition\Field;
8
9
class FieldContext
10
{
11
    /**
12
     * @var CompositeTypeInterface|null
13
     */
14
    protected $parentType;
15
16
    /**
17
     * @var FieldNode
18
     */
19
    protected $node;
20
21
    /**
22
     * @var Field|null
23
     */
24
    protected $definition;
25
26
    /**
27
     * FieldContext constructor.
28
     * @param CompositeTypeInterface|null $parentType
29
     * @param FieldNode                   $node
30
     * @param Field|null                  $definition
31
     */
32
    public function __construct(
33
        ?CompositeTypeInterface $parentType,
34
        FieldNode $node,
35
        ?Field $definition = null
36
    ) {
37
        $this->parentType = $parentType;
38
        $this->node       = $node;
39
        $this->definition = $definition;
40
    }
41
42
    /**
43
     * @return CompositeTypeInterface|null
44
     */
45
    public function getParentType(): ?CompositeTypeInterface
46
    {
47
        return $this->parentType;
48
    }
49
50
    /**
51
     * @return FieldNode
52
     */
53
    public function getNode(): FieldNode
54
    {
55
        return $this->node;
56
    }
57
58
    /**
59
     * @return Field|null
60
     */
61
    public function getDefinition(): ?Field
62
    {
63
        return $this->definition;
64
    }
65
}
66