Currency
in package
Currency class.
Table of Contents
- addCurrency() : int|null
- Add the currency by code.
- clearCache() : void
- Function clears cache.
- formatToDb() : float
- Function to get value for db format.
- formatToDisplay() : string
- Function returns the currency in user specified format.
- getAll() : array<string|int, mixed>
- Get all currencies.
- getById() : array<string|int, mixed>
- Get currency by id.
- getCurrencyByModule() : int
- Get currency by module name.
- getCurrencyIdByName() : type
- Get currency id by name.
- getDefault() : array<string|int, mixed>|bool
- Get current default currency data.
- getIdByCode() : int|null
- Get currency by code.
- getSupported() : array<string|int, mixed>
- Get supported currencies.
Methods
addCurrency()
Add the currency by code.
public
static addCurrency(string $code) : int|null
Parameters
- $code : string
Return values
int|null —clearCache()
Function clears cache.
public
static clearCache() : void
Return values
void —formatToDb()
Function to get value for db format.
public
static formatToDb(string $value) : float
Parameters
- $value : string
Return values
float —formatToDisplay()
Function returns the currency in user specified format.
public
static formatToDisplay(string $value[, mixed|null $user = null ][, mixed $skipConversion = false ][, mixed $skipFormatting = false ]) : string
Parameters
- $value : string
-
Date time
- $user : mixed|null = null
- $skipConversion : mixed = false
- $skipFormatting : mixed = false
Return values
string —getAll()
Get all currencies.
public
static getAll([bool $onlyActive = false ]) : array<string|int, mixed>
Parameters
- $onlyActive : bool = false
Return values
array<string|int, mixed> —getById()
Get currency by id.
public
static getById(int $currencyId) : array<string|int, mixed>
Parameters
- $currencyId : int
Return values
array<string|int, mixed> —getCurrencyByModule()
Get currency by module name.
public
static getCurrencyByModule(int $record, string $moduleName) : int
Parameters
- $record : int
- $moduleName : string
Return values
int —getCurrencyIdByName()
Get currency id by name.
public
static getCurrencyIdByName(type $currencyName) : type
Parameters
- $currencyName : type
Return values
type —getDefault()
Get current default currency data.
public
static getDefault() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool —getIdByCode()
Get currency by code.
public
static getIdByCode(string $code[, bool $active = true ]) : int|null
Parameters
- $code : string
- $active : bool = true
Return values
int|null —getSupported()
Get supported currencies.
public
static getSupported() : array<string|int, mixed>