ConditionParserScope   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 162
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 0

Importance

Changes 0
Metric Value
wmc 14
lcom 4
cbo 0
dl 0
loc 162
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getExpression() 0 4 1
A setExpression() 0 6 1
A shiftExpression() 0 6 1
A getNode() 0 4 1
A setNode() 0 6 1
A deleteNode() 0 6 1
A getLastOrNode() 0 4 1
A setLastOrNode() 0 6 1
A getCurrentLeftNode() 0 4 1
A setCurrentLeftNode() 0 6 1
A deleteCurrentLeftNode() 0 6 1
A getCurrentOperator() 0 4 1
A setCurrentOperator() 0 6 1
A deleteCurrentOperator() 0 6 1
1
<?php
2
/*
3
 * 2017 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\Parser\Node\NodeInterface;
17
use TYPO3\CMS\Core\SingletonInterface;
18
19
/**
20
 * Contains several information of an expression scope for the condition parser.
21
 */
22
class ConditionParserScope implements SingletonInterface
23
{
24
    /**
25
     * @var array
26
     */
27
    private $expression;
28
29
    /**
30
     * @var NodeInterface
31
     */
32
    private $node;
33
34
    /**
35
     * @var NodeInterface
36
     */
37
    private $lastOrNode;
38
39
    /**
40
     * @var NodeInterface
41
     */
42
    private $currentLeftNode;
43
44
    /**
45
     * @var string
46
     */
47
    private $currentOperator;
48
49
    /**
50
     * @return array
51
     */
52
    public function getExpression()
53
    {
54
        return $this->expression;
55
    }
56
57
    /**
58
     * @param array $expression
59
     * @return $this
60
     */
61
    public function setExpression(array $expression)
62
    {
63
        $this->expression = $expression;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return $this
70
     */
71
    public function shiftExpression()
72
    {
73
        array_shift($this->expression);
74
75
        return $this;
76
    }
77
78
    /**
79
     * @return NodeInterface
80
     */
81
    public function getNode()
82
    {
83
        return $this->node;
84
    }
85
86
    /**
87
     * @param NodeInterface $node
88
     * @return $this
89
     */
90
    public function setNode(NodeInterface $node)
91
    {
92
        $this->node = $node;
93
94
        return $this;
95
    }
96
97
    /**
98
     * @return $this
99
     */
100
    public function deleteNode()
101
    {
102
        $this->node = null;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return NodeInterface
109
     */
110
    public function getLastOrNode()
111
    {
112
        return $this->lastOrNode;
113
    }
114
115
    /**
116
     * @param NodeInterface $lastOrNode
117
     * @return $this
118
     */
119
    public function setLastOrNode(NodeInterface $lastOrNode)
120
    {
121
        $this->lastOrNode = $lastOrNode;
122
123
        return $this;
124
    }
125
126
    /**
127
     * @return NodeInterface
128
     */
129
    public function getCurrentLeftNode()
130
    {
131
        return $this->currentLeftNode;
132
    }
133
134
    /**
135
     * @param NodeInterface $currentLeftNode
136
     * @return $this
137
     */
138
    public function setCurrentLeftNode(NodeInterface $currentLeftNode)
139
    {
140
        $this->currentLeftNode = $currentLeftNode;
141
142
        return $this;
143
    }
144
145
    /**
146
     * @return $this
147
     */
148
    public function deleteCurrentLeftNode()
149
    {
150
        $this->currentLeftNode = null;
151
152
        return $this;
153
    }
154
155
    /**
156
     * @return string
157
     */
158
    public function getCurrentOperator()
159
    {
160
        return $this->currentOperator;
161
    }
162
163
    /**
164
     * @param string $currentOperator
165
     * @return $this
166
     */
167
    public function setCurrentOperator($currentOperator)
168
    {
169
        $this->currentOperator = $currentOperator;
170
171
        return $this;
172
    }
173
174
    /**
175
     * @return $this
176
     */
177
    public function deleteCurrentOperator()
178
    {
179
        $this->currentOperator = null;
180
181
        return $this;
182
    }
183
}
184