This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/lib/PayPal/Common/FormatConverter.php
2014-11-18 16:50:57 -06:00

33 lines
630 B
PHP

<?php
namespace PayPal\Common;
class FormatConverter {
/**
* Format the data based on the input formatter value
*
* @param $value
* @param $formatter
* @return string
*/
public static function format($value, $formatter)
{
return sprintf($formatter, $value);
}
/**
* Format the input data to two decimal places
*
* @param $value
* @return string
*/
public static function formatToTwoDecimalPlaces($value)
{
if (trim($value) != null) {
return number_format($value, 2, '.', '');
}
return null;
}
}