Ejemplo n.º 1
0
 /**
  * @param array    $data
  * @param Campaign $campaign
  *
  * @return Response
  */
 public function createResponse(array $data, Campaign $campaign)
 {
     $response = new Response();
     $response->setCampaign($campaign);
     $response->setGrossAnnualSalary($this->numberFormatter->parse($data["gross_annual_salary"]));
     $response->setVariableAnnualSalary($this->numberFormatter->parse($data["variable_annual_salary"]));
     $response->setAnnualSalary($this->numberFormatter->parse($data["annual_salary"]));
     $response->setSalarySatisfaction($this->numberFormatter->parse($data["salary_satisfaction"]));
     $response->setStatus($this->enums->getEnums('status')->getIdByLabel($data["status"]));
     $response->setJobTitle($this->enums->getEnums('job_title')->getIdByLabel($data["job_title"]));
     $response->setExperience($this->enums->getEnums('experience')->getIdByLabel($data["experience"]));
     $response->setInitialTraining($this->enums->getEnums('initial_training')->getIdByLabel($data["initial_training"]));
     $response->setCompanyType($this->enums->getEnums('company_type')->getIdByLabel($data["company_type"]));
     $response->setCompanySize($this->enums->getEnums('company_size')->getIdByLabel($data["company_size"]));
     $department = new Departments();
     if (in_array($data["company_department"], array_keys($department->getAll()))) {
         $response->setCompanyDepartment($data["company_department"]);
     }
     $response->setJobInterest($this->enums->getEnums('job_interest')->getIdByLabel($data["job_interest"]));
     $response->setPhpVersion($this->enums->getEnums('php_version')->getIdByLabel($data["php_version"]));
     $response->setPhpStrength($this->enums->getEnums('php_strength')->getIdByLabel($data["php_strength"]));
     $response->setHasRecentTraining("oui" === strtolower($data["has_formation"]));
     $response->setRecentTrainingHadSalaryImpact("oui" === strtolower($data["formation_impact"]));
     if ("oui" === strtolower($data['has_certification'])) {
         $this->addCertification($response, explode(', ', $data['certification_list']));
     }
     if (strlen(trim($data["speciality"])) !== 0) {
         $this->addSpeciality($response, explode(', ', $data['speciality']));
     }
     $response->setGender($this->enums->getEnums('gender')->getIdByLabel($data["gender"]));
     return $response;
 }
Ejemplo n.º 2
0
 /**
  * @param  string|int|float|null                    $value
  * @param  Doctrine\DBAL\Platforms\AbstractPlatform $platform
  * @return mixed
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return;
     }
     $formatter = new \NumberFormatter('pt_BR', \NumberFormatter::DECIMAL);
     $formatted = $formatter->parse($value);
     return $formatted;
 }
Ejemplo n.º 3
0
function ut_main()
{
    setlocale(LC_ALL, 'de_DE');
    $fmt = new NumberFormatter('sl_SI.UTF-8', NumberFormatter::DECIMAL);
    $num = "1.234.567,891";
    $res_str = $fmt->parse($num) . "\n";
    $res_str .= setlocale(LC_NUMERIC, 0);
    return $res_str;
}
Ejemplo n.º 4
0
function parse_decimals($number)
{
    // ignore empty strings and return
    if (empty($number)) {
        return $number;
    }
    $config = get_instance()->config;
    $fmt = new \NumberFormatter($config->item('number_locale'), \NumberFormatter::DECIMAL);
    $fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $config->item('quantity_decimals'));
    $fmt->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $config->item('quantity_decimals'));
    return $fmt->parse($number);
}
Ejemplo n.º 5
0
 /**
  * Replaces localized digits in $str with latin digits.
  *
  * @param string $str
  * @return string Latinized string
  */
 protected function latinizeDigits($str)
 {
     $result = '';
     $num = new \NumberFormatter($this->locale, \NumberFormatter::DECIMAL);
     preg_match_all('/.[\\x80-\\xBF]*/', $str, $matches);
     foreach ($matches[0] as $char) {
         $pos = 0;
         $parsedChar = $num->parse($char, \NumberFormatter::TYPE_INT32, $pos);
         $result .= $pos ? $parsedChar : $char;
     }
     return $result;
 }
