Horde_View_Helper_Number
extends Horde_View_Helper_Base
in package
View helpers for numbers.
Tags
Table of Contents
- $_view : Horde_View
- The parent view invoking the helper.
- __call() : mixed
- Call chaining so members of the view can be called (including other helpers).
- __construct() : mixed
- Creates a helper for $view.
- __get() : mixed
- Proxy on undefined property access (get).
- __set() : mixed
- Proxy on undefined property access (set).
- numberToHumanSize() : string
- Formats the bytes in $size into a more understandable representation.
Properties
$_view
The parent view invoking the helper.
protected
Horde_View
$_view
Methods
__call()
Call chaining so members of the view can be called (including other helpers).
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
-
The method.
- $args : array<string|int, mixed>
-
The parameters for the method.
Return values
mixed —The result of the method.
__construct()
Creates a helper for $view.
public
__construct(Horde_View $view) : mixed
Parameters
- $view : Horde_View
-
The view to help.
Return values
mixed —__get()
Proxy on undefined property access (get).
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —__set()
Proxy on undefined property access (set).
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Return values
mixed —numberToHumanSize()
Formats the bytes in $size into a more understandable representation.
public
numberToHumanSize(int|float $size[, mixed $precision = 1 ]) : string
Useful for reporting file sizes to users. This method returns NULL if $size cannot be converted into a number. You can change the default precision of 1 in $precision.
$this->numberToHumanSize(123) => 123 Bytes $this->numberToHumanSize(1234) => 1.2 KB $this->numberToHumanSize(12345) => 12.1 KB $this->numberToHumanSize(1234567) => 1.2 MB $this->numberToHumanSize(1234567890) => 1.1 GB $this->numberToHumanSize(1234567890123) => 1.1 TB $this->numberToHumanSize(1234567, 2) => 1.18 MB
Parameters
- $size : int|float
-
Size to format.
- $precision : mixed = 1
Return values
string —Formatted size value.