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

ResolverContext::setResolveInfo()   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 1
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\Resolver;
12
13
use GraphQL\Type\Definition\ResolveInfo;
14
use Ynlo\GraphQLBundle\Definition\ExecutableDefinitionInterface;
15
use Ynlo\GraphQLBundle\Definition\ObjectDefinitionInterface;
16
use Ynlo\GraphQLBundle\Definition\Registry\Endpoint;
17
18
/**
19
 * Context used for resolvers
20
 */
21
class ResolverContext
22
{
23
    /**
24
     * @var mixed
25
     */
26
    protected $root;
27
28
    /**
29
     * @var ObjectDefinitionInterface
30
     */
31
    protected $nodeDefinition;
32
33
    /**
34
     * Array of arguments given
35
     *
36
     * @var array
37
     */
38
    protected $args = [];
39
40
    /**
41
     * @var ExecutableDefinitionInterface
42
     */
43
    protected $definition;
44
45
    /**
46
     * @var Endpoint
47
     */
48
    protected $endpoint;
49
50
    /**
51
     * @var ResolveInfo
52
     */
53
    protected $resolveInfo;
54
55
    /**
56
     * @return mixed
57
     */
58
    public function getRoot()
59
    {
60
        return $this->root;
61
    }
62
63
    /**
64
     * @param mixed $root
65
     */
66 1
    public function setRoot($root)
67
    {
68 1
        $this->root = $root;
69 1
    }
70
71
    /**
72
     * @return ObjectDefinitionInterface
73
     */
74
    public function getNodeDefinition(): ObjectDefinitionInterface
75
    {
76
        return $this->nodeDefinition;
77
    }
78
79
    /**
80
     * @param ObjectDefinitionInterface $nodeDefinition
81
     */
82 1
    public function setNodeDefinition(ObjectDefinitionInterface $nodeDefinition)
83
    {
84 1
        $this->nodeDefinition = $nodeDefinition;
85 1
    }
86
87
    /**
88
     * @return array
89
     */
90
    public function getArgs(): array
91
    {
92
        return $this->args;
93
    }
94
95
    /**
96
     * @return mixed
97
     */
98
    public function getArg(string $name)
99
    {
100
        return $this->args[$name];
101
    }
102
103
    /**
104
     * @param array $args
105
     */
106 1
    public function setArgs(array $args)
107
    {
108 1
        $this->args = $args;
109 1
    }
110
111
    /**
112
     * @return ExecutableDefinitionInterface
113
     */
114
    public function getDefinition()
115
    {
116
        return $this->definition;
117
    }
118
119
    /**
120
     * @param ExecutableDefinitionInterface $definition
121
     */
122 1
    public function setDefinition(ExecutableDefinitionInterface $definition)
123
    {
124 1
        $this->definition = $definition;
125 1
    }
126
127
    /**
128
     * @return Endpoint
129
     */
130
    public function getEndpoint(): Endpoint
131
    {
132
        return $this->endpoint;
133
    }
134
135
    /**
136
     * @param Endpoint $endpoint
137
     */
138 1
    public function setEndpoint(Endpoint $endpoint)
139
    {
140 1
        $this->endpoint = $endpoint;
141 1
    }
142
143
    /**
144
     * @return ResolveInfo
145
     */
146
    public function getResolveInfo(): ResolveInfo
147
    {
148
        return $this->resolveInfo;
149
    }
150
151
    /**
152
     * @param ResolveInfo $resolveInfo
153
     */
154 1
    public function setResolveInfo(ResolveInfo $resolveInfo)
155
    {
156 1
        $this->resolveInfo = $resolveInfo;
157 1
    }
158
}
159