package Default
inherited_from \Zend\Filter\AbstractFilter

 Methods

__construct()

__construct(array $options = array()

Parameters

$options

array

Invoke filter as a command

__invoke(mixed $value) : mixed
Inherited

Proxies to \filter()

Parameters

$value

mixed

Exceptions

\Zend\Filter\Exception\ExceptionInterface If filtering $value is impossible

Returns

mixed

Defined by Zend\Filter\FilterInterface

filter(string $value) : string | mixed

Returns a human readable format of the amount of bits or bytes.

If the value provided is not numeric, the value will remain unfiltered

Parameters

$value

string

Returns

stringmixed

Retrieve options representing object state

getOptions() : array
Inherited

Returns

array

hasPcreUnicodeSupport()

hasPcreUnicodeSupport() : boolean
InheritedStatic
deprecated Since 2.1.0

Returns

boolean

setOptions()

setOptions(array|\Traversable $options) : \Zend\Filter\DataUnitFormatter
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array\Traversable

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Returns

\Zend\Filter\DataUnitFormatter

formatAmount()

formatAmount($amount, null $prefix = null) : string

Parameters

$amount

$prefix

null

Returns

string

Get current filter mode

getMode() : string

Returns

string

Get the precision of the filtered result.

getPrecision() : integer

Returns

integer

Find the prefix at a specific location in the prefixes array.

getPrefixAt($index) : string | null

Parameters

$index

Returns

stringnull

Get the predefined prefixes or use the build-in standardized lists of prefixes.

getPrefixes() : array

Returns

array

Get current filter type

getUnit() : string

Returns

string

Find out if the filter is in binary mode.

isBinaryMode() : boolean

Returns

boolean

Find out if the filter is in decimal mode.

isDecimalMode() : boolean

Returns

boolean

isOptions()

isOptions(mixed $options) : boolean
InheritedStatic

Parameters

$options

mixed

Returns

boolean

Define the mode of the filter. Possible values can be fount at self::$modes.

setMode(string $mode) 

Parameters

$mode

string

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Set the precision of the filtered result.

setPrecision($precision) 

Parameters

$precision

Set the precision of the result.

setPrefixes(array $prefixes) 

Parameters

$prefixes

array

Define the unit of the filter. Possible values can be fount at self::$types.

setUnit(string $unit) 

Parameters

$unit

string

 Properties

 

Default options:

$options : array

Default

array('mode' => self::MODE_DECIMAL, 'unit' => '', 'precision' => 2, 'prefixes' => array())
inherited_from \Zend\Filter\AbstractFilter::options
 

Filter options

$options : array

Default

array()
 

A list of all possible filter modes:

$modes : array

Default

array(self::MODE_BINARY, self::MODE_DECIMAL)
Static
 

A list of standardized binary prefix formats for decimal and binary mode

$standardizedPrefixes : array

Default

array(self::MODE_BINARY => array('', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'), self::MODE_DECIMAL => array('', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'))
Static

 Constants

 

BASE_BINARY

BASE_BINARY = 1024 
 

BASE_DECIMAL

BASE_DECIMAL = 1000 
 

MODE_BINARY

MODE_BINARY = 'binary' 
 

MODE_DECIMAL

MODE_DECIMAL = 'decimal'