Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Styling\Variables\CurrencyVariable Class Reference

A class used to format currencies. More...

+ Inheritance diagram for Erebot\Styling\Variables\CurrencyVariable:

Public Member Functions

 __construct ($value, $currency=null)
 
 getCurrency ()
 
 getValue ()
 
 render (\Erebot\IntlInterface $translator)
 

Protected Attributes

 $currency
 Currency the amount is expressed in.
 
 $value
 Amount.
 

Detailed Description

A class used to format currencies.

Definition at line 27 of file CurrencyVariable.php.

Constructor & Destructor Documentation

Erebot\Styling\Variables\CurrencyVariable::__construct (   $value,
  $currency = null 
)

Constructor.

Parameters
float$valueAn amount of some currency to format.
string | null$currency(optional) The currency the amount is expressed in. This is used to pick the right monetary symbol and conventions to format the amount. The default is to use the currency associated with the translator given during the actual formatting operation.

Definition at line 49 of file CurrencyVariable.php.

References Erebot\Styling\Variables\CurrencyVariable\$currency, and Erebot\Styling\Variables\CurrencyVariable\$value.

Member Function Documentation

Erebot\Styling\Variables\CurrencyVariable::getCurrency ( )

Returns the currency the amount is expressed in.

Return values
stringThe name of the currency used to express the amount.
NULLNULL is returned in case no currency was given at construction, meaning that the currency will automatically be selected at runtime.

Implements Erebot\Styling\Variables\CurrencyInterface.

Definition at line 78 of file CurrencyVariable.php.

References Erebot\Styling\Variables\CurrencyVariable\$currency.

Erebot\Styling\Variables\CurrencyVariable::getValue ( )

Returns the value stored in this object.

Return values
mixedValue stored in this object.

Implements Erebot\Styling\VariableInterface.

Definition at line 73 of file CurrencyVariable.php.

References Erebot\Styling\Variables\CurrencyVariable\$value.

Erebot\Styling\Variables\CurrencyVariable::render ( \Erebot\IntlInterface  $translator)

Renders the content of this variable.

Parameters
Erebot::IntlInterface$translatorA translator that can be used to change the rendering depending on the target locale.
Return values
stringThe variable rendered as a string.
Note
If no currency was passed to this class' constructor, the currency associated with the translator's locale is used.

Implements Erebot\Styling\VariableInterface.

Definition at line 63 of file CurrencyVariable.php.

References Erebot\Styling\Variables\CurrencyVariable\$currency, and Erebot\IntlInterface\LC_MONETARY.


The documentation for this class was generated from the following file: