PHP Class Resque\Helpers\Util

Author: Michael Haynes ([email protected])
Mostra file Open project: mjphaynes/php-resque Class Usage Examples

Public Methods

Method Description
bytes ( integer $bytes, string $force_unit = null, string $format = null, boolean $si = true ) : string Returns human readable sizes. Based on original functions written by Aidan Lister and Quentin Zervaas.
human_time_diff ( integer $from, integer $to = null ) : string Determines the difference between two timestamps.
path ( $array, $path, &$found, $delimiter = '.' ) : boolean Gets a value from an array using a dot separated path.

Method Details

bytes() public static method

Returns human readable sizes. Based on original functions written by Aidan Lister and Quentin Zervaas.
public static bytes ( integer $bytes, string $force_unit = null, string $format = null, boolean $si = true ) : string
$bytes integer size in bytes
$force_unit string a definitive unit
$format string the return string format
$si boolean whether to use SI prefixes or IEC
return string

human_time_diff() public static method

The difference is returned in a human readable format such as "1 hour", "5 mins", "2 days".
public static human_time_diff ( integer $from, integer $to = null ) : string
$from integer Unix timestamp from which the difference begins.
$to integer Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
return string Human readable time difference.

path() public static method

Returns true if found and false if not.
public static path ( $array, $path, &$found, $delimiter = '.' ) : boolean
return boolean