public __construct ( integer $capacity, |
||
$capacity | integer | positive capacity of the bucket |
$rate | rate | |
$storage | bandwidthThrottle\tokenBucket\storage\Storage | storage |
public function __construct($capacity, Rate $rate, Storage $storage)
{
if ($capacity <= 0) {
throw new \InvalidArgumentException("Capacity should be greater than 0.");
}
$this->capacity = $capacity;
$this->rate = $rate;
$this->storage = $storage;
$this->tokenConverter = new TokenConverter($rate);
}