TableModel.php 883 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. // Copyright 2019 Hackware SpA <human@hackware.cl>
  3. // This file is part of "Hackware Web Services Wallet" and licensed under
  4. // the terms of the GNU Affero General Public License version 3, or (at your
  5. // option) a later version. You should have received a copy of this license
  6. // along with the software. If not, see <https://www.gnu.org/licenses/>.
  7. namespace Hawese\Wallet;
  8. use Hawese\Core\TableModel as BaseTableModel;
  9. /**
  10. * This class contains a helper for serialization of string decimal values.
  11. * @deprecated Next release will use MoneyPHP.
  12. */
  13. class TableModel extends BaseTableModel
  14. {
  15. public function jsonSerialize()
  16. {
  17. $attributes = parent::jsonSerialize();
  18. array_walk($attributes, function (&$field) {
  19. if (is_numeric($field)) {
  20. $field = $field + 0;
  21. }
  22. });
  23. return $attributes;
  24. }
  25. }