bandwidthThrottle\tokenBucket\Rate::getTokensPerSecond PHP Method

getTokensPerSecond() public method

Returns the rate in Tokens per second.
public getTokensPerSecond ( ) : double
return double The rate.
    public function getTokensPerSecond()
    {
        return $this->tokens / self::$unitMap[$this->unit];
    }

Usage Example

 /**
  * Converts an amount of tokens into a duration of seconds.
  *
  * @param int $tokens The amount of tokens.
  * @return double The seconds.
  */
 public function convert($tokens)
 {
     return $tokens / $this->rate->getTokensPerSecond();
 }