Public Member Functions | |
init ($amount) | |
setValue ($value) | |
setCurrencyCode ($currencyCode) | |
getValue () | |
getCurrencyCode () | |
toString () | |
Protected Attributes | |
$_amountStringTemplate = "/^([A-Z]{3})\s([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/" | |
$_valueStringTemplate = "/^([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/" | |
$_currencyCodeStringTemplate = "/^([A-Z]{3})$/" |
Definition at line 34 of file Amount.php.
getCurrencyCode | ( | ) |
getValue | ( | ) |
init | ( | $ | amount | ) |
Init object
string | $amount - union amount |
Definition at line 67 of file Amount.php.
00068 { 00069 $tmpArr = array(); 00070 if (!preg_match($this->_amountStringTemplate, $amount, $tmpArr)) { 00071 return false; 00072 } 00073 $this->_value = $tmpArr[2]; 00074 $this->_currencyCode = $tmpArr[1]; 00075 return $this; 00076 }
setCurrencyCode | ( | $ | currencyCode | ) |
Set amount currency code
string | $currencyCode |
Definition at line 100 of file Amount.php.
00101 { 00102 $tmpArr = array(); 00103 if (!preg_match($this->_currencyCodeStringTemplate, $currencyCode, $tmpArr)) { 00104 return false; 00105 } 00106 $this->_currencyCode = $tmpArr[1]; 00107 return $this; 00108 }
setValue | ( | $ | value | ) |
Set amount value
string | $value |
Definition at line 84 of file Amount.php.
00085 { 00086 $tmpArr = array(); 00087 if (!preg_match($this->_valueStringTemplate, $value, $tmpArr)) { 00088 return false; 00089 } 00090 $this->_value = $tmpArr[1]; 00091 return $this; 00092 }
toString | ( | ) |
Return union amount string
Definition at line 135 of file Amount.php.
00136 { 00137 return $this->getCurrencyCode() . ' ' . $this->getValue(); 00138 }
$_amountStringTemplate = "/^([A-Z]{3})\s([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/" [protected] |
Definition at line 49 of file Amount.php.
$_currencyCodeStringTemplate = "/^([A-Z]{3})$/" [protected] |
Definition at line 59 of file Amount.php.
$_valueStringTemplate = "/^([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/" [protected] |
Definition at line 54 of file Amount.php.