BigNumberFormatter.php 614 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * This file is part of web3.php package.
  4. *
  5. * (c) Kuan-Cheng,Lai <alk03073135@gmail.com>
  6. *
  7. * @author Peter Lai <alk03073135@gmail.com>
  8. * @license MIT
  9. */
  10. namespace blockchain\web3\src\Formatters;
  11. use InvalidArgumentException;
  12. use blockchain\web3\src\Utils;
  13. use blockchain\web3\src\Formatters\IFormatter;
  14. class BigNumberFormatter implements IFormatter
  15. {
  16. /**
  17. * format
  18. *
  19. * @param mixed $value
  20. * @return string
  21. */
  22. public static function format($value)
  23. {
  24. $value = Utils::toString($value);
  25. $bn = Utils::toBn($value);
  26. return $bn;
  27. }
  28. }