20
20
*/
21
21
class FormOrderer
22
22
{
23
- /**
24
- * @var array
25
- */
26
23
private $ weights ;
27
-
28
- /**
29
- * @var array
30
- */
31
24
private $ deferred ;
32
-
33
- /**
34
- * @var int
35
- */
36
25
private $ firstWeight ;
37
-
38
- /**
39
- * @var int
40
- */
41
26
private $ currentWeight ;
42
-
43
- /**
44
- * @var int
45
- */
46
27
private $ lastWeight ;
47
28
48
29
/**
49
30
* Orders the form.
50
31
*
51
- * @param FormInterface $form The form.
32
+ * @param FormInterface $form
52
33
*
53
- * @return array The ordered form child names.
34
+ * @return array The ordered form child names
54
35
*
55
- * @throws \Symfony\Component\Form\Exception\ InvalidConfigurationException If a position is not valid.
36
+ * @throws InvalidConfigurationException If a position is not valid
56
37
*/
57
38
public function order (FormInterface $ form )
58
39
{
@@ -76,9 +57,9 @@ public function order(FormInterface $form)
76
57
}
77
58
78
59
/**
79
- * Process the form using the current weight in order to maintain the default order.
60
+ * Process the form using the current weight in order to maintain the default order
80
61
*
81
- * @param FormInterface $form The form.
62
+ * @param FormInterface $form
82
63
*/
83
64
private function processEmptyPosition (FormInterface $ form )
84
65
{
@@ -87,10 +68,10 @@ private function processEmptyPosition(FormInterface $form)
87
68
88
69
/**
89
70
* Process the form using the current first/last weight in order to put your form at the
90
- * first/last position according to the default order.
71
+ * first/last position according to the default order
91
72
*
92
- * @param FormInterface $form The form.
93
- * @param string $position The position.
73
+ * @param FormInterface $form
74
+ * @param string $position
94
75
*/
95
76
private function processStringPosition (FormInterface $ form , $ position )
96
77
{
@@ -102,12 +83,11 @@ private function processStringPosition(FormInterface $form, $position)
102
83
}
103
84
104
85
/**
105
- * Processes an array position (before/after).
106
- *
107
- * FIXME
86
+ * Process the form using the weight of the "before" or "after" form
87
+ * If the "before" or "after" form has not been processed yet, we defer it for the next forms
108
88
*
109
- * @param FormInterface $form The form.
110
- * @param array $position The position.
89
+ * @param FormInterface $form
90
+ * @param array $position
111
91
*/
112
92
private function processArrayPosition (FormInterface $ form , array $ position )
113
93
{
@@ -122,9 +102,9 @@ private function processArrayPosition(FormInterface $form, array $position)
122
102
123
103
/**
124
104
* Process the form using the current first weight in order to put
125
- * your form at the first position according to the default order.
105
+ * your form at the first position according to the default order
126
106
*
127
- * @param FormInterface $form The form.
107
+ * @param FormInterface $form
128
108
*/
129
109
private function processFirst (FormInterface $ form )
130
110
{
@@ -133,21 +113,21 @@ private function processFirst(FormInterface $form)
133
113
134
114
/**
135
115
* Processes the form using the current last weight in order to put
136
- * your form at the last position according to the default order.
116
+ * your form at the last position according to the default order
137
117
*
138
- * @param FormInterface $form The form.
118
+ * @param FormInterface $form
139
119
*/
140
120
private function processLast (FormInterface $ form )
141
121
{
142
122
$ this ->processWeight ($ form , $ this ->lastWeight + 1 );
143
123
}
144
124
145
125
/**
146
- * Process the form using the weight of the "before" form.
147
- * If the "before" form has not been processed yet, we defer it for the next forms.
126
+ * Process the form using the weight of the "before" form
127
+ * If the "before" form has not been processed yet, we defer it for the next forms
148
128
*
149
- * @param FormInterface $form The form.
150
- * @param string $before The before form name.
129
+ * @param FormInterface $form
130
+ * @param string $before
151
131
*/
152
132
private function processBefore (FormInterface $ form , $ before )
153
133
{
@@ -159,11 +139,11 @@ private function processBefore(FormInterface $form, $before)
159
139
}
160
140
161
141
/**
162
- * Process the form using the weight of the "after" form.
163
- * If the "after" form has not been processed yet, we defer it for the next forms.
142
+ * Process the form using the weight of the "after" form
143
+ * If the "after" form has not been processed yet, we defer it for the next forms
164
144
*
165
- * @param FormInterface $form The form.
166
- * @param string $after The after form name.
145
+ * @param FormInterface $form
146
+ * @param string $after
167
147
*/
168
148
private function processAfter (FormInterface $ form , $ after )
169
149
{
@@ -175,12 +155,12 @@ private function processAfter(FormInterface $form, $after)
175
155
}
176
156
177
157
/**
178
- * Process the form using the given weight.
158
+ * Process the form using the given weight
179
159
*
180
- * This method also updates the orderer state accordingly.
160
+ * This method also updates the orderer state accordingly
181
161
*
182
- * @param FormInterface $form The form.
183
- * @param int $weight The weight.
162
+ * @param FormInterface $form
163
+ * @param int $weight
184
164
*/
185
165
private function processWeight (FormInterface $ form , $ weight )
186
166
{
@@ -202,13 +182,13 @@ private function processWeight(FormInterface $form, $weight)
202
182
203
183
/**
204
184
* Finishes the form weight processing by trying to process deferred forms
205
- * which refers to the current processed form.
185
+ * which refers to the current processed form
206
186
*
207
- * @param FormInterface $form The form.
208
- * @param int $weight The weight.
209
- * @param string $position The position (null|before|after).
187
+ * @param FormInterface $form
188
+ * @param int $weight
189
+ * @param string $position
210
190
*
211
- * @return int The new weight.
191
+ * @return int The new weight
212
192
*/
213
193
private function finishWeight (FormInterface $ form , $ weight , $ position = null )
214
194
{
@@ -235,13 +215,13 @@ private function finishWeight(FormInterface $form, $weight, $position = null)
235
215
236
216
/**
237
217
* Processes a deferred form by checking if it is valid and
238
- * if it does not become a circular or symmetric ordering.
218
+ * if it does not become a circular or symmetric ordering
239
219
*
240
- * @param FormInterface $form The form.
241
- * @param string $deferred The deferred form name.
242
- * @param string $position The position (before|after).
220
+ * @param FormInterface $form
221
+ * @param string $deferred
222
+ * @param string $position
243
223
*
244
- * @throws InvalidConfigurationException If the deferred form does not exist.
224
+ * @throws InvalidConfigurationException If the deferred form does not exist
245
225
*/
246
226
private function processDeferred (FormInterface $ form , $ deferred , $ position )
247
227
{
@@ -258,13 +238,13 @@ private function processDeferred(FormInterface $form, $deferred, $position)
258
238
}
259
239
260
240
/**
261
- * Detects circular deferred forms for after/before position such as A => B => C => A.
241
+ * Detects circular deferred forms for after/before position such as A => B => C => A
262
242
*
263
- * @param string $name The form name.
264
- * @param string $position The position (before|after)
265
- * @param array $stack The circular stack.
243
+ * @param string $name
244
+ * @param string $position
245
+ * @param array $stack
266
246
*
267
- * @throws InvalidConfigurationException If there is a circular before/after deferred.
247
+ * @throws InvalidConfigurationException If there is a circular before/after deferred
268
248
*/
269
249
private function detectCircularDeferred ($ name , $ position , array $ stack = array ())
270
250
{
@@ -288,13 +268,13 @@ private function detectCircularDeferred($name, $position, array $stack = array()
288
268
}
289
269
290
270
/**
291
- * Detects symmetric before/after deferred such as A after B and B after A.
271
+ * Detects symmetric before/after deferred such as A after B and B after A
292
272
*
293
- * @param string $name The form name.
294
- * @param string $deferred The deferred form name.
295
- * @param string $position The position (before|after).
273
+ * @param string $name
274
+ * @param string $deferred
275
+ * @param string $position
296
276
*
297
- * @throws InvalidConfigurationException If there is a symetric before/after deferred.
277
+ * @throws InvalidConfigurationException If there is a symetric before/after deferred
298
278
*/
299
279
private function detectedSymmetricDeferred ($ name , $ deferred , $ position )
300
280
{
@@ -310,7 +290,7 @@ private function detectedSymmetricDeferred($name, $deferred, $position)
310
290
}
311
291
312
292
/**
313
- * Resets the orderer.
293
+ * Resets the orderer
314
294
*/
315
295
private function reset ()
316
296
{
0 commit comments