1 | <?php |
||
44 | class FormObjectFactory implements SingletonInterface |
||
45 | { |
||
46 | use ExtendedSelfInstantiateTrait; |
||
47 | |||
48 | /** |
||
49 | * @var FormObject[] |
||
50 | */ |
||
51 | protected $instances = []; |
||
52 | |||
53 | /** |
||
54 | * @var FormObjectStatic[] |
||
55 | */ |
||
56 | protected $static = []; |
||
57 | |||
58 | /** |
||
59 | * @var FormObjectProxy[] |
||
60 | */ |
||
61 | protected $proxy = []; |
||
62 | |||
63 | /** |
||
64 | * @var FormObjectSteps[] |
||
65 | */ |
||
66 | protected $stepService = []; |
||
67 | |||
68 | /** |
||
69 | * Returns the form object for the given form instance. The form instance |
||
70 | * must have been defined first in this factory, or an exception is thrown. |
||
71 | * |
||
72 | * @param FormInterface $form |
||
73 | * @return FormObject |
||
74 | * @throws EntryNotFoundException |
||
75 | */ |
||
76 | public function getInstanceWithFormInstance(FormInterface $form) |
||
84 | |||
85 | /** |
||
86 | * Checks that the given form instance was registered in this factory. |
||
87 | * |
||
88 | * @param FormInterface $form |
||
89 | * @return bool |
||
90 | */ |
||
91 | public function formInstanceWasRegistered(FormInterface $form) |
||
95 | |||
96 | /** |
||
97 | * Registers a new form instance. |
||
98 | * |
||
99 | * @param FormInterface $form |
||
100 | * @param string $name |
||
101 | * @throws DuplicateEntryException |
||
102 | * @throws InvalidArgumentValueException |
||
103 | */ |
||
104 | public function registerFormInstance(FormInterface $form, $name) |
||
118 | |||
119 | /** |
||
120 | * A shortcut function to register the given form instance (if it was not |
||
121 | * already registered) and return the form object. |
||
122 | * |
||
123 | * @param FormInterface $form |
||
124 | * @param string $name |
||
125 | * @return FormObject |
||
126 | */ |
||
127 | public function registerAndGetFormInstance(FormInterface $form, $name) |
||
135 | |||
136 | /** |
||
137 | * Will create an instance of `FormObject` based on a class that implements |
||
138 | * the interface `FormInterface`. |
||
139 | * |
||
140 | * @param string $className |
||
141 | * @param string $name |
||
142 | * @return FormObject |
||
143 | */ |
||
144 | public function getInstanceWithClassName($className, $name) |
||
151 | |||
152 | /** |
||
153 | * Returns the proxy object for the given form object and form instance. |
||
154 | * |
||
155 | * Please use with caution, as this is a very low level function! |
||
156 | * |
||
157 | * @param FormInterface $form |
||
158 | * @return FormObjectProxy |
||
159 | */ |
||
160 | public function getProxy(FormInterface $form) |
||
170 | |||
171 | /** |
||
172 | * @todo |
||
173 | * |
||
174 | * @param FormObject $formObject |
||
175 | * @return FormObjectSteps |
||
176 | */ |
||
177 | public function getStepService(FormObject $formObject) |
||
187 | |||
188 | /** |
||
189 | * @return FormObject[] |
||
190 | */ |
||
191 | public function all() |
||
195 | |||
196 | /** |
||
197 | * @param string $className |
||
198 | * @return FormObjectStatic |
||
199 | * @throws ClassNotFoundException |
||
200 | * @throws InvalidArgumentTypeException |
||
201 | */ |
||
202 | protected function getStaticInstance($className) |
||
238 | |||
239 | /** |
||
240 | * @param string $className |
||
241 | * @return string |
||
242 | */ |
||
243 | protected function getCacheIdentifier($className) |
||
250 | |||
251 | /** |
||
252 | * Wrapper for unit tests. |
||
253 | * |
||
254 | * @param string $className |
||
255 | * @return FormObjectStatic |
||
256 | */ |
||
257 | protected function buildStaticInstance($className) |
||
264 | |||
265 | /** |
||
266 | * Wrapper for unit tests. |
||
267 | * |
||
268 | * @param FormInterface $form |
||
269 | * @return FormObjectProxy |
||
270 | */ |
||
271 | protected function getNewProxyInstance(FormInterface $form) |
||
280 | |||
281 | /** |
||
282 | * @return Configuration|ConfigurationObjectInterface |
||
283 | */ |
||
284 | protected function getRootConfiguration() |
||
288 | |||
289 | /** |
||
290 | * @return FrontendInterface |
||
291 | */ |
||
292 | protected function getCacheInstance() |
||
296 | } |
||
297 |