Completed
Push — master ( 373aee...88365a )
by Dominik
02:29
created

Expr::getNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Saxulum\ElasticSearchQueryBuilder;
4
5
use Saxulum\ElasticSearchQueryBuilder\Node\AbstractNode;
6
7
class Expr
8
{
9
    /**
10
     * @var AbstractNode
11
     */
12
    protected $node;
13
14
    /**
15
     * @var string
16
     */
17
    protected $key;
18
19
    /**
20
     * @var bool
21
     */
22
    protected $allowDefault;
23
24
    /**
25
     * @param AbstractNode $node
26
     */
27 2
    public function __construct(AbstractNode $node)
28
    {
29 2
        $this->node = $node;
30 2
        $this->allowDefault = false;
31 2
    }
32
33
    /**
34
     * @return AbstractNode
35
     */
36 2
    public function getNode()
37
    {
38 2
        return $this->node;
39
    }
40
41
    /**
42
     * @param string $key
43
     *
44
     * @return $this
45
     */
46 1
    public function key($key)
47
    {
48 1
        $this->key = $key;
49
50 1
        return $this;
51
    }
52
53
    /**
54
     * @return string
55
     */
56 2
    public function getKey()
57
    {
58 2
        return $this->key;
59
    }
60
61
    /**
62
     * @return $this
63
     */
64 1
    public function allowDefault()
65
    {
66 1
        $this->allowDefault = true;
67
68 1
        return $this;
69
    }
70
71
    /**
72
     * @return bool
73
     */
74 2
    public function isAllowDefault()
75
    {
76 2
        return $this->allowDefault;
77
    }
78
}
79