Ejemplo n.º 6
0
function parse_decimals($number)
{
    // ignore empty strings and return
    if (empty($number)) {
        return $number;
    }
    $config = get_instance()->config;
    $fmt = new \NumberFormatter($config->item('number_locale'), \NumberFormatter::DECIMAL);
    if (empty($config->item('thousands_separator'))) {
        $fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
    }
    return $fmt->parse($number);
}
Ejemplo n.º 7
0
function ut_main()
{
    $res_str = "";
    $de_locale = "de_DE.UTF-8";
    $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL);
    $numeric = $fmt->parse("1234,56");
    $res_str .= "{$numeric}\n";
    setlocale(LC_ALL, $de_locale);
    $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL);
    $numeric = $fmt->parse("1234,56");
    setlocale(LC_ALL, "C");
    // reset for printing
    $res_str .= "{$numeric}\n";
    return $res_str;
}
Ejemplo n.º 8
0
 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value || '' === $value) {
         return;
     }
     if (!is_scalar($value)) {
         throw new UnexpectedTypeException($value, 'string');
     }
     $formatter = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::DECIMAL);
     $position = 0;
     $formatter->parse($value, \NumberFormatter::TYPE_DOUBLE, $position);
     if (intl_is_failure($formatter->getErrorCode()) || $position < strlen($value)) {
         /** @var Decimal $constraint */
         $this->context->addViolation($constraint->message, ['{{ value }}' => $this->formatValue($value)]);
     }
 }
Ejemplo n.º 9
0
 /**
  * Parse the specified string to a double.
  *
  * @param
  *        	string str
  *        	The string to parse.
  * @return double The parsed number.
  */
 public function parse($str)
 {
     $this->synchronized(function ($thread) {
         try {
             if ($str === "?") {
                 return \NAN;
             }
             if (strtolower($str) === strtolower("NaN")) {
                 return \NAN;
             } else {
                 return doubleval($this->numberFormatter->parse(doubleval(trim($str))));
             }
         } catch (Exception $e) {
             throw new CSVError("Error:" + $e->getMessage() + " on [" + $str + "], decimal:" + $this->decimal + ",sep: " + $this->separator);
         }
     });
 }
Ejemplo n.º 10
0
 /**
  * @dataProvider getParseData
  */
 public function testNumberFormatter($input, $output, $expectExtraChars = false, $maxIcuVersion = null)
 {
     if (!class_exists('NumberFormatter')) {
         $this->markTestSkipped('ext/intl not loaded');
         return;
     }
     $icuVersion = $this->getIcuVersion();
     if ($maxIcuVersion && version_compare($icuVersion, $maxIcuVersion, '>')) {
         $this->markTestSkipped('ICU Version to big for this test. Version is ' . $icuVersion . ' max allowed ' . $maxIcuVersion);
         return;
     }
     $input = trim($input);
     $yay = 0;
     $x = new NumberFormatter("en_US", NumberFormatter::DECIMAL);
     $x->setAttribute(NumberFormatter::LENIENT_PARSE, true);
     $parsed = $x->parse($input, NumberFormatter::TYPE_DOUBLE, $yay);
     $this->assertEquals($output, $parsed);
     $this->assertEquals($expectExtraChars, $yay < strlen($input));
 }
