Accounting
extends CurrencyBase
in package
Table of Contents
Constants
- DEFAULT_NEGATIVE = \PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\CurrencyNegative::minus
- 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
- $negative : CurrencyNegative
- $overrideNegative : CurrencyNegative|null
- $overrideSpacing : bool|null
- $stripLeadingRLM : bool
- $thousandsSeparator : bool
- $spaceOrNbsp : string
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.
- setNegative() : void
- 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
DEFAULT_NEGATIVE
public
mixed
DEFAULT_NEGATIVE
= \PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\CurrencyNegative::minus
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
MAX_DECIMALS
protected
mixed
MAX_DECIMALS
= 30
Properties
$currencyCode
protected
string
$currencyCode
= '$'
$currencySymbolPosition
protected
bool
$currencySymbolPosition
= self::LEADING_SYMBOL
$currencySymbolSpacing
protected
bool
$currencySymbolSpacing
= self::SYMBOL_WITHOUT_SPACING
$decimals
protected
int
$decimals
= 2
$fullLocale
protected
string|null
$fullLocale
= null
$locale
protected
string|null
$locale
= null
$localeFormat
protected
string|null
$localeFormat
= null
$negative
protected
CurrencyNegative
$negative
= \PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\CurrencyNegative::minus
$overrideNegative
protected
CurrencyNegative|null
$overrideNegative
= \PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\CurrencyNegative::parentheses
$overrideSpacing
protected
bool|null
$overrideSpacing
= true
$stripLeadingRLM
protected
bool
$stripLeadingRLM
= self::DEFAULT_STRIP_LEADING_RLM
$thousandsSeparator
protected
bool
$thousandsSeparator
= true
$spaceOrNbsp
private
string
$spaceOrNbsp
= ' '
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 ][, CurrencyNegative $negative = CurrencyNegative::minus ]) : 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 However, Currency always uses WITHOUT and Accounting always uses WITH
- $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+.
- $negative : CurrencyNegative = CurrencyNegative::minus
-
How to display negative numbers. Always use parentheses for Accounting. 4 options for Currency.
Tags
__toString()
public
__toString() : string
Return values
stringformat()
public
format() : string
Return values
stringicuVersion()
public
static icuVersion() : float
Return values
floatsetCurrencyCode()
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
setNegative()
public
setNegative(CurrencyNegative $negative) : void
Parameters
- $negative : CurrencyNegative
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
Return values
stringformatCurrencyCode()
private
formatCurrencyCode() : string
Return values
stringvalidateLocale()
private
validateLocale(string $locale) : string
Parameters
- $locale : string