1 | <?php |
||
25 | class FormObjectConfiguration |
||
26 | { |
||
27 | /** |
||
28 | * @var FormObjectStatic |
||
29 | */ |
||
30 | protected $static; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $configurationArray = []; |
||
36 | |||
37 | /** |
||
38 | * Contains the form configuration object, which was created from the |
||
39 | * configuration array. |
||
40 | * |
||
41 | * @var ConfigurationObjectInstance |
||
42 | */ |
||
43 | protected $configurationObject; |
||
44 | |||
45 | /** |
||
46 | * @var Result |
||
47 | */ |
||
48 | protected $configurationValidationResult; |
||
49 | |||
50 | /** |
||
51 | * Flag to know if the form configuration is valid or not: if the |
||
52 | * configuration is fetched from cache, then we know the configuration is |
||
53 | * valid because it is saved in cache only when no error is found. |
||
54 | * |
||
55 | * @var bool |
||
56 | */ |
||
57 | protected $configurationIsValid = false; |
||
58 | |||
59 | /** |
||
60 | * @param FormObjectStatic $static |
||
61 | * @param array $configurationArray |
||
62 | */ |
||
63 | public function __construct(FormObjectStatic $static, array $configurationArray) |
||
68 | |||
69 | /** |
||
70 | * Returns an instance of configuration object. Checks if it was previously |
||
71 | * stored in cache, otherwise it is created from scratch. |
||
72 | * |
||
73 | * @return ConfigurationObjectInstance |
||
74 | */ |
||
75 | public function getConfigurationObject() |
||
83 | |||
84 | /** |
||
85 | * This function will merge and return the validation results of both the |
||
86 | * global FormZ configuration object, and this form configuration object. |
||
87 | * |
||
88 | * @return Result |
||
89 | */ |
||
90 | public function getConfigurationValidationResult() |
||
98 | |||
99 | /** |
||
100 | * Resets the validation result and merges it with the global FormZ |
||
101 | * configuration. |
||
102 | * |
||
103 | * @return Result |
||
104 | */ |
||
105 | protected function getMergedValidationResult() |
||
125 | |||
126 | /** |
||
127 | * @return ConfigurationObjectInstance |
||
128 | */ |
||
129 | protected function getConfigurationObjectFromCache() |
||
149 | |||
150 | /** |
||
151 | * This function will clean the configuration array by removing useless data |
||
152 | * and updating needed ones. |
||
153 | * |
||
154 | * @param array $configuration |
||
155 | * @return array |
||
156 | */ |
||
157 | protected function sanitizeConfiguration(array $configuration) |
||
175 | |||
176 | /** |
||
177 | * @param array $configuration |
||
178 | * @return ConfigurationObjectInstance |
||
179 | */ |
||
180 | protected function getConfigurationObjectInstance(array $configuration) |
||
184 | |||
185 | /** |
||
186 | * @return FrontendInterface |
||
187 | */ |
||
188 | protected function getCacheInstance() |
||
192 | |||
193 | /** |
||
194 | * @return Result |
||
195 | */ |
||
196 | protected function getGlobalConfigurationValidationResult() |
||
200 | |||
201 | /** |
||
202 | * @return array |
||
203 | */ |
||
204 | public function __sleep() |
||
208 | } |
||
209 |