<?php
namespace App\Bsp;

class BspRowPrice
{
	/**
	 * The row amount
	 * @var float
	 */
	public $amount = null;

	/**
	 * The row currency. Might be reduntant for some parsers
	 * @var string
	 */
	public $currency = null;

	/**
	 * Reformat internal values, making sure we dont hit the -0 bug, and that all the values are in the required interval
	 * @return $this
	 */
	public function clampValue()
	{
		if ($this->amount!==null) {
			$this->amount = 	round($this->amount, 6)+0;	// handle the -0 bug
		}

		return $this;
	}

	/**
	 * Invert the component sign
	 *
	 * @return $this
	 */
	public function invertSign()
	{
		if ($this->amount!==null) {
			$this->amount = -1*$this->amount;
		}

		return $this;
	}

}