Ejemplo n.º 11
0
 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value || '' === $value) {
         return;
     }
     if (!is_scalar($value)) {
         throw new UnexpectedTypeException($value, 'string');
     }
     $formatter = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::DECIMAL);
     $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, \NumberFormatter::ROUND_DOWN);
     $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, 0);
     $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 0);
     $formatter->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, 0);
     $decimalSeparator = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
     $position = 0;
     $formatter->parse($value, PHP_INT_SIZE == 8 ? $formatter::TYPE_INT64 : $formatter::TYPE_INT32, $position);
     if (intl_is_failure($formatter->getErrorCode()) || strpos($value, $decimalSeparator) !== false || $position < strlen($value)) {
         /** @var Integer $constraint */
         $this->context->addViolation($constraint->message, ['{{ value }}' => $this->formatValue($value)]);
     }
 }
Ejemplo n.º 12
0
 /**
  * Returns a machine workable decimal according to locale. 
  * @param string $locale e.g. en_US
  * @param string $decimal
  * @param int $max_digits
  * @param int $min_digits
  * @return decimal $res
  */
 public static function formatDecimalFromLocale($locale, $decimal, $min_digits = 2, $max_digits = 2)
 {
     $f = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
     if ($min_digits) {
         $f->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $min_digits);
     }
     if ($max_digits) {
         $f->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $max_digits);
         // by default some locales got max 2 fraction digits, that is probably not what you want
     }
     return $f->parse($decimal);
 }
Ejemplo n.º 13
0
 /**
  * Prepare data for save
  *
  * @return $this
  * @throws LocalizedException
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function beforeSave()
 {
     // prevent overriding product data
     if (isset($this->_data['attribute_code']) && $this->reservedAttributeList->isReservedAttribute($this)) {
         throw new LocalizedException(__('The attribute code \'%1\' is reserved by system. Please try another attribute code', $this->_data['attribute_code']));
     }
     /**
      * Check for maximum attribute_code length
      */
     if (isset($this->_data['attribute_code']) && !\Zend_Validate::is($this->_data['attribute_code'], 'StringLength', ['max' => self::ATTRIBUTE_CODE_MAX_LENGTH])) {
         throw new LocalizedException(__('An attribute code must be fewer than %1 characters.', self::ATTRIBUTE_CODE_MAX_LENGTH));
     }
     $defaultValue = $this->getDefaultValue();
     $hasDefaultValue = (string) $defaultValue != '';
     if ($this->getBackendType() == 'decimal' && $hasDefaultValue) {
         $numberFormatter = new \NumberFormatter($this->_localeResolver->getLocale(), \NumberFormatter::DECIMAL);
         $defaultValue = $numberFormatter->parse($defaultValue);
         if ($defaultValue === false) {
             throw new LocalizedException(__('Invalid default decimal value'));
         }
         $this->setDefaultValue($defaultValue);
     }
     if ($this->getBackendType() == 'datetime') {
         if (!$this->getBackendModel()) {
             $this->setBackendModel('Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\Datetime');
         }
         if (!$this->getFrontendModel()) {
             $this->setFrontendModel('Magento\\Eav\\Model\\Entity\\Attribute\\Frontend\\Datetime');
         }
         // save default date value as timestamp
         if ($hasDefaultValue) {
             $format = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
             try {
                 $defaultValue = $this->dateTimeFormatter->formatObject(new \DateTime($defaultValue), $format);
                 $this->setDefaultValue($defaultValue);
             } catch (\Exception $e) {
                 throw new LocalizedException(__('Invalid default date'));
             }
         }
     }
     if ($this->getBackendType() == 'gallery') {
         if (!$this->getBackendModel()) {
             $this->setBackendModel('Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\DefaultBackend');
         }
     }
     return parent::beforeSave();
 }
Ejemplo n.º 14
0
<?php

