public function amount($decimal, $currency_code = null, $round = true)
    {
        static $factors = array();

        if (empty($currency_code)) {
            $currency_code = $this->currency->getDefault();
        }

        if (empty($factors[$currency_code])) {
            $currency = $this->currency->get($currency_code);
            $factors[$currency_code] = pow(10, $currency['decimals']);
        }

        if ($round) {
            $currency = $this->currency->get($currency_code);
            $decimal = $this->round($decimal, $currency);
            return (int) round($decimal * $factors[$currency_code]);
        }

        return $decimal * $factors[$currency_code];
    }
public function amount($decimal, $currency_code = null, $round = true)
    {
        static $factors = array();

        if (empty($currency_code)) {
            $currency_code = $this->currency->getDefault();
        }

        if (empty($factors[$currency_code])) {
            $currency = $this->currency->get($currency_code);
            $factors[$currency_code] = pow(10, $currency['decimals']);
        }

        if ($round) {
            $currency = $this->currency->get($currency_code);
            $decimal = $this->round($decimal, $currency);
            return (int) round($decimal * $factors[$currency_code]);
        }

        return $decimal * $factors[$currency_code];
    }
public function amount ( $ decimal , $ currency_code = null , $ round = true ) { static $ factors = array ( ) ; if ( empty ( $ currency_code ) ) { $ currency_code = $ this -> currency -> getDefault ( ) ; } if ( empty ( $ factors [ $ currency_code ] ) ) { $ currency = $ this -> currency -> get ( $ currency_code ) ; $ factors [ $ currency_code ] = pow ( 10 , $ currency [ 'decimals' ] ) ; } if ( $ round ) { $ currency = $ this -> currency -> get ( $ currency_code ) ; $ decimal = $ this -> round ( $ decimal , $ currency ) ; return ( int ) round ( $ decimal * $ factors [ $ currency_code ] ) ; } return $ decimal * $ factors [ $ currency_code ] ; }
Converts a price from major to minor units
@param float $decimal
@param string|null $currency_code
@param boolean $round
@return integer
Converts a price from major to minor units