1 | <?php |
||
27 | class ConditionProcessor |
||
28 | { |
||
29 | /** |
||
30 | * @var FormObject |
||
31 | */ |
||
32 | private $formObject; |
||
33 | |||
34 | /** |
||
35 | * @var ConditionTree[] |
||
36 | */ |
||
37 | private $fieldsTrees = []; |
||
38 | |||
39 | /** |
||
40 | * @var ConditionTree[] |
||
41 | */ |
||
42 | private $conditionTrees = []; |
||
43 | |||
44 | /** |
||
45 | * @var ConditionTree[] |
||
46 | */ |
||
47 | private $substepTree = []; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | private $javaScriptFiles = []; |
||
53 | |||
54 | /** |
||
55 | * @param FormObject $formObject |
||
56 | */ |
||
57 | public function __construct(FormObject $formObject) |
||
61 | |||
62 | /** |
||
63 | * Returns the condition tree for a given field instance, giving access to |
||
64 | * CSS, JavaScript and PHP transpiled results. |
||
65 | * |
||
66 | * @param Field $field |
||
67 | * @return ConditionTree |
||
68 | */ |
||
69 | public function getActivationConditionTreeForField(Field $field) |
||
85 | |||
86 | /** |
||
87 | * Returns the condition tree for a given validator instance, giving access |
||
88 | * to CSS, JavaScript and PHP transpiled results. |
||
89 | * |
||
90 | * @param Validator $validator |
||
91 | * @return ConditionTree |
||
92 | */ |
||
93 | public function getActivationConditionTreeForValidator(Validator $validator) |
||
109 | |||
110 | /** |
||
111 | * Returns the condition tree for a given validator instance, giving access |
||
112 | * to CSS, JavaScript and PHP transpiled results. |
||
113 | * |
||
114 | * @param ConditionalSubstepDefinition $substep |
||
115 | * @return ConditionTree |
||
116 | */ |
||
117 | public function getActivationConditionTreeForSubstep(ConditionalSubstepDefinition $substep) |
||
129 | |||
130 | /** |
||
131 | * Function that will calculate all trees from fields and their validators. |
||
132 | * |
||
133 | * This is useful to be able to store this instance in cache. |
||
134 | */ |
||
135 | public function calculateAllTrees() |
||
147 | |||
148 | /** |
||
149 | * @param ActivationInterface $activation |
||
150 | * @return ConditionTree |
||
151 | */ |
||
152 | protected function getConditionTree(ActivationInterface $activation) |
||
161 | |||
162 | /** |
||
163 | * @param ActivationInterface $activation |
||
164 | * @return ConditionTree |
||
165 | */ |
||
166 | protected function getNewConditionTreeFromActivation(ActivationInterface $activation) |
||
171 | |||
172 | /** |
||
173 | * @param NodeInterface $node |
||
174 | */ |
||
175 | protected function attachNodeJavaScriptFiles(NodeInterface $node) |
||
187 | |||
188 | /** |
||
189 | * @param FormObject $formObject |
||
190 | */ |
||
191 | public function attachFormObject(FormObject $formObject) |
||
195 | |||
196 | /** |
||
197 | * @return FormObject |
||
198 | */ |
||
199 | public function getFormObject() |
||
203 | |||
204 | /** |
||
205 | * @return array |
||
206 | */ |
||
207 | public function getJavaScriptFiles() |
||
211 | |||
212 | /** |
||
213 | * @return array |
||
214 | */ |
||
215 | public function __sleep() |
||
219 | } |
||
220 |