Formats a value/number to formatted string value.

@param string $value                 Value to format as number
@param bool   $floatingPointNotation Whether

@author Benjamin Carl <opensource@clickalicious.de>

@return string Formatted value
977029
public function number($value, $floatingPointNotation = false)
    {
        return number_format(
            $value,
            (true === $floatingPointNotation) ? $this->getConfiguration()->number->minor_unit : 0,
            $this->getConfiguration()->number->decimal_point,
            $this->getConfiguration()->number->thousands_separator
        );
    }
126769
private function getNumericValue(string $value)
    {
        if (\strpos($value, '.') !== false) {
            return (float) $value;
        }

        return (int) $value;
    }
1016298
private function castValue(string $value)
    {
        $value = $this->normalize($value);
        if (\preg_match('/^[0-9]+$/', $value)) {
            $value = (int)$value;
        } elseif (\preg_match('/^[0-9\.]+$/', $value)) {
            $value = (float)$value;
        } elseif (\preg_match('/^true|false$/', $value)) {
            $value = $value === 'true' ? true : false;
        }
        return $value;
    }
1012187
public static function convertExponentialToString($value)
    {
        if (!is_float($value)) {
            return $value;
        }

        $result = explode('E', strtoupper($value));

        if (count($result) === 1) {
            return $result[0];
        }

        $dotSplitted = explode('.', $result[0]);

        return '0.' . str_repeat('0', abs($result[1]) - 1) . $dotSplitted[0];
    }
905433
protected function formatValue($format, $value)
    {
        switch ($format) {
            case Format::DATE:
            case Format::DATETIME:
                if ($value instanceof \DateTime) {
                    return $value->format('c');
                }
                break;

            case Format::FLOAT2:
            case Format::MONEY2:
                return floatval(sprintf("%.2f", $value));

            case Format::PCT2:
                return floatval(sprintf('%.2f', $value*100));

            case Format::PCT:
                return intval(sprintf('%d', $value*100));

            case Format::INTEGER:
            case Format::MONEY:
                return intval(sprintf("%d", $value));
        }

        return $value;
    }
401434
public function formatNumber($value)
	{
		return number_format($value,$this->numberFormat['decimals'],$this->numberFormat['decimalSeparator'],$this->numberFormat['thousandSeparator']);
	}
14541
public static function decimalFormat($value)
    {
        if (is_int($value)) {
            return $value;
        }else if (is_float($value)) {
            if (strcspn(strrev($value), '.') >= 3) {
                $value = floor($value * 100) / 100;
            }
        }
        return (string)number_format($value, 2, '.', '');
    }
1123505
public static function format($value)
    {
        $value = Utils::toString($value);
        $bn = Utils::toBn($value);
        $int = (int) $bn->toString();

        return $int;
    }
875341
public static function formatToDecimal($value, $decimals = 2)
    {
        if (trim($value) != null) {
            return number_format($value, $decimals, '.', '');
        }
        return null;
    }
34764
public static function createFloat($value)
    {
        if ($value instanceof NumericTypeInterface) {
            return $value->asFloatType();
        }
        if (!is_numeric($value)) {
            throw new \InvalidArgumentException("'{$value}' is no valid numeric for FloatType");
        }
        
        if (self::getRequiredType() == self::TYPE_GMP) {
            return RationalTypeFactory::create($value);
        }
        
        return new FloatType($value);
    }
636060
function Check($value)
    {
        $floatValue = 0.0;
        if (!GlobalNumberParser::TryParse($value, $floatValue)) {
            $this->error = self::NotParsed;
        }
        else {
            if (!$this->CheckMin($floatValue)) {
                 $this->error = self::ExceedsMin; 
            } else if (!$this->CheckMax($floatValue)) {
                $this->error = self::ExceedsMax;
            }
        }
        return $this->error == '';
    }
827080
private function formatValue($value)
    {
        if ($value === '') {
            return '';
        }

        if ($value === null) {
            return '<comment>Null</comment>';
        }

        if (is_bool($value)) {
            return '<comment>' . ($value ? 'True' : 'False') . '</comment>';
        }

        if (empty($value)) {
            return '<comment>Empty</comment>';
        }

        if (is_array($value)) {
            return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        }

        if (is_object($value)) {
            return sprintf('<%s>', get_class($value));
        }

        if (is_scalar($value)) {
            return $value;
        }

        throw new InvalidArgumentException(sprintf('Do not know how to format value "%s"', print_r($value, true)));
    }
131683
private function _getFloatRemainder($value, $signs = 9)
    {
        if ($value == (int)$value) {
            return '0';
        }

        $signs = min($signs, sizeof(self::$_FRACTIONS));
        $value = number_format($value, $signs, '.', '');
        list(, $remainder) = explode('.', $value);
        $remainder = preg_replace('/0+$/', '', $remainder);
        if (!$remainder) {
            $remainder = '0';
        }

        return $remainder;
    }
193113
public static function create($value) {
        Str::assert($value, 'value');

        if($value === 'true')  return true;
        if($value === 'false') return false;
        if($value === 'null')  return null;

        $unquoted = preg_replace('/^(?|\"(.*)\"|\\\'(.*)\\\'|\`(.*)\`)$/', '$1', $value);
        if (!is_numeric($unquoted))                   return $unquoted;
        if ((string) intval($unquoted) === $unquoted) return intval($unquoted);

        return floatval($unquoted);
    }
1068175
public static function format($value)
    {
        if (isset($value['priority'])) {
            $value['priority'] = QuantityFormatter::format($value['priority']);
        }
        if (isset($value['ttl'])) {
            $value['ttl'] = QuantityFormatter::format($value['ttl']);
        }
        return $value;
    }
1059911
public static function formatToInteger($value, $decimals = 2)
    {
        if (trim($value) != null) {
            return number_format($value, $decimals, '.', '') * 100;
        }
        return null;
    }
207770
public function formatWithoutCurrency($value)
    {
        $formatter = new NumberFormatter($this->locale(), NumberFormatter::DECIMAL);

        $code = $this->code($value);
        $divisor = $this->divisor($code);
        $amount = $this->convert($value, $divisor);

        return $formatter->formatCurrency($amount, $code);
    }