mediatekformation

PercentToLocalizedStringTransformer
in package
implements DataTransformerInterface

Transforms between a normalized format (integer or float) and a percentage value.

Tags
author

Bernhard Schussek bschussek@gmail.com

author

Florian Eckerstorfer florian@eckerstorfer.org

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

Properties

Methods

__construct()

public __construct([int $scale = null ][, string $type = null ]) : mixed
Parameters
$scale : int = null
$type : string = null
Tags
see
self::$types

for a list of supported types

throws
UnexpectedTypeException

if the given value of type is unknown

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
throws
TransformationFailedException

if the given value is not a string or if the value could not be transformed

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
throws
TransformationFailedException

if the given value is not numeric or if the value could not be transformed

Return values
string

Percentage value

Search results