public function format(
        $value,
        $notation = null,
        $country = null,
        $encoding = null,
        $symbolPosition = null
    ) {
        // get country
        $country = (!$country) ? $this->locale : $country;

        // Format given value
        $formatted = number_format(
            $value,
            $this->getConfiguration()->currency->minor_unit,
            $this->getConfiguration()->currency->decimal_point,
            $this->getConfiguration()->currency->thousands_separator
        );

        // is value = major (1) or minor (0)
        #$type = ($value < 1) ? 'minor' : 'major';

        // check for position override
        if (!$symbolPosition) {
            $symbolPosition = $this->getConfiguration()->currency->symbol_position;
        }

        // if notation set overwrite it with the concrete notation
        if ($notation !== null) {
            // get notation from currency-table
            /*
            $encoding = (
                $notation == (self::NOTATION_SYMBOL || self::NOTATION_TEXT) && $encoding
            ) ? '_'.strtoupper($encoding) : '';
            */

            $country = ($country !== null) ? $country : $this->locale;

            if ($country === null) {
                throw new Doozr_I18n_Service_Exception(
                    sprintf('Please pass $country to "%s".', __METHOD__)
                );
            }

            // get notation
            if ($notation === self::NOTATION_SYMBOL) {
                $notation = $this->getConfiguration()->{$country}->major_symbol;
            } else {
                $notation = $this->getConfiguration()->{$country}->major_short;
            }

            // spacing between curreny-symbol and value
            $notationSpace = $this->getConfiguration()->currency->notation_space;

            // check where to add the symbol ...
            if ($symbolPosition == 'l') {
                $formatted = $notation.$notationSpace.$formatted;
            } else {
                $formatted = $formatted.$notationSpace.$notation;
            }
        }

        // return formatted (currency) result
        return $formatted;
    }
public function format(
        $value,
        $notation = null,
        $country = null,
        $encoding = null,
        $symbolPosition = null
    ) {
        // get country
        $country = (!$country) ? $this->locale : $country;

        // Format given value
        $formatted = number_format(
            $value,
            $this->getConfiguration()->currency->minor_unit,
            $this->getConfiguration()->currency->decimal_point,
            $this->getConfiguration()->currency->thousands_separator
        );

        // is value = major (1) or minor (0)
        #$type = ($value < 1) ? 'minor' : 'major';

        // check for position override
        if (!$symbolPosition) {
            $symbolPosition = $this->getConfiguration()->currency->symbol_position;
        }

        // if notation set overwrite it with the concrete notation
        if ($notation !== null) {
            // get notation from currency-table
            /*
            $encoding = (
                $notation == (self::NOTATION_SYMBOL || self::NOTATION_TEXT) && $encoding
            ) ? '_'.strtoupper($encoding) : '';
            */

            $country = ($country !== null) ? $country : $this->locale;

            if ($country === null) {
                throw new Doozr_I18n_Service_Exception(
                    sprintf('Please pass $country to "%s".', __METHOD__)
                );
            }

            // get notation
            if ($notation === self::NOTATION_SYMBOL) {
                $notation = $this->getConfiguration()->{$country}->major_symbol;
            } else {
                $notation = $this->getConfiguration()->{$country}->major_short;
            }

            // spacing between curreny-symbol and value
            $notationSpace = $this->getConfiguration()->currency->notation_space;

            // check where to add the symbol ...
            if ($symbolPosition == 'l') {
                $formatted = $notation.$notationSpace.$formatted;
            } else {
                $formatted = $formatted.$notationSpace.$notation;
            }
        }

        // return formatted (currency) result
        return $formatted;
    }
public function format ( $ value , $ notation = null , $ country = null , $ encoding = null , $ symbolPosition = null ) { // get country $ country = ( ! $ country ) ? $ this -> locale : $ country ; // Format given value $ formatted = number_format ( $ value , $ this -> getConfiguration ( ) -> currency -> minor_unit , $ this -> getConfiguration ( ) -> currency -> decimal_point , $ this -> getConfiguration ( ) -> currency -> thousands_separator ) ; // is value = major (1) or minor (0) #$type = ($value < 1) ? 'minor' : 'major'; // check for position override if ( ! $ symbolPosition ) { $ symbolPosition = $ this -> getConfiguration ( ) -> currency -> symbol_position ; } // if notation set overwrite it with the concrete notation if ( $ notation !== null ) { // get notation from currency-table /*
            $encoding = (
                $notation == (self::NOTATION_SYMBOL || self::NOTATION_TEXT) && $encoding
            ) ? '_'.strtoupper($encoding) : '';
            */ $ country = ( $ country !== null ) ? $ country : $ this -> locale ; if ( $ country === null ) { throw new Doozr_I18n_Service_Exception ( sprintf ( 'Please pass $country to "%s".' , __METHOD__ ) ) ; } // get notation if ( $ notation === self :: NOTATION_SYMBOL ) { $ notation = $ this -> getConfiguration ( ) -> { $ country } -> major_symbol ; } else { $ notation = $ this -> getConfiguration ( ) -> { $ country } -> major_short ; } // spacing between curreny-symbol and value $ notationSpace = $ this -> getConfiguration ( ) -> currency -> notation_space ; // check where to add the symbol ... if ( $ symbolPosition == 'l' ) { $ formatted = $ notation . $ notationSpace . $ formatted ; } else { $ formatted = $ formatted . $ notationSpace . $ notation ; } } // return formatted (currency) result return $ formatted ; }
This method is intend to format a given value as correct currency.

@param string $value          The value to format as currency
@param mixed  $notation       Notation to be shown - can be either (null = no), long, short, symbol
@param string $country        The country-code of the country of the current processed currency
@param string $encoding       The encoding use to display the currency - null, html, ascii, unicode (ansi)
@param string $symbolPosition Set to "l" to show symbols on the left, or to "r" to show on right side

@author Benjamin Carl <opensource@clickalicious.de>

@return string The correct formatted currency

@throws \Doozr_I18n_Service_Exception
This method is intend to format a given value as correct currency .