Completed
Branch conditions-refactoring (4b1dba)
by Romain
03:17
created

ConditionParserState::setCurrentExpression()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/*
3
 * 2016 Romain CANON <[email protected]>
4
 *
5
 * This file is part of the TYPO3 Formz project.
6
 * It is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License, either
8
 * version 3 of the License, or any later version.
9
 *
10
 * For the full copyright and license information, see:
11
 * http://www.gnu.org/licenses/gpl-3.0.html
12
 */
13
14
namespace Romm\Formz\Condition\Parser;
15
16
use Romm\Formz\Condition\Node\NodeInterface;
17
use TYPO3\CMS\Core\SingletonInterface;
18
19
/**
20
 * @todo
21
 *
22
 */
23
class ConditionParserState implements SingletonInterface
24
{
25
    /**
26
     * @var array
27
     */
28
    private $currentExpression;
29
30
    /**
31
     * @var NodeInterface
32
     */
33
    private $currentNode;
34
35
    /**
36
     * @var NodeInterface
37
     */
38
    private $lastOrNode;
39
40
    /**
41
     * @var NodeInterface
42
     */
43
    private $currentLeftNode;
44
45
    /**
46
     * @var string
47
     */
48
    private $currentOperator;
49
50
    /**
51
     * @return array
52
     */
53
    public function getCurrentExpression()
54
    {
55
        return $this->currentExpression;
56
    }
57
58
    /**
59
     * @param array $currentExpression
60
     * @return $this
61
     */
62
    public function setCurrentExpression(array $currentExpression)
63
    {
64
        $this->currentExpression = $currentExpression;
65
66
        return $this;
67
    }
68
69
    /**
70
     * @return $this
71
     */
72
    public function shiftCurrentExpression()
73
    {
74
        array_shift($this->currentExpression);
75
76
        return $this;
77
    }
78
79
    /**
80
     * @return NodeInterface
81
     */
82
    public function getCurrentNode()
83
    {
84
        return $this->currentNode;
85
    }
86
87
    /**
88
     * @param NodeInterface $currentNode
89
     * @return $this
90
     */
91
    public function setCurrentNode(NodeInterface $currentNode)
92
    {
93
        $this->currentNode = $currentNode;
94
95
        return $this;
96
    }
97
98
    /**
99
     * @return $this
100
     */
101
    public function deleteCurrentNode()
102
    {
103
        $this->currentNode = null;
104
105
        return $this;
106
    }
107
108
    /**
109
     * @return NodeInterface
110
     */
111
    public function getLastOrNode()
112
    {
113
        return $this->lastOrNode;
114
    }
115
116
    /**
117
     * @param NodeInterface $lastOrNode
118
     * @return $this
119
     */
120
    public function setLastOrNode(NodeInterface $lastOrNode)
121
    {
122
        $this->lastOrNode = $lastOrNode;
123
124
        return $this;
125
    }
126
127
    /**
128
     * @return NodeInterface
129
     */
130
    public function getCurrentLeftNode()
131
    {
132
        return $this->currentLeftNode;
133
    }
134
135
    /**
136
     * @param NodeInterface $currentLeftNode
137
     * @return $this
138
     */
139
    public function setCurrentLeftNode(NodeInterface $currentLeftNode)
140
    {
141
        $this->currentLeftNode = $currentLeftNode;
142
143
        return $this;
144
    }
145
146
    /**
147
     * @return $this
148
     */
149
    public function deleteCurrentLeftNode()
150
    {
151
        $this->currentLeftNode = null;
152
153
        return $this;
154
    }
155
156
    /**
157
     * @return string
158
     */
159
    public function getCurrentOperator()
160
    {
161
        return $this->currentOperator;
162
    }
163
164
    /**
165
     * @param string $currentOperator
166
     * @return $this
167
     */
168
    public function setCurrentOperator($currentOperator)
169
    {
170
        $this->currentOperator = $currentOperator;
171
172
        return $this;
173
    }
174
175
    /**
176
     * @return $this
177
     */
178
    public function deleteCurrentOperator()
179
    {
180
        $this->currentOperator = null;
181
182
        return $this;
183
    }
184
}
185