WonderPush PHP library
  • Namespace
  • Class
Navigation
  • Namespace
  • Class
Namespaces
  • WonderPush
    • Api
    • Errors
    • Net
    • Obj
    • Params
    • Util
Classes
  • ArrayUtil
  • DefaultLogger
  • JsonSerializable
  • StringUtil
  • TimeUnit
  • TimeUtil
  • TimeValue
  • UrlUtil
Interfaces
  • Logger

Class TimeUnit

Time units and conversion.

Namespace: WonderPush\Util
Located at Util/TimeUnit.php

Methods summary

public static assertValidUnit( mixed $unit )

Asserts the given unit is valid.

Asserts the given unit is valid.

Parameters

$unit
public static getUnits( void ) : integer[]

Returns a list of predefined units.

Returns a list of predefined units.

Returns

integer[]
public static getUnitLabels( integer|null $unit = null ) : string|null|string[]

Returns the labels of a given unit, or of all units.

Returns the labels of a given unit, or of all units.

Parameters

$unit

Returns

string|null|string[]
public static getLabelsToUnits( void ) : integer[]

Returns an mapping of labels to associated unit.

Returns an mapping of labels to associated unit.

Returns

integer[]
public static labelToUnit( string $label ) : integer|null

Returns the unit associated to the given label.

Returns the unit associated to the given label.

Parameters

$label

Returns

integer|null
public static convert( integer|float $value, integer $fromUnit, integer $toUnit ) : integer|float

Converts a value from a given unit to another.

Converts a value from a given unit to another.

Parameters

$value
$fromUnit
$toUnit

Returns

integer|float

Constants summary

NANOSECONDS : integer

Nanoseconds unit.

Nanoseconds unit.

-9
MICROSECONDS : integer

Microseconds unit.

Microseconds unit.

-6
MILLISECONDS : integer

Milliseconds unit.

Milliseconds unit.

-3
SECONDS : integer

Seconds unit.

Seconds unit.

1
MINUTES : integer

Minutes unit.

Minutes unit.

60
HOURS : integer

Hours unit.

Hours unit.

3600
DAYS : integer

Days unit.

Days unit.

86400
WEEKS : integer

Weeks unit.

Weeks unit.

604800
WonderPush PHP library API documentation generated by ApiGen