Wordless
Stop writing themes like it's 1998.
Public Member Functions | List of all members
NumberHelper Class Reference

This modules provides methods to translate numbers in specific formats, such as percentage, phone numbers, rounding, etc. More...

Public Member Functions

 number_to_currency ($number, $options=array())
 Translates number to currency. More...
 
 number_to_percentage ($number, $options=array())
 Translates numbers to percantage. More...
 
 number_to_phone ($number, $options=array())
 Translates numbers to phone numbers. More...
 
 number_with_delimiter ($number, $options=array())
 Formats numbers with given delimiter. More...
 
 number_with_precision ($number, $options=array())
 Rounds number to the given decimal precision. More...
 

Detailed Description

This modules provides methods to translate numbers in specific formats, such as percentage, phone numbers, rounding, etc.

Member Function Documentation

◆ number_to_percentage()

NumberHelper::number_to_percentage (   $number,
  $options = array() 
)

Translates numbers to percantage.

Parameters
integer$numberThe number to be converted in percentage
array$options(optional) Accepts the options expressed in the $DEFAULT_CURRENCY_VALUES property of NumberHelper, whom will be overwritten.

◆ number_to_phone()

NumberHelper::number_to_phone (   $number,
  $options = array() 
)

Translates numbers to phone numbers.

Parameters
integer$numberReturns a telephone number formatted number
array$options(optional) Associative array. Accepts keys: 'area_code', 'delimiter', 'extension', 'country_code'

◆ number_with_delimiter()

NumberHelper::number_with_delimiter (   $number,
  $options = array() 
)

Formats numbers with given delimiter.

Parameters
integer$numberThe number to be formatted
array$options(optional) Associative array. Accepts keys: 'delimiter', 'separator'

◆ number_with_precision()

NumberHelper::number_with_precision (   $number,
  $options = array() 
)

Rounds number to the given decimal precision.

Parameters
integer$numberThe number to be rounded
array$options(optional) Associative array. Accepts keys: 'precision', 'significant', 'strip_significant_zeros', 'separator'