diff --git a/src/Formatters/PostFormatter.php b/src/Formatters/PostFormatter.php new file mode 100644 index 0000000..cf5c49f --- /dev/null +++ b/src/Formatters/PostFormatter.php @@ -0,0 +1,37 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Formatters; + +use InvalidArgumentException; +use Web3\Utils; +use Web3\Formatters\IFormatter; +use Web3\Formatters\QuantityFormatter; + +class PostFormatter implements IFormatter +{ + /** + * format + * + * @param mixed $value + * @return string + */ + public static function format($value) + { + if (isset($value['priority'])) { + $value['priority'] = QuantityFormatter::format($value['priority']); + } + if (isset($value['ttl'])) { + $value['ttl'] = QuantityFormatter::format($value['ttl']); + } + return $value; + } +} \ No newline at end of file