1 | <?php |
||
21 | class FormObjectHash |
||
22 | { |
||
23 | /** |
||
24 | * @var FormObject |
||
25 | */ |
||
26 | protected $formObject; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $hash; |
||
32 | |||
33 | /** |
||
34 | * @var FormIdentifierObject |
||
35 | */ |
||
36 | protected $identifierObject; |
||
37 | |||
38 | /** |
||
39 | * @param FormObject $formObject |
||
40 | */ |
||
41 | public function __construct(FormObject $formObject) |
||
46 | |||
47 | /** |
||
48 | * Returns the hash of the form object, which should be calculated only once |
||
49 | * for performance concerns. |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | public function getHash() |
||
61 | |||
62 | /** |
||
63 | * Resets the hash, which will be calculated on next access. |
||
64 | */ |
||
65 | public function resetHash() |
||
69 | |||
70 | /** |
||
71 | * @see \Romm\Formz\Form\FormObject::getFormIdentifierHash() |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getFormIdentifierHash() |
||
79 | |||
80 | /** |
||
81 | * @see \Romm\Formz\Form\FormObject::getFormIdentifierObject() |
||
82 | * |
||
83 | * @param string $identifier |
||
84 | * @return FormIdentifierObject |
||
85 | */ |
||
86 | public function getFormIdentifierObject($identifier) |
||
92 | |||
93 | /** |
||
94 | * Returns the calculated hash of the form object. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | protected function calculateHash() |
||
102 | |||
103 | /** |
||
104 | * Injects external dependencies. |
||
105 | */ |
||
106 | public function __wakeup() |
||
110 | |||
111 | /** |
||
112 | * @return array |
||
113 | */ |
||
114 | public function __sleep() |
||
121 | } |
||
122 |