src/AbstractMoney.php
final protected function getAmountOf($that)
    {
        if ($that instanceof AbstractMoney) {
            if (! $that->getCurrency()->is($this->getCurrency())) {
                throw MoneyMismatchException::currencyMismatch($this->getCurrency(), $that->getCurrency());
            }

            return $that->getAmount();
        }

        return $that;
    }
final protected function getAmountOf($that)
    {
        if ($that instanceof AbstractMoney) {
            if (! $that->getCurrency()->is($this->getCurrency())) {
                throw MoneyMismatchException::currencyMismatch($this->getCurrency(), $that->getCurrency());
            }

            return $that->getAmount();
        }

        return $that;
    }
final protected function getAmountOf ( $ that ) { if ( $ that instanceof AbstractMoney ) { if ( ! $ that -> getCurrency ( ) -> is ( $ this -> getCurrency ( ) ) ) { throw MoneyMismatchException :: currencyMismatch ( $ this -> getCurrency ( ) , $ that -> getCurrency ( ) ) ; } return $ that -> getAmount ( ) ; } return $ that ; }
Returns the amount of the given parameter.

If the parameter is a money, its currency is checked against this money's currency.

@param AbstractMoney|BigNumber|number|string $that A money or amount.

@return BigNumber|number|string

@throws MoneyMismatchException If currencies don't match.
Returns the amount of the given parameter .