1 | <?php |
||
23 | class FormObjectSteps |
||
24 | { |
||
25 | const METADATA_STEP_PERSISTENCE_KEY = 'core.formStepPersistence'; |
||
26 | |||
27 | /** |
||
28 | * @var FormObject |
||
29 | */ |
||
30 | protected $formObject; |
||
31 | |||
32 | /** |
||
33 | * Step persistence is saved in the form metadata. |
||
34 | * |
||
35 | * It allows having essential information about the form steps whenever it |
||
36 | * is needed: submitted form values, as well as steps that were already |
||
37 | * validated. |
||
38 | * |
||
39 | * @var FormStepPersistence |
||
40 | */ |
||
41 | protected $stepPersistence; |
||
42 | |||
43 | /** |
||
44 | * @var Step |
||
45 | */ |
||
46 | protected $currentStep; |
||
47 | |||
48 | /** |
||
49 | * @var SubstepDefinition |
||
50 | */ |
||
51 | protected $currentSubstepDefinition; |
||
52 | |||
53 | /** |
||
54 | * @var int |
||
55 | */ |
||
56 | protected $substepsLevel = 1; |
||
57 | |||
58 | /** |
||
59 | * @var bool |
||
60 | */ |
||
61 | protected $lastSubstepValidated = false; |
||
62 | |||
63 | /** |
||
64 | * @param FormObject $formObject |
||
65 | */ |
||
66 | public function __construct(FormObject $formObject) |
||
70 | |||
71 | /** |
||
72 | * This function will search among the registered steps to find the one that |
||
73 | * has the same controller parameters. |
||
74 | * |
||
75 | * It is also possible not to find any step, in this case `null` is |
||
76 | * returned. |
||
77 | * |
||
78 | * @todo: memoization with request spl object storage |
||
79 | * |
||
80 | * @param Request $request |
||
81 | */ |
||
82 | public function fetchCurrentStep(Request $request) |
||
123 | |||
124 | /** |
||
125 | * @param Step $step |
||
126 | */ |
||
127 | public function setCurrentStep(Step $step) |
||
131 | |||
132 | /** |
||
133 | * @return Step|null |
||
134 | */ |
||
135 | public function getCurrentStep() |
||
143 | |||
144 | /** |
||
145 | * Fetches the step persistence object for the form, which may have been |
||
146 | * stored in the form metadata. |
||
147 | * |
||
148 | * If the form object hash did change since the persistence object was saved |
||
149 | * it is "refreshed" with the new hash (some data are also deleted as they |
||
150 | * are no longer considered as valid). |
||
151 | * |
||
152 | * @return FormStepPersistence |
||
153 | */ |
||
154 | public function getStepPersistence() |
||
179 | |||
180 | /** |
||
181 | * @return SubstepDefinition |
||
182 | */ |
||
183 | public function getCurrentSubstepDefinition() |
||
187 | |||
188 | /** |
||
189 | * @param SubstepDefinition $currentSubstepDefinition |
||
190 | */ |
||
191 | public function setCurrentSubstepDefinition(SubstepDefinition $currentSubstepDefinition) |
||
195 | |||
196 | /** |
||
197 | * @param int $level |
||
198 | */ |
||
199 | public function setSubstepsLevel($level) |
||
203 | |||
204 | /** |
||
205 | * @return int |
||
206 | */ |
||
207 | public function getSubstepsLevel() |
||
211 | |||
212 | /** |
||
213 | * @todo |
||
214 | */ |
||
215 | public function markLastSubstepAsValidated() |
||
219 | |||
220 | /** |
||
221 | * @return bool |
||
222 | */ |
||
223 | public function lastSubstepWasValidated() |
||
227 | } |
||
228 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..