public function transform($value)
    {
        if (null === $value) {
            return '';
        }

        if (!is_numeric($value)) {
            throw new TransformationFailedException('Expected a numeric.');
        }

        $formatter = $this->getNumberFormatter();
        $value = $formatter->format($value);

        if (intl_is_failure($formatter->getErrorCode())) {
            throw new TransformationFailedException($formatter->getErrorMessage());
        }

        // Convert fixed spaces to normal ones
        $value = str_replace("\xc2\xa0", ' ', $value);

        return $value;
    }
public function transform($value)
    {
        if (null === $value) {
            return '';
        }

        if (!is_numeric($value)) {
            throw new TransformationFailedException('Expected a numeric.');
        }

        $formatter = $this->getNumberFormatter();
        $value = $formatter->format($value);

        if (intl_is_failure($formatter->getErrorCode())) {
            throw new TransformationFailedException($formatter->getErrorMessage());
        }

        // Convert fixed spaces to normal ones
        $value = str_replace("\xc2\xa0", ' ', $value);

        return $value;
    }
public function transform ( $ value ) { if ( null === $ value ) { return '' ; } if ( ! is_numeric ( $ value ) ) { throw new TransformationFailedException ( 'Expected a numeric.' ) ; } $ formatter = $ this -> getNumberFormatter ( ) ; $ value = $ formatter -> format ( $ value ) ; if ( intl_is_failure ( $ formatter -> getErrorCode ( ) ) ) { throw new TransformationFailedException ( $ formatter -> getErrorMessage ( ) ) ; } // Convert fixed spaces to normal ones $ value = str_replace ( "\xc2\xa0" , ' ' , $ value ) ; return $ value ; }
Transforms a number type into localized number.

@param int|float $value Number value

@throws TransformationFailedException If the given value is not numeric
or if the value can not be transformed

@return string Localized value
Transforms a number type into localized number .