1 | <?php |
||
20 | class MoneyField extends FormField { |
||
21 | |||
22 | protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_TEXT; |
||
23 | |||
24 | /** |
||
25 | * @var string $_locale |
||
26 | */ |
||
27 | protected $_locale; |
||
28 | |||
29 | /** |
||
30 | * Limit the currencies |
||
31 | * @var array $allowedCurrencies |
||
32 | */ |
||
33 | protected $allowedCurrencies; |
||
34 | |||
35 | /** |
||
36 | * @var NumericField |
||
37 | */ |
||
38 | protected $fieldAmount = null; |
||
39 | |||
40 | /** |
||
41 | * @var FormField |
||
42 | */ |
||
43 | protected $fieldCurrency = null; |
||
44 | |||
45 | /** |
||
46 | * Gets field for the currency selector |
||
47 | * |
||
48 | * @return FormField |
||
49 | */ |
||
50 | public function getCurrencyField() { |
||
53 | |||
54 | /** |
||
55 | * Gets field for the amount input |
||
56 | * |
||
57 | * @return NumericField |
||
58 | */ |
||
59 | public function getAmountField() { |
||
62 | |||
63 | public function __construct($name, $title = null, $value = "") { |
||
72 | |||
73 | public function __clone() |
||
78 | |||
79 | /** |
||
80 | * Builds a new currency field based on the allowed currencies configured |
||
81 | * |
||
82 | * @return FormField |
||
83 | */ |
||
84 | protected function buildCurrencyField() { |
||
106 | |||
107 | public function setValue($val) { |
||
125 | |||
126 | /** |
||
127 | * 30/06/2009 - Enhancement: |
||
128 | * SaveInto checks if set-methods are available and use them |
||
129 | * instead of setting the values in the money class directly. saveInto |
||
130 | * initiates a new Money class object to pass through the values to the setter |
||
131 | * method. |
||
132 | * |
||
133 | * (see @link MoneyFieldTest_CustomSetter_Object for more information) |
||
134 | * |
||
135 | * @param DataObjectInterface|Object $dataObject |
||
136 | */ |
||
137 | public function saveInto(DataObjectInterface $dataObject) { |
||
152 | |||
153 | /** |
||
154 | * Returns a readonly version of this field. |
||
155 | */ |
||
156 | public function performReadonlyTransformation() { |
||
163 | |||
164 | public function setReadonly($bool) { |
||
172 | |||
173 | public function setDisabled($bool) { |
||
181 | |||
182 | /** |
||
183 | * @param array $arr |
||
184 | * @return $this |
||
185 | */ |
||
186 | public function setAllowedCurrencies($arr) { |
||
196 | |||
197 | /** |
||
198 | * @return array |
||
199 | */ |
||
200 | public function getAllowedCurrencies() { |
||
203 | |||
204 | public function setLocale($locale) { |
||
208 | |||
209 | public function getLocale() { |
||
212 | |||
213 | /** |
||
214 | * Validate this field |
||
215 | * |
||
216 | * @param Validator $validator |
||
217 | * @return bool |
||
218 | */ |
||
219 | public function validate($validator) { |
||
222 | |||
223 | public function setForm($form) { |
||
228 | } |
||
229 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.