$formatter = new \NumberFormatter('en', \NumberFormatter::DECIMAL);
$value = $formatter->parse('2147483647', \NumberFormatter::TYPE_INT32);
var_dump($value);
$formatter = new \NumberFormatter('en', \NumberFormatter::DECIMAL);
$value = $formatter->parse('2147483650', \NumberFormatter::TYPE_INT64);
var_dump($value);
Ejemplo n.º 15
0
 /**
  * Use this method to parse currency string.
  *
  * <code>
  * $amount   = 1,500.25;
  *
  * $language         = JFactory::getLanguage();
  * $moneyFormatter   = new NumberFormatter($language->getTag(), NumberFormatter::PATTERN_DECIMAL, $this->params->get('currency_pattern'));
  *
  * $money   = new Prism\Money\Money($moneyFormatter);
  * $money->setValue($amount);
  *
  * // Will return 1500.25.
  * $goal = $money->parse();
  * </code>
  *
  * @return string
  */
 public function parse()
 {
     return $this->formatter->parse($this->amount, \NumberFormatter::TYPE_DOUBLE);
 }
Ejemplo n.º 16
0
 public function Subcription($frequency, $start, $end, $due)
 {
     //helper function
     function datediff($interval, $datefrom, $dateto, $using_timestamps = false)
     {
         /*
         $interval can be:
         yyyy - Number of full years
         q - Number of full quarters
         m - Number of full months
         y - Difference between day numbers
             (eg 1st Jan 2004 is "1", the first day. 2nd Feb 2003 is "33". The datediff is "-32".)
         d - Number of full days
         w - Number of full weekdays
         ww - Number of full weeks
         h - Number of full hours
         n - Number of full minutes
         s - Number of full seconds (default)
         */
         if (!$using_timestamps) {
             $datefrom = strtotime($datefrom, 0);
             $dateto = strtotime($dateto, 0);
         }
         $difference = $dateto - $datefrom;
         // Difference in seconds
         switch ($interval) {
             case 'yyyy':
                 // Number of full years
                 $years_difference = floor($difference / 31536000);
                 if (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom), date("j", $datefrom), date("Y", $datefrom) + $years_difference) > $dateto) {
                     $years_difference--;
                 }
                 if (mktime(date("H", $dateto), date("i", $dateto), date("s", $dateto), date("n", $dateto), date("j", $dateto), date("Y", $dateto) - ($years_difference + 1)) > $datefrom) {
                     $years_difference++;
                 }
                 $datediff = $years_difference;
                 break;
             case "q":
                 // Number of full quarters
                 $quarters_difference = floor($difference / 8035200);
                 while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom) + $quarters_difference * 3, date("j", $dateto), date("Y", $datefrom)) < $dateto) {
                     $months_difference++;
                 }
                 $quarters_difference--;
                 $datediff = $quarters_difference;
                 break;
             case "m":
                 // Number of full months
                 $months_difference = floor($difference / 2678400);
                 while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom) + $months_difference, date("j", $dateto), date("Y", $datefrom)) < $dateto) {
                     $months_difference++;
                 }
                 $months_difference--;
                 $datediff = $months_difference;
                 break;
             case 'y':
                 // Difference between day numbers
                 $datediff = date("z", $dateto) - date("z", $datefrom);
                 break;
             case "d":
                 // Number of full days
                 $datediff = floor($difference / 86400);
                 break;
             case "w":
                 // Number of full weekdays
                 $days_difference = floor($difference / 86400);
                 $weeks_difference = floor($days_difference / 7);
                 // Complete weeks
                 $first_day = date("w", $datefrom);
                 $days_remainder = floor($days_difference % 7);
                 $odd_days = $first_day + $days_remainder;
                 // Do we have a Saturday or Sunday in the remainder?
                 if ($odd_days > 7) {
                     // Sunday
                     $days_remainder--;
                 }
                 if ($odd_days > 6) {
                     // Saturday
                     $days_remainder--;
                 }
                 $datediff = $weeks_difference * 5 + $days_remainder;
                 break;
             case "ww":
                 // Number of full weeks
                 $datediff = floor($difference / 604800);
                 break;
             case "h":
                 // Number of full hours
                 $datediff = floor($difference / 3600);
                 break;
             case "n":
                 // Number of full minutes
                 $datediff = floor($difference / 60);
                 break;
             default:
                 // Number of full seconds (default)
                 $datediff = $difference;
                 break;
         }
         return $datediff;
     }
     $fmt = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
     switch ($frequency) {
         case 1:
             //Weekly
             $frequency = Frequency::find($frequency)->name;
             $recurrences = datediff("ww", $start, $end, false);
             $schedule = array();
             for ($x = 0; $x <= $recurrences; $x++) {
                 $schedule[] = Carbon::createFromTimestamp(strtotime($start))->addWeeks($x)->format('m/d/y ');
             }
             $recurrences = $x;
             $amount = $fmt->parse($due) / $x;
             break;
         case 2:
             //Every two weeks
             $frequency = Frequency::find($frequency)->name;
             $recurrences = round(datediff("ww", $start, $end, false)) / 2;
             $schedule = array();
             for ($x = 0; $x <= $recurrences; $x++) {
                 $schedule[] = Carbon::createFromTimestamp(strtotime($start))->addWeeks($x * 2)->format('m/d/y ');
             }
             $recurrences = $x;
             $amount = $fmt->parse($due) / $x;
             break;
         case 3:
             //Monthly
             $frequency = Frequency::find($frequency)->name;
             $recurrences = datediff("m", $start, $end, false);
             $schedule = array();
             for ($x = 0; $x <= $recurrences; $x++) {
                 $schedule[] = Carbon::createFromTimestamp(strtotime($start))->addMonths($x)->format('m/d/y ');
             }
             $recurrences = $x;
             $amount = $fmt->parse($due) / $x;
             break;
     }
     setlocale(LC_MONETARY, "en_US");
     $result = array("frequency" => $frequency, "start" => $start, "end" => $end, "subtotal" => money_format('%.2n', round($amount, 2)), "fee" => money_format('%.2n', round($amount / getenv("SV_FEE") - $amount, 2)), "total" => money_format('%.2n', round($amount / getenv("SV_FEE"), 2)), "recurrences" => $recurrences, "dates" => $schedule);
     $object = json_decode(json_encode($result), FALSE);
     return $object;
 }
