Documentation

Accounting extends Currency
in package

Table of Contents

Constants

LEADING_SYMBOL  = true
SYMBOL_WITH_SPACING  = true
SYMBOL_WITHOUT_SPACING  = false
TRAILING_SYMBOL  = false
WITH_THOUSANDS_SEPARATOR  = true
WITHOUT_THOUSANDS_SEPARATOR  = false
DEFAULT_STRIP_LEADING_RLM  = false
MAX_DECIMALS  = 30

Properties

$currencyCode  : string
$currencySymbolPosition  : bool
$currencySymbolSpacing  : bool
$decimals  : int
$fullLocale  : string|null
$locale  : string|null
$localeFormat  : string|null
$stripLeadingRLM  : bool
$thousandsSeparator  : bool

Methods

__construct()  : mixed
__toString()  : string
format()  : string
icuVersion()  : float
setCurrencyCode()  : void
setCurrencySymbolPosition()  : void
setCurrencySymbolSpacing()  : void
setDecimals()  : void
setLocale()  : void
Setting a locale will override any settings defined in this class.
setStripLeadingRLM()  : void
setThousandsSeparator()  : void
getLocaleFormat()  : string
As MS Excel cannot easily handle Lakh, which is the only locale-specific Number format variant, we don't use locale with Numbers.
formatCurrencyCode()  : string
validateLocale()  : string

Constants

LEADING_SYMBOL

public mixed LEADING_SYMBOL = true

SYMBOL_WITH_SPACING

public mixed SYMBOL_WITH_SPACING = true

SYMBOL_WITHOUT_SPACING

public mixed SYMBOL_WITHOUT_SPACING = false

TRAILING_SYMBOL

public mixed TRAILING_SYMBOL = false

WITH_THOUSANDS_SEPARATOR

public mixed WITH_THOUSANDS_SEPARATOR = true

WITHOUT_THOUSANDS_SEPARATOR

public mixed WITHOUT_THOUSANDS_SEPARATOR = false

DEFAULT_STRIP_LEADING_RLM

protected mixed DEFAULT_STRIP_LEADING_RLM = false

Properties

$currencyCode

protected string $currencyCode = '$'

$currencySymbolPosition

protected bool $currencySymbolPosition = self::LEADING_SYMBOL

$currencySymbolSpacing

protected bool $currencySymbolSpacing = self::SYMBOL_WITHOUT_SPACING

$fullLocale

protected string|null $fullLocale = null

$localeFormat

protected string|null $localeFormat = null

$stripLeadingRLM

protected bool $stripLeadingRLM = self::DEFAULT_STRIP_LEADING_RLM

$thousandsSeparator

protected bool $thousandsSeparator = true

Methods

__construct()

public __construct([string $currencyCode = '$' ][, int $decimals = 2 ][, bool $thousandsSeparator = true ][, bool $currencySymbolPosition = self::LEADING_SYMBOL ][, bool $currencySymbolSpacing = self::SYMBOL_WITHOUT_SPACING ][, string|null $locale = null ][, bool $stripLeadingRLM = self::DEFAULT_STRIP_LEADING_RLM ]) : mixed
Parameters
$currencyCode : string = '$'

the currency symbol or code to display for this mask

$decimals : int = 2

number of decimal places to display, in the range 0-30

$thousandsSeparator : bool = true

indicator whether the thousands separator should be used, or not

$currencySymbolPosition : bool = self::LEADING_SYMBOL

indicates whether the currency symbol comes before or after the value Possible values are Currency::LEADING_SYMBOL and Currency::TRAILING_SYMBOL

$currencySymbolSpacing : bool = self::SYMBOL_WITHOUT_SPACING

indicates whether there is spacing between the currency symbol and the value Possible values are Currency::SYMBOL_WITH_SPACING and Currency::SYMBOL_WITHOUT_SPACING

$locale : string|null = null

Set the locale for the currency format; or leave as the default null. If provided, Locale values must be a valid formatted locale string (e.g. 'en-GB', 'fr', uz-Arab-AF). Note that setting a locale will override any other settings defined in this class other than the currency code; or decimals (unless the decimals value is set to 0).

$stripLeadingRLM : bool = self::DEFAULT_STRIP_LEADING_RLM

remove leading RLM added with ICU 72.1+.

Tags
throws
Exception

If a provided locale code is not a valid format

__toString()

public __toString() : string
Return values
string

format()

public format() : string
Return values
string

icuVersion()

public static icuVersion() : float
Return values
float

setCurrencyCode()

public setCurrencyCode(string $currencyCode) : void
Parameters
$currencyCode : string

setCurrencySymbolPosition()

public setCurrencySymbolPosition([bool $currencySymbolPosition = self::LEADING_SYMBOL ]) : void
Parameters
$currencySymbolPosition : bool = self::LEADING_SYMBOL

setCurrencySymbolSpacing()

public setCurrencySymbolSpacing([bool $currencySymbolSpacing = self::SYMBOL_WITHOUT_SPACING ]) : void
Parameters
$currencySymbolSpacing : bool = self::SYMBOL_WITHOUT_SPACING

setDecimals()

public setDecimals([int $decimals = 2 ]) : void
Parameters
$decimals : int = 2

setLocale()

Setting a locale will override any settings defined in this class.

public setLocale([string|null $locale = null ]) : void
Parameters
$locale : string|null = null
Tags
throws
Exception

If the locale code is not a valid format

setStripLeadingRLM()

public setStripLeadingRLM(bool $stripLeadingRLM) : void
Parameters
$stripLeadingRLM : bool

setThousandsSeparator()

public setThousandsSeparator([bool $thousandsSeparator = self::WITH_THOUSANDS_SEPARATOR ]) : void
Parameters
$thousandsSeparator : bool = self::WITH_THOUSANDS_SEPARATOR

getLocaleFormat()

As MS Excel cannot easily handle Lakh, which is the only locale-specific Number format variant, we don't use locale with Numbers.

protected getLocaleFormat() : string
Tags
throws
Exception

if the Intl extension and ICU version don't support Accounting formats

Return values
string

formatCurrencyCode()

private formatCurrencyCode() : string
Return values
string

validateLocale()

private validateLocale(string $locale) : string
Parameters
$locale : string
Tags
throws
Exception

If the locale code is not a valid format

Return values
string

        
On this page

Search results