static function format($value,$format)
    {
        $f = Utility::get($format, "format", true);
        if ($f===false) {
            return $value;
        }
        
        $type = Utility::get($format, "type", "unknown");
        switch($type)
        {
        case "number":
            $decimals = Utility::get($format, "decimals", 0);
            $dec_point = Utility::get(
                $format,
                "decPoint",
                Utility::get(
                    $format,
                    "decimalPoint",
                    Utility::get(
                        $format,
                        "dec_point",
                        "."
                    )
                )
            );

            $thousand_sep = Utility::get(
                $format,
                "thousandSep",
                Utility::get(
                    $format,
                    "thousandSeparator",
                    Utility::get(
                        $format,
                        "thousand_sep",
                        ","
                    )
                )
            );
            $prefix = Utility::get($format, "prefix", "");
            $suffix = Utility::get($format, "suffix", "");
            return $prefix
                .number_format($value, $decimals, $dec_point, $thousand_sep)
                .$suffix;
            break;
        case "string":
            $prefix = Utility::get($format, "prefix", "");
            $suffix = Utility::get($format, "suffix", "");
            return $prefix.$value.$suffix;
            break;
        case "datetime":
            $dateFormat = Utility::get($format, "format", "Y-m-d H:i:s");
        case "date":
            $dateFormat = isset($dateFormat)
                ?$dateFormat
                :Utility::get($format, "format", "Y-m-d");
        case "time":
            $dateFormat = isset($dateFormat)
                ?$dateFormat
                :Utility::get($format, "format", "H:i:s");
            $displayFormat = Utility::get($format, "displayFormat");
            if ($displayFormat && $value) {
                if ($fvalue = \DateTime::createFromFormat($dateFormat, $value)) {
                    return $fvalue->format($displayFormat);
                }
            }
            break;
        }
        return $value;
    }
static function format($value,$format)
    {
        $f = Utility::get($format, "format", true);
        if ($f===false) {
            return $value;
        }
        
        $type = Utility::get($format, "type", "unknown");
        switch($type)
        {
        case "number":
            $decimals = Utility::get($format, "decimals", 0);
            $dec_point = Utility::get(
                $format,
                "decPoint",
                Utility::get(
                    $format,
                    "decimalPoint",
                    Utility::get(
                        $format,
                        "dec_point",
                        "."
                    )
                )
            );

            $thousand_sep = Utility::get(
                $format,
                "thousandSep",
                Utility::get(
                    $format,
                    "thousandSeparator",
                    Utility::get(
                        $format,
                        "thousand_sep",
                        ","
                    )
                )
            );
            $prefix = Utility::get($format, "prefix", "");
            $suffix = Utility::get($format, "suffix", "");
            return $prefix
                .number_format($value, $decimals, $dec_point, $thousand_sep)
                .$suffix;
            break;
        case "string":
            $prefix = Utility::get($format, "prefix", "");
            $suffix = Utility::get($format, "suffix", "");
            return $prefix.$value.$suffix;
            break;
        case "datetime":
            $dateFormat = Utility::get($format, "format", "Y-m-d H:i:s");
        case "date":
            $dateFormat = isset($dateFormat)
                ?$dateFormat
                :Utility::get($format, "format", "Y-m-d");
        case "time":
            $dateFormat = isset($dateFormat)
                ?$dateFormat
                :Utility::get($format, "format", "H:i:s");
            $displayFormat = Utility::get($format, "displayFormat");
            if ($displayFormat && $value) {
                if ($fvalue = \DateTime::createFromFormat($dateFormat, $value)) {
                    return $fvalue->format($displayFormat);
                }
            }
            break;
        }
        return $value;
    }
static function format ( $ value , $ format ) { $ f = Utility :: get ( $ format , "format" , true ) ; if ( $ f === false ) { return $ value ; } $ type = Utility :: get ( $ format , "type" , "unknown" ) ; switch ( $ type ) { case "number" : $ decimals = Utility :: get ( $ format , "decimals" , 0 ) ; $ dec_point = Utility :: get ( $ format , "decPoint" , Utility :: get ( $ format , "decimalPoint" , Utility :: get ( $ format , "dec_point" , "." ) ) ) ; $ thousand_sep = Utility :: get ( $ format , "thousandSep" , Utility :: get ( $ format , "thousandSeparator" , Utility :: get ( $ format , "thousand_sep" , "," ) ) ) ; $ prefix = Utility :: get ( $ format , "prefix" , "" ) ; $ suffix = Utility :: get ( $ format , "suffix" , "" ) ; return $ prefix . number_format ( $ value , $ decimals , $ dec_point , $ thousand_sep ) . $ suffix ; break ; case "string" : $ prefix = Utility :: get ( $ format , "prefix" , "" ) ; $ suffix = Utility :: get ( $ format , "suffix" , "" ) ; return $ prefix . $ value . $ suffix ; break ; case "datetime" : $ dateFormat = Utility :: get ( $ format , "format" , "Y-m-d H:i:s" ) ; case "date" : $ dateFormat = isset ( $ dateFormat ) ? $ dateFormat : Utility :: get ( $ format , "format" , "Y-m-d" ) ; case "time" : $ dateFormat = isset ( $ dateFormat ) ? $ dateFormat : Utility :: get ( $ format , "format" , "H:i:s" ) ; $ displayFormat = Utility :: get ( $ format , "displayFormat" ) ; if ( $ displayFormat && $ value ) { if ( $ fvalue = \ DateTime :: createFromFormat ( $ dateFormat , $ value ) ) { return $ fvalue -> format ( $ displayFormat ) ; } } break ; } return $ value ; }
Format the value with provided format settings

@param mixed $value  Value we want to format
@param array $format The format settings of the value

@return string Formatted value in string
Format the value with provided format settings