Completed
Push — master ( 2975e7...46c3ee )
by Rafael
07:49
created

FilterContext::getEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Filter;
12
13
use Ynlo\GraphQLBundle\Definition\FieldDefinition;
14
use Ynlo\GraphQLBundle\Definition\ObjectDefinition;
15
use Ynlo\GraphQLBundle\Definition\Registry\Endpoint;
16
17
/**
18
 * Context where the filter is applied
19
 */
20
class FilterContext
21
{
22
    /**
23
     * @var Endpoint
24
     */
25
    private $endpoint;
26
27
    /**
28
     * @var ObjectDefinition
29
     */
30
    private $node;
31
32
    /**
33
     * @var FieldDefinition|null
34
     */
35
    private $field;
36
37
    /**
38
     * FilterContext constructor.
39
     *
40
     * @param Endpoint             $endpoint
41
     * @param ObjectDefinition     $node
42
     * @param null|FieldDefinition $field
43
     */
44 45
    public function __construct(Endpoint $endpoint, ObjectDefinition $node, ?FieldDefinition $field = null)
45
    {
46 45
        $this->endpoint = $endpoint;
47 45
        $this->node = $node;
48 45
        $this->field = $field;
49 45
    }
50
51
    /**
52
     * @return Endpoint
53
     */
54 1
    public function getEndpoint(): Endpoint
55
    {
56 1
        return $this->endpoint;
57
    }
58
59
    /**
60
     * @return ObjectDefinition
61
     */
62 9
    public function getNode(): ObjectDefinition
63
    {
64 9
        return $this->node;
65
    }
66
67
    /**
68
     * @return null|FieldDefinition
69
     */
70 38
    public function getField(): ?FieldDefinition
71
    {
72 38
        return $this->field;
73
    }
74
75
    /**
76
     * @param null|FieldDefinition $field
77
     */
78 8
    public function setField(?FieldDefinition $field): void
79
    {
80 8
        $this->field = $field;
81 8
    }
82
}
83