PHP Class PayPal\Converter\FormatConverter

Show file Open project: paypal/rest-api-sdk-php Class Usage Examples

Public Methods

Method Description
format ( $value, $formatter ) : string Format the data based on the input formatter value
formatToNumber ( $value, integer $decimals = 2 ) : null | string Format the input data with decimal places
formatToPrice ( $value, null $currency = null ) : null | string Helper method to format price values with associated currency information.

Method Details

format() public static method

Format the data based on the input formatter value
public static format ( $value, $formatter ) : string
$value
$formatter
return string

formatToNumber() public static method

Defaults to 2 decimal places
public static formatToNumber ( $value, integer $decimals = 2 ) : null | string
$value
$decimals integer
return null | string

formatToPrice() public static method

It covers the cases where certain currencies does not accept decimal values. We will be adding any specific currency level rules as required here.
public static formatToPrice ( $value, null $currency = null ) : null | string
$value
$currency null
return null | string