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

AbstractReturnValue   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAction() 0 3 1
A getValue() 0 3 1
A __construct() 0 4 1
A setAction() 0 5 1
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