protected function parseNumber($number, NumberFormat $numberFormat)
    {
        $replacements = [
            $numberFormat->getGroupingSeparator() => '',
            // Convert the localized symbols back to their original form.
            $numberFormat->getDecimalSeparator() => '.',
            $numberFormat->getPlusSign() => '+',
            $numberFormat->getMinusSign() => '-',
            $numberFormat->getPercentSign() => '%',

            // Strip whitespace (spaces and non-breaking spaces).
            ' ' => '',
            chr(0xC2) . chr(0xA0) => '',
        ];
        $numberingSystem = $numberFormat->getNumberingSystem();
        if (isset($this->digits[$numberingSystem])) {
            // Convert the localized digits back to latin.
            $replacements += array_flip($this->digits[$numberingSystem]);
        }
        $number = strtr($number, $replacements);

        // Convert the accounting format for negative numbers.
        if (substr($number, 0, 1) == '(' && substr($number, -1, 1) == ')') {
            $number = '-' . str_replace(['(', ')'], '', $number);
        }
        // Convert percentages back to their decimal form.
        if (strpos($number, '%') !== false) {
            $number = str_replace('%', '', $number);
            $number = Calculator::divide($number, '100');
        }

        return is_numeric($number) ? $number : false;
    }
protected function parseNumber($number, NumberFormat $numberFormat)
    {
        $replacements = [
            $numberFormat->getGroupingSeparator() => '',
            // Convert the localized symbols back to their original form.
            $numberFormat->getDecimalSeparator() => '.',
            $numberFormat->getPlusSign() => '+',
            $numberFormat->getMinusSign() => '-',
            $numberFormat->getPercentSign() => '%',

            // Strip whitespace (spaces and non-breaking spaces).
            ' ' => '',
            chr(0xC2) . chr(0xA0) => '',
        ];
        $numberingSystem = $numberFormat->getNumberingSystem();
        if (isset($this->digits[$numberingSystem])) {
            // Convert the localized digits back to latin.
            $replacements += array_flip($this->digits[$numberingSystem]);
        }
        $number = strtr($number, $replacements);

        // Convert the accounting format for negative numbers.
        if (substr($number, 0, 1) == '(' && substr($number, -1, 1) == ')') {
            $number = '-' . str_replace(['(', ')'], '', $number);
        }
        // Convert percentages back to their decimal form.
        if (strpos($number, '%') !== false) {
            $number = str_replace('%', '', $number);
            $number = Calculator::divide($number, '100');
        }

        return is_numeric($number) ? $number : false;
    }
protected function parseNumber ( $ number , NumberFormat $ numberFormat ) { $ replacements = [ $ numberFormat -> getGroupingSeparator ( ) => '' , // Convert the localized symbols back to their original form. $ numberFormat -> getDecimalSeparator ( ) => '.' , $ numberFormat -> getPlusSign ( ) => '+' , $ numberFormat -> getMinusSign ( ) => '-' , $ numberFormat -> getPercentSign ( ) => '%' , // Strip whitespace (spaces and non-breaking spaces). ' ' => '' , chr ( 0xC2 ) . chr ( 0xA0 ) => '' , ] ; $ numberingSystem = $ numberFormat -> getNumberingSystem ( ) ; if ( isset ( $ this -> digits [ $ numberingSystem ] ) ) { // Convert the localized digits back to latin. $ replacements += array_flip ( $ this -> digits [ $ numberingSystem ] ) ; } $ number = strtr ( $ number , $ replacements ) ; // Convert the accounting format for negative numbers. if ( substr ( $ number , 0 , 1 ) == '(' && substr ( $ number , - 1 , 1 ) == ')' ) { $ number = '-' . str_replace ( [ '(' , ')' ] , '' , $ number ) ; } // Convert percentages back to their decimal form. if ( strpos ( $ number , '%' ) !== false ) { $ number = str_replace ( '%' , '' , $ number ) ; $ number = Calculator :: divide ( $ number , '100' ) ; } return is_numeric ( $ number ) ? $ number : false ; }
Parses the number according to the number format.

Both the digits and the symbols are replaced
with their non-localized equivalents.

@param string       $number       The number.
@param NumberFormat $numberFormat The number format.

@return string The localized number.
Parses the number according to the number format .