public function amount($money)
    {
        if (null === $money) {
            return;
        }

        if (is_string($money) || $money < 0) {
            throw new InvalidArgumentException('Money amount must be a positive number.');
        }

        if ($this->getMoneyFormat() === 'cents') {
            return number_format($money, 0, '', '');
        }

        return sprintf('%.2f', number_format($money, 2, '.', '') / 100);
    }
public function amount($money)
    {
        if (null === $money) {
            return;
        }

        if (is_string($money) || $money < 0) {
            throw new InvalidArgumentException('Money amount must be a positive number.');
        }

        if ($this->getMoneyFormat() === 'cents') {
            return number_format($money, 0, '', '');
        }

        return sprintf('%.2f', number_format($money, 2, '.', '') / 100);
    }
public function amount ( $ money ) { if ( null === $ money ) { return ; } if ( is_string ( $ money ) || $ money < 0 ) { throw new InvalidArgumentException ( 'Money amount must be a positive number.' ) ; } if ( $ this -> getMoneyFormat ( ) === 'cents' ) { return number_format ( $ money , 0 , '' , '' ) ; } return sprintf ( '%.2f' , number_format ( $ money , 2 , '.' , '' ) / 100 ) ; }
Accept the amount of money in base unit and returns cents or base unit.

@param int|float $money

@throws \InvalidArgumentException

@return string|null
Accept the amount of money in base unit and returns cents or base unit .