symbol = $symbol; $this->position = $position; parent::__construct($value, $thousands, $decimal); } /** * Set localization. * * @param string $thousands Thousands separator * @param string $decimal Decimal separator * @param string $symbol Currency symbol * @param int $position Symbol position * * @return Money * * @since 1.0.0 */ public function setLocalization(string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0) : self { $this->symbol = $symbol; $this->position = $position; parent::setLocalization($thousands, $decimal); return $this; } /** * Get money. * * @param int $decimals Precision (null = auto decimals) * * @return string * * @since 1.0.0 */ public function getCurrency(?int $decimals = 2) : string { return ($this->position === 0 && !empty($this->symbol) ? $this->symbol . ' ' : '') . $this->getAmount($decimals) . ($this->position === 1 ? ' ' . $this->symbol : ''); } /** * Get currency symbol * * @return string * @since 1.0.0 */ public function getCurrencySymbol() : string { return $this->symbol; } }