PHP 클래스 PhpBench\Util\TimeUnit

파일 보기 프로젝트 열기: dantleech/phpbench 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( $sourceUnit = self::MICROSECONDS, $destUnit = self::MICROSECONDS, $mode = self::MODE_TIME, $precision = 3 )
convert ( integer $time, string $unit, string $destUnit, string $mode ) : integer Convert given time in given unit to given destination unit in given mode.
convertInto ( $time, $unit, $destUnit ) : integer Convert a given time INTO the given unit. That is, how many times the given time will fit into the the destination unit. i.e. x per unit.
convertTo ( $time, $unit, $destUnit ) : integer Convert the given time from the given unit to the given destination unit.
format ( $time, $unit = null, $mode = null, $precision = null, $suffix = true ) Return a human readable representation of the unit including the suffix.
getDestSuffix ( string $unit = null, $mode = null ) : string Return the destination unit suffix.
getDestUnit ( string $unit = null ) : string Return the destination unit.
getMode ( $mode = null ) : string Return the destination mode.
getSuffix ( $unit, $mode = null ) : string Return the suffix for a given unit.
overrideDestUnit ( $destUnit ) Override the destination unit.
overrideMode ( string $mode ) Override the mode.
overridePrecision ( integer $precision ) Override the precision.
resolveDestUnit ( $unit ) : string Utility method, if the dest unit is overridden, return the overridden value.
resolveMode ( $mode ) : string Utility method, if the mode is overridden, return the overridden value.
resolvePrecision ( $precision ) : string Utility method, if the precision is overridden, return the overridden value.
toDestUnit ( $time, $destUnit = null, $mode = null ) : integer Convert instance value to given unit.

비공개 메소드들

메소드 설명
validateMode ( $mode )
validateUnit ( $unit )

메소드 상세

__construct() 공개 메소드

public __construct ( $sourceUnit = self::MICROSECONDS, $destUnit = self::MICROSECONDS, $mode = self::MODE_TIME, $precision = 3 )

convert() 공개 정적인 메소드

Convert given time in given unit to given destination unit in given mode.
public static convert ( integer $time, string $unit, string $destUnit, string $mode ) : integer
$time integer
$unit string
$destUnit string
$mode string
리턴 integer

convertInto() 공개 정적인 메소드

Convert a given time INTO the given unit. That is, how many times the given time will fit into the the destination unit. i.e. x per unit.
public static convertInto ( $time, $unit, $destUnit ) : integer
리턴 integer

convertTo() 공개 정적인 메소드

Convert the given time from the given unit to the given destination unit.
public static convertTo ( $time, $unit, $destUnit ) : integer
리턴 integer

format() 공개 메소드

Return a human readable representation of the unit including the suffix.
public format ( $time, $unit = null, $mode = null, $precision = null, $suffix = true )

getDestSuffix() 공개 메소드

Return the destination unit suffix.
public getDestSuffix ( string $unit = null, $mode = null ) : string
$unit string
리턴 string

getDestUnit() 공개 메소드

Return the destination unit.
public getDestUnit ( string $unit = null ) : string
$unit string
리턴 string

getMode() 공개 메소드

Return the destination mode.
public getMode ( $mode = null ) : string
리턴 string

getSuffix() 공개 정적인 메소드

Return the suffix for a given unit.
public static getSuffix ( $unit, $mode = null ) : string
리턴 string

overrideDestUnit() 공개 메소드

Override the destination unit.
public overrideDestUnit ( $destUnit )

overrideMode() 공개 메소드

Override the mode.
public overrideMode ( string $mode )
$mode string

overridePrecision() 공개 메소드

Override the precision.
public overridePrecision ( integer $precision )
$precision integer

resolveDestUnit() 공개 메소드

Utility method, if the dest unit is overridden, return the overridden value.
public resolveDestUnit ( $unit ) : string
리턴 string

resolveMode() 공개 메소드

Utility method, if the mode is overridden, return the overridden value.
public resolveMode ( $mode ) : string
리턴 string

resolvePrecision() 공개 메소드

Utility method, if the precision is overridden, return the overridden value.
public resolvePrecision ( $precision ) : string
리턴 string

toDestUnit() 공개 메소드

Convert instance value to given unit.
public toDestUnit ( $time, $destUnit = null, $mode = null ) : integer
리턴 integer