PHP 클래스 bandwidthThrottle\tokenBucket\util\TokenConverter

저자: Markus Malkusch ([email protected])
파일 보기 프로젝트 열기: bandwidth-throttle/token-bucket 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Rate $rate ) Sets the token rate.
convertMicrotimeToTokens ( double $microtime ) : integer Converts a timestamp into tokens.
convertSecondsToTokens ( double $seconds ) : integer Converts a duration of seconds into an amount of tokens.
convertTokensToMicrotime ( integer $tokens ) : double Converts an amount of tokens into a timestamp.
convertTokensToSeconds ( integer $tokens ) : double Converts an amount of tokens into a duration of seconds.

메소드 상세

__construct() 공개 메소드

Sets the token rate.
public __construct ( Rate $rate )
$rate bandwidthThrottle\tokenBucket\Rate The rate.

convertMicrotimeToTokens() 공개 메소드

Converts a timestamp into tokens.
public convertMicrotimeToTokens ( double $microtime ) : integer
$microtime double The timestamp.
리턴 integer The tokens.

convertSecondsToTokens() 공개 메소드

Converts a duration of seconds into an amount of tokens.
public convertSecondsToTokens ( double $seconds ) : integer
$seconds double The duration in seconds.
리턴 integer The amount of tokens.

convertTokensToMicrotime() 공개 메소드

Converts an amount of tokens into a timestamp.
public convertTokensToMicrotime ( integer $tokens ) : double
$tokens integer The amount of tokens.
리턴 double The timestamp.

convertTokensToSeconds() 공개 메소드

Converts an amount of tokens into a duration of seconds.
public convertTokensToSeconds ( integer $tokens ) : double
$tokens integer The amount of tokens.
리턴 double The seconds.