class AlligatorCurrencyExtension extends Twig_Extension

Class AlligatorCurrencyExtension is injected as twig.extension.alligator.currency service. AlligatorCurrencyExtension handles the logic and provides necessary data for managed entity in twig.

Properties

protected CurrencyFormatter $currencyFormatter
protected CurrencyManager $currencyManager

Methods

__construct(CurrencyFormatter $currencyFormatter, CurrencyManager $currencyManager, UserSettingsManager $userSettingsManager)

AlligatorCurrencyExtension constructor.

getFilters()

{@inheritDoc}

getFunctions()

{@inheritdoc}

Money
convert(Money $money, string $currencyCode, null $currencyRatio = null)

Converts the given Money object into another currency and returns a new Money object

Money
convertJSON(mixed $money, string $currencyCode = null, null $currencyRatio = null, bool $toDefault = false)

Converts the given JSON object into another currency and returns a new Money object

array
getAllCurrencySign()

Ger array of all currency signs

string|null
getCurrencySymbol(string $currencyString)

Get currency sign for specified currency name

string
formatCurrencyJSON(mixed $price, mixed $code)

Formats the given Money object INCLUDING the currency symbol

string
formatMoney(mixed $money, null $currencySting = null, string $decPoint = ',', string $thousandsSep = ' ')

Formats the given Money object INCLUDING the currency symbol

string
formatMoneyWithCurrency(mixed $money, mixed $currency = SessionParamListener::CURRENCY_DEFAULT_MONEY)

Format money for given currency

string
onlyFormatMoney(mixed $money, string $decPoint = ',', string $thousandsSep = '.')

Formats the given Money object INCLUDING the currency symbol

string
formatNumber(string $number, string $decPoint = ',', string $thousandsSep = '.')

Format number

float|int|Money
convertMoneyToNumber(mixed $money, mixed $currencyCode)

Convert money to number

string|null
getUserPriceListCurrency()

Get currency base on current users pricelist

mixed
getCurrencyRatioByCode(string $code)

Get currency ration

getName()

{@inheritDoc}

Details

at line 43
__construct(CurrencyFormatter $currencyFormatter, CurrencyManager $currencyManager, UserSettingsManager $userSettingsManager)

AlligatorCurrencyExtension constructor.

Parameters

CurrencyFormatter $currencyFormatter
CurrencyManager $currencyManager
UserSettingsManager $userSettingsManager

at line 53
getFilters()

{@inheritDoc}

at line 70
getFunctions()

{@inheritdoc}

at line 91
Money convert(Money $money, string $currencyCode, null $currencyRatio = null)

Converts the given Money object into another currency and returns a new Money object

Parameters

Money $money
string $currencyCode
null $currencyRatio

Return Value

Money

at line 106
Money convertJSON(mixed $money, string $currencyCode = null, null $currencyRatio = null, bool $toDefault = false)

Converts the given JSON object into another currency and returns a new Money object

Parameters

mixed $money
string $currencyCode
null $currencyRatio
bool $toDefault

Return Value

Money

at line 138
array getAllCurrencySign()

Ger array of all currency signs

Return Value

array

at line 149
string|null getCurrencySymbol(string $currencyString)

Get currency sign for specified currency name

Parameters

string $currencyString

Return Value

string|null

at line 167
string formatCurrencyJSON(mixed $price, mixed $code)

Formats the given Money object INCLUDING the currency symbol

Parameters

mixed $price
mixed $code

Return Value

string

at line 181
string formatMoney(mixed $money, null $currencySting = null, string $decPoint = ',', string $thousandsSep = ' ')

Formats the given Money object INCLUDING the currency symbol

Parameters

mixed $money
null $currencySting
string $decPoint
string $thousandsSep

Return Value

string

at line 204
string formatMoneyWithCurrency(mixed $money, mixed $currency = SessionParamListener::CURRENCY_DEFAULT_MONEY)

Format money for given currency

Parameters

mixed $money
mixed $currency

Return Value

string

at line 224
string onlyFormatMoney(mixed $money, string $decPoint = ',', string $thousandsSep = '.')

Formats the given Money object INCLUDING the currency symbol

Parameters

mixed $money
string $decPoint
string $thousandsSep

Return Value

string

at line 247
string formatNumber(string $number, string $decPoint = ',', string $thousandsSep = '.')

Format number

Parameters

string $number
string $decPoint
string $thousandsSep

Return Value

string

at line 262
float|int|Money convertMoneyToNumber(mixed $money, mixed $currencyCode)

Convert money to number

Parameters

mixed $money
mixed $currencyCode

Return Value

float|int|Money

at line 277
string|null getUserPriceListCurrency()

Get currency base on current users pricelist

Return Value

string|null

at line 292
mixed getCurrencyRatioByCode(string $code)

Get currency ration

Parameters

string $code

Return Value

mixed

at line 306
getName()

{@inheritDoc}