protected function _format($value, $rule)
    {
        $format = (array)$this->get($rule);
        $value  = (float)$value;

        $roundedValue = $this->round($value, $rule);
        $isPositive   = ($value >= 0);
        $valueStr     = number_format(
            abs($roundedValue),
            $format['num_decimals'],
            $format['decimal_sep'],
            $format['thousands_sep']
        );

        $template = $isPositive ? $format['format_positive'] : $format['format_negative'];

        return array(
            'value'      => $valueStr,
            'template'   => $template,
            'isPositive' => $isPositive,
        );
    }
protected function _format($value, $rule)
    {
        $format = (array)$this->get($rule);
        $value  = (float)$value;

        $roundedValue = $this->round($value, $rule);
        $isPositive   = ($value >= 0);
        $valueStr     = number_format(
            abs($roundedValue),
            $format['num_decimals'],
            $format['decimal_sep'],
            $format['thousands_sep']
        );

        $template = $isPositive ? $format['format_positive'] : $format['format_negative'];

        return array(
            'value'      => $valueStr,
            'template'   => $template,
            'isPositive' => $isPositive,
        );
    }
protected function _format ( $ value , $ rule ) { $ format = ( array ) $ this -> get ( $ rule ) ; $ value = ( float ) $ value ; $ roundedValue = $ this -> round ( $ value , $ rule ) ; $ isPositive = ( $ value >= 0 ) ; $ valueStr = number_format ( abs ( $ roundedValue ) , $ format [ 'num_decimals' ] , $ format [ 'decimal_sep' ] , $ format [ 'thousands_sep' ] ) ; $ template = $ isPositive ? $ format [ 'format_positive' ] : $ format [ 'format_negative' ] ; return array ( 'value' => $ valueStr , 'template' => $ template , 'isPositive' => $ isPositive , ) ; }
Convert value to money format from config
@param float  $value
@param string $rule
@return array
@throws \JBZoo\SimpleTypes\Exception
Convert value to money format from config