Completed
Pull Request — master (#281)
by Sam
04:03
created

AbstractReturnValue::setAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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