mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Revert localization change
This commit is contained in:
parent
2a02969689
commit
1d2151cd83
|
|
@ -67,15 +67,38 @@ class Money implements \Serializable
|
|||
* @param string|int|float $value Value
|
||||
* @param string $thousands Thousands separator
|
||||
* @param string $decimal Decimal separator
|
||||
* @param string $symbol Currency symbol
|
||||
* @param int $position Symbol position
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct($value = 0, string $thousands = ',', string $decimal = '.')
|
||||
public function __construct($value = 0, string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0)
|
||||
{
|
||||
$this->value = is_int($value) ? $value : self::toInt((string) $value);
|
||||
$this->thousands = $thousands;
|
||||
$this->decimal = $decimal;
|
||||
$this->symbol = $symbol;
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set localization.
|
||||
*
|
||||
* @param string $thousands Thousands separator
|
||||
* @param string $decimal Decimal separator
|
||||
* @param string $symbol Currency symbol
|
||||
* @param int $position Symbol position
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setLocalization(string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0)
|
||||
{
|
||||
$this->thousands = $thousands;
|
||||
$this->decimal = $decimal;
|
||||
$this->symbol = $symbol;
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -143,6 +166,21 @@ class Money implements \Serializable
|
|||
return ($decimals > 0) ? number_format($left, 0, $this->decimal, $this->thousands) . $this->decimal . substr($right, 0, $decimals) : (string) $left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get money.
|
||||
*
|
||||
* @param int $decimals Precision
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCurrency(int $decimals = 2) : string
|
||||
{
|
||||
return ($position === 0 ? $smbol : '') . $this->getAmount($decimals, $thousands, $decimal) . ($position === 1 ? $smbol : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add money.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user