Passed
Pull Request — master (#281)
by Sam
03:28
created

VisitorResult   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAction() 0 3 1
A setAction() 0 5 1
A getValue() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace Digia\GraphQL\Language\Visitor;
4
5
use Digia\GraphQL\Language\Node\NodeInterface;
6
7
class VisitorResult
8
{
9
10
    public const ACTION_NO_ACTION = 'NO_ACTION';
11
    public const ACTION_BREAK     = 'BREAK';
12
    public const ACTION_REPLACE   = 'REPLACE';
13
14
    /**
15
     * @var NodeInterface|null
16
     */
17
    protected $value;
18
19
    /**
20
     * @var string
21
     */
22
    protected $action;
23
24
    /**
25
     * @param NodeInterface|null $value
26
     * @param string             $action
27
     */
28
    public function __construct(?NodeInterface $value = null, string $action = self::ACTION_NO_ACTION)
29
    {
30
        $this->value  = $value;
31
        $this->action = $action;
32
    }
33
34
    /**
35
     * @return NodeInterface|null
36
     */
37
    public function getValue(): ?NodeInterface
38
    {
39
        return $this->value;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getAction(): string
46
    {
47
        return $this->action;
48
    }
49
50
    /**
51
     * @param string $action
52
     * @return self
53
     */
54
    public function setAction(string $action): self
55
    {
56
        $this->action = $action;
57
58
        return $this;
59
    }
60
}
61