1 | <?php |
||
37 | class FormObjectFactory implements SingletonInterface |
||
38 | { |
||
39 | use ExtendedSelfInstantiateTrait; |
||
40 | |||
41 | /** |
||
42 | * @var FormObject[] |
||
43 | */ |
||
44 | protected $instances = []; |
||
45 | |||
46 | /** |
||
47 | * @var FormObjectStatic[] |
||
48 | */ |
||
49 | protected $static = []; |
||
50 | |||
51 | /** |
||
52 | * @var FormObjectProxy[] |
||
53 | */ |
||
54 | protected $proxy = []; |
||
55 | |||
56 | /** |
||
57 | * @var Configuration |
||
58 | */ |
||
59 | protected $globalConfiguration; |
||
60 | |||
61 | /** |
||
62 | * Will fetch FormZ global configuration. |
||
63 | */ |
||
64 | public function initializeObject() |
||
68 | |||
69 | /** |
||
70 | * @param FormInterface $form |
||
71 | * @param string $name |
||
72 | * @return FormObject |
||
73 | */ |
||
74 | public function getInstanceWithFormInstance(FormInterface $form, $name = 'defaultName') |
||
85 | |||
86 | /** |
||
87 | * Will create an instance of `FormObject` based on a class that implements |
||
88 | * the interface `FormInterface`. |
||
89 | * |
||
90 | * @param string $className |
||
91 | * @param string $name |
||
92 | * @return FormObject |
||
93 | */ |
||
94 | public function getInstanceWithClassName($className, $name) |
||
101 | |||
102 | /** |
||
103 | * Returns the proxy object for the given form object and form instance. |
||
104 | * |
||
105 | * Please use with caution, as this is a very low level function! |
||
106 | * |
||
107 | * @param FormInterface $form |
||
108 | * @return FormObjectProxy |
||
109 | */ |
||
110 | public function getProxy(FormInterface $form) |
||
120 | |||
121 | /** |
||
122 | * @param string $className |
||
123 | * @return FormObjectStatic |
||
124 | * @throws ClassNotFoundException |
||
125 | * @throws InvalidArgumentTypeException |
||
126 | */ |
||
127 | protected function getStaticInstance($className) |
||
158 | |||
159 | /** |
||
160 | * Adds the given form configuration to the global FormZ configuration |
||
161 | * object. |
||
162 | * |
||
163 | * @param FormObjectStatic $static |
||
164 | */ |
||
165 | public function addToGlobalConfiguration(FormObjectStatic $static) |
||
171 | |||
172 | /** |
||
173 | * @param string $className |
||
174 | * @return string |
||
175 | */ |
||
176 | protected function getCacheIdentifier($className) |
||
182 | |||
183 | /** |
||
184 | * Wrapper for unit tests. |
||
185 | * |
||
186 | * @param string $className |
||
187 | * @return FormObjectStatic |
||
188 | */ |
||
189 | protected function buildStaticInstance($className) |
||
196 | |||
197 | /** |
||
198 | * Wrapper for unit tests. |
||
199 | * |
||
200 | * @param FormInterface $form |
||
201 | * @return FormObjectProxy |
||
202 | */ |
||
203 | protected function getNewProxyInstance(FormInterface $form) |
||
210 | } |
||
211 |