Get amount

If no "amount" value has been set, this method will
set and return a default "amount" value,
if any such value is available

@see getDefaultAmount()

@return int|null amount or null if no amount has been set
541337
public function getAmount() : ?int 
    {
        if ( ! $this->hasAmount()) {
            $this->setAmount($this->getDefaultAmount());
        }
        return $this->amount;
    }
85853
public function getDefault()
    {
        if ($this->reflection->isDefaultValueAvailable()
            and $default = $this->reflection->getDefaultValue()
        ) {
            if (is_scalar($default)) {
                return $default;
            } else {
                return $this->tostring($default);
            }
        }
        if ($this->reflection->isArray()) {
            return '[]';
        }
        if ($this->isPassedByReference()) {
            return 'null';
        } elseif ($this->reflection->getClass()) {
            // This gets injected as a new instance.
            return null;
        }
        $type = $this->getType();
        if (!$type) {
            $type = $this->extractParameterData();
        }
        // Guesstimated values:
        switch ($type) {
            case 'int': case 'integer': case 'float':
                return 0;
            case 'string':
                return "''";
            case 'array':
                return '[]';
        }
        return null;
    }
349750
public function getDefault() {
		if( is_object($this->default) ) {
			$this->default = call_user_func_array($this->default->type, (array) $this->default->args);
		} else
		if( defined($this->default) ) {
			return constant($this->default);
		}
		return $this->default;
	}
368212
public function getTotalAmount()
    {
        $total_amount = $this->unit_price * $this->quantity;

        if (!empty($this->total_discount_amount)) {
            return $total_amount - $this->total_discount_amount;
        }
        return $total_amount;
    }
773750
public function getDiscount() : ?string 
    {
        if ( ! $this->hasDiscount()) {
            $this->setDiscount($this->getDefaultDiscount());
        }
        return $this->discount;
    }
419613
public function getQuantity() : ?int 
    {
        if ( ! $this->hasQuantity()) {
            $this->setQuantity($this->getDefaultQuantity());
        }
        return $this->quantity;
    }
847358
public function getValueOrDefault($key, $default = null) {
        if (!empty($this->values[$key])) {
            return $this->values[$key];
        }
        elseif (!empty($this->defaults[$key])) {
            return $this->defaults[$key];
        }
        else {
            return $default;
        }
    }
898282
public function GetTotalDiscountValue()
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();

        $dTotalDiscountValue = 0;

        while ($oItem = &$this->Next()) {
            $dTotalDiscountValue += ($oItem->dPriceTotal - $oItem->dPriceTotalAfterDiscount);
        }
        $this->setItemPointer($iCurrentPosition);

        return $dTotalDiscountValue;
    }
77887
public function amount()
    {
        // Indian Rupee use special format
        if ($this->currency->getCode() == 'INR') {
            $decimals = null;
            $amount = $this->amount;

            // Extract decimals from amount
            if (($pos = strpos($amount, ".")) !== false) {
                $decimals = substr(round(substr($amount, $pos), 2), 1);
                $amount = substr($amount, 0, $pos);
            }

            // Extract last 3 from amount
            $result = substr($amount, -3);
            $amount = substr($amount, 0, -3);

            // Apply digits 2 by 2
            while (strlen($amount) > 0) {
                $result = substr($amount, -2).",".$result;
                $amount = substr($amount, 0, -2);
            }

            return $result.$decimals;
        }

        // Return western format
        return number_format(
            $this->amount,
            $this->currency->getPrecision(),
            $this->currency->getDecimalSeparator(),
            $this->currency->getThousandSeparator()
        );
    }
220496
public function it_returns_the_default_currency()
    {
        $currency = new Currency('XXX', 2);

        $this->setDefaultCurrency($currency);

        $this->getDefaultCurrency()->shouldReturn($currency);
    }
842086
public function getLoadValue()
    {
        if ($this->formField->value !== null) {
            return $this->formField->value;
        }

        $defaultValue = !$this->model->exists
            ? $this->formField->getDefaultFromData($this->data ?: $this->model)
            : null;

        return $this->formField->getValueFromData($this->data ?: $this->model, $defaultValue);
    }
694828
public function getValue()
    {
        $value = parent::getValue();
        return $value === null || $value === [] ? $this->getDefaultValue() : $value;
    }
818269
public function getValue()
    {
        return ($this->value !== null && $this->value !== '') ? $this->value : $this->getAttribute('default');
    }
986122
public String getDefaultValue() {

        String value = null;
        if (!m_defaultValues.isEmpty()) {
            value = m_defaultValues.get(m_defaultValues.size() - 1);
        }
        return value;
    }
995337
public function getVat() : ?int 
    {
        if ( ! $this->hasVat()) {
            $this->setVat($this->getDefaultVat());
        }
        return $this->vat;
    }
661428
public function getValue()
    {
        if (!$this->exists()) {
            return null;
        }
        $amount = $this->getAmount();
        $currency = $this->getCurrency();
        if (empty($currency)) {
            return $amount;
        }
        return $amount . ' ' . $currency;
    }
810843
public function getValue()
    {
        return round($this->amount / $this->currency->getSubunit(), $this->currency->getPrecision());
    }