View helper for formatting currency.

package Default
inherited_from \Zend\View\Helper\AbstractHelper

 Methods

__construct()

__construct() 

Exceptions

\Zend\I18n\Exception\ExtensionNotLoadedException if ext/intl is not present

Format a number

__invoke(float $number, string $currencyCode = null, boolean $showDecimals = null, string $locale = null, string $pattern = null) : string

Parameters

$number

float

$currencyCode

string

$showDecimals

boolean

$locale

string

$pattern

string

Returns

string

Get the 3-letter ISO 4217 currency code indicating the currency to use

getCurrencyCode() : string

Returns

string

Get the currency pattern

getCurrencyPattern() : string

Returns

string

Get the locale to use

getLocale() : string | null

Returns

stringnull

Get the view object

getView() : null | \Zend\View\Renderer\RendererInterface
Inherited
inherited_from \Zend\View\Helper\HelperInterface::getView()

Returns

null\Zend\View\Renderer\RendererInterface

The 3-letter ISO 4217 currency code indicating the currency to use

setCurrencyCode(string $currencyCode) : \Zend\I18n\View\Helper\CurrencyFormat

Parameters

$currencyCode

string

Returns

\Zend\I18n\View\Helper\CurrencyFormat

Set the currency pattern

setCurrencyPattern(string $currencyPattern) : \Zend\I18n\View\Helper\CurrencyFormat

Parameters

$currencyPattern

string

Returns

\Zend\I18n\View\Helper\CurrencyFormat

Set locale to use instead of the default

setLocale(string $locale) : \Zend\I18n\View\Helper\CurrencyFormat

Parameters

$locale

string

Returns

\Zend\I18n\View\Helper\CurrencyFormat

Set if the view helper should show two decimals

setShouldShowDecimals(boolean $showDecimals) : \Zend\I18n\View\Helper\CurrencyFormat

Parameters

$showDecimals

boolean

Returns

\Zend\I18n\View\Helper\CurrencyFormat

Set the View object

setView(\Zend\View\Renderer\RendererInterface $view) : \Zend\View\Helper\AbstractHelper
Inherited
inherited_from \Zend\View\Helper\HelperInterface::setView()

Parameters

$view

\Zend\View\Renderer\RendererInterface

Returns

\Zend\View\Helper\AbstractHelper

Get if the view helper should show two decimals

shouldShowDecimals() : boolean

Returns

boolean

Format a number

formatCurrency(float $number, string $currencyCode, boolean $showDecimals, string $locale, string $pattern) : string

Parameters

$number

float

$currencyCode

string

$showDecimals

boolean

$locale

string

$pattern

string

Returns

string

 Properties

 

The 3-letter ISO 4217 currency code indicating the currency to use

$currencyCode : string

Default

 

Currency pattern

$currencyPattern : string

Default

 

Formatter instances

$formatters : array

Default

array()
 

Locale to use instead of the default

$locale : string

Default

 

If set to true, the currency will be returned with two decimals

$showDecimals : boolean

Default

true
 

View object instance

$view : \Zend\View\Renderer\RendererInterface

Default

null