PercentToLocalizedStringTransformer
in package
implements
DataTransformerInterface
Transforms between a normalized format (integer or float) and a percentage value.
Tags
Interfaces, Classes, Traits and Enums
- DataTransformerInterface
- Transforms a value between different representations.
Table of Contents
- FRACTIONAL = 'fractional'
- INTEGER = 'integer'
- $types : mixed
- $scale : mixed
- $type : mixed
- __construct() : mixed
- reverseTransform() : int|float
- Transforms between a percentage value into a normalized format (integer or float).
- transform() : string
- Transforms between a normalized format (integer or float) into a percentage value.
- getNumberFormatter() : NumberFormatter
- Returns a preconfigured \NumberFormatter instance.
Constants
FRACTIONAL
public
mixed
FRACTIONAL
= 'fractional'
INTEGER
public
mixed
INTEGER
= 'integer'
Properties
$types
protected
static mixed
$types
= [self::FRACTIONAL, self::INTEGER]
$scale
private
mixed
$scale
$type
private
mixed
$type
Methods
__construct()
public
__construct([int $scale = null ][, string $type = null ]) : mixed
Parameters
- $scale : int = null
- $type : string = null
Tags
Return values
mixed —reverseTransform()
Transforms between a percentage value into a normalized format (integer or float).
public
reverseTransform(string $value) : int|float
Parameters
- $value : string
-
Percentage value
Tags
Return values
int|float —Normalized value
transform()
Transforms between a normalized format (integer or float) into a percentage value.
public
transform(int|float $value) : string
Parameters
- $value : int|float
-
Normalized value
Tags
Return values
string —Percentage value
getNumberFormatter()
Returns a preconfigured \NumberFormatter instance.
protected
getNumberFormatter() : NumberFormatter