Post formatter.
This commit is contained in:
parent
8055ec04ba
commit
9f4614781e
37
src/Formatters/PostFormatter.php
Normal file
37
src/Formatters/PostFormatter.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of web3.php package.
|
||||
*
|
||||
* (c) Kuan-Cheng,Lai <alk03073135@gmail.com>
|
||||
*
|
||||
* @author Peter Lai <alk03073135@gmail.com>
|
||||
* @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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user