PHP Класс bandwidthThrottle\tokenBucket\util\TokenConverter

Автор: Markus Malkusch ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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.