Ejemplo n.º 17
0
 /**
  * Use this method to parse currency string.
  *
  * <code>
  * $amount   = 1,500.25;
  * $amount   = new Crowdfunding\Amount($amount);
  *
  * // Will return 1500.25.
  * $goal = $currency->parse();
  * </code>
  *
  * @return float
  */
 public function parse()
 {
     $intl = (bool) $this->getOption('intl', false);
     $fractionDigits = abs($this->getOption('fraction_digits', 2));
     // Use PHP Intl library to format the amount.
     if ($intl and extension_loaded('intl')) {
         // Generate currency string using PHP NumberFormatter ( Internationalization Functions )
         $locale = $this->getOption('locale');
         // Get current locale code.
         if (!$locale) {
             $lang = \JFactory::getLanguage();
             $locale = str_replace('-', '_', $lang->getTag());
         }
         $numberFormat = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
         $numberFormat->setAttribute(\NumberFormatter::FRACTION_DIGITS, $fractionDigits);
         $result = $numberFormat->parse($this->value, \NumberFormatter::TYPE_DOUBLE);
     } else {
         $result = $this->parseAmount($this->value);
     }
     return $result;
 }
Ejemplo n.º 18
0
function intl_decimal(&$value, $locale = null)
{
    if (!\class_exists('\\Locale')) {
        throw new \RuntimeException('intl extension is not installed');
    }
    if (!\is_string($value) && !\is_int($value) && !\is_float($value)) {
        return false;
    }
    if ($locale === null) {
        $locale = \Locale::getDefault();
    }
    $fmt = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
    $ret = $fmt->parse($value);
    if ($ret !== false) {
        $value = $ret;
        return true;
    }
    return false;
}
Ejemplo n.º 19
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Requests\MaterialRequest $request, $id)
 {
     $input = $request->all();
     $numberFormatter_ptBR2en = new \NumberFormatter('pt_BR', \NumberFormatter::DECIMAL);
     $input['mat_vlr_ult_aquis'] = $numberFormatter_ptBR2en->parse($input['mat_vlr_ult_aquis']);
     $material = $this->materialModel->find($id);
     $material->update($input);
     return redirect('materials');
 }
