Microweber\Providers\ShopManager::currency_format PHP Метод

currency_format() публичный Метод

public currency_format ( $amount, $curr = false )
    public function currency_format($amount, $curr = false)
    {
        if ($curr == false) {
            $curr = $this->app->option_manager->get('currency', 'payments');
        }
        $amount = floatval($amount);
        $sym = $this->currency_symbol($curr);
        if ($sym == '') {
            $sym = $curr;
        }
        $cur_pos = $this->app->option_manager->get('currency_symbol_position', 'payments');
        switch ($cur_pos) {
            case 'before':
                $ret = $sym . ' ' . number_format($amount, 2, '.', ',');
                break;
            case 'after':
                $ret = number_format($amount, 2, '.', ' ') . ' ' . $sym;
                break;
            case 'default':
            default:
                switch ($curr) {
                    case 'EUR':
                        $ret = '€ ' . number_format($amount, 2, ',', ' ');
                        break;
                    case 'BGN':
                    case 'RUB':
                        $ret = number_format($amount, 2, '.', ' ') . ' ' . $sym;
                        break;
                    case 'US':
                    case 'USD':
                        $ret = '$ ' . number_format($amount, 2, '.', ',');
                        break;
                    default:
                        $ret = $sym . ' ' . number_format($amount, 2, '.', ',');
                        break;
                }
                break;
        }
        return $ret;
    }