function clean_number($number)
{
    global $Settings;
    //TODO Remove global
    $fmt = new NumberFormatter($Settings->getSetting('locale'), NumberFormatter::DECIMAL);
    $cleannum = $fmt->parse(preg_replace("/[^\\.,0-9]/", "", \Grase\Clean::text($number)));
    return $cleannum;
}
Ejemplo n.º 21
0
 /**
  * @param JsonDeserializationVisitor $visitor
  * @param mixed                      $data
  * @param array                      $type
  *
  * @return float
  */
 public function deserializeFloatTypeFromJson(JsonDeserializationVisitor $visitor, $data, array $type)
 {
     if (null === $data) {
         return null;
     }
     $numberFormatter = new \NumberFormatter($this->getLocale($type), $this->getFormat($type));
     return new FloatType($numberFormatter->parse($data));
 }
    protected function castValueImpl($value) {
        // at first we try to cast to number. If that does not work we try to cast to percent
        $nf = new NumberFormatter(Environment::getInstance()->getLocale(), NumberFormatter::DECIMAL);
        $offset = 0; // we need to use $offset because in case of error parse() returns 0 instead of FALSE
        $n = $nf->parse($value, NumberFormatter::TYPE_DOUBLE, $offset);
        if (($n === FALSE) || ($offset != strlen($value))) {
            $n = $this->parse($value);
        }
        if ($n === FALSE) {
            $this->errorCastValue($value);
        }

        return $n;
    }
Ejemplo n.º 23
0
 /**
  * @param $value
  * @return mixed
  */
 public function parse($value)
 {
     return $this->formatter->parse($value);
 }
Ejemplo n.º 24
0
 protected function assertInCodomain($locale, $currencyCode, $value)
 {
     $this->assertInternalType('string', $value);
     $formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
     $formatter->setTextAttribute(\NumberFormatter::CURRENCY_CODE, $currencyCode);
     $domainValue = $formatter->parse($value, \NumberFormatter::TYPE_DOUBLE);
     $testValue = $formatter->formatCurrency($domainValue, $currencyCode);
     $this->assertSame($value, $testValue);
 }
Ejemplo n.º 25
0
 /**
  * Mostra o Valor no float Formatado
  * @param string $number
  * @param integer $decimals
  * @param boolean $showThousands
  * @return string
  */
 public static function nFloat($number, $decimals = 2, $showThousands = false)
 {
     if (is_null($number) || empty(self::onlyNumbers($number))) {
         return '';
     }
     $pontuacao = preg_replace('/[0-9]/', '', $number);
     $locale = substr($pontuacao, -1, 1) == ',' ? "pt-BR" : "en-US";
     $formater = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
     if ($decimals === false) {
         $decimals = 2;
         preg_match_all('/[0-9][^0-9]([0-9]+)/', $number, $matches);
         if (!empty($matches[1])) {
             $decimals = strlen(rtrim($matches[1][0], 0));
         }
     }
     return number_format($formater->parse($number, \NumberFormatter::TYPE_DOUBLE), $decimals, '.', $showThousands ? ',' : '');
 }
Ejemplo n.º 26
0
 /**
  * Returns the original value if is a numeric value, the current locale's parsed
  * decimal value or the original value if it cannot be parsed.
  *
  * @see intl.default_locale
  *
  * @param mixed $value The value to parse
  * @return mixed
  */
 public static function formatDecimal($value)
 {
     if (is_numeric($value) === false) {
         $formatter = new \NumberFormatter(ini_get('intl.default_locale'), \NumberFormatter::DECIMAL);
         $result = $formatter->parse($value);
         $value = $result === false ? $value : $result;
     }
     return $value;
 }