bandwidthThrottle\tokenBucket\TokenBucket::__construct PHP Метод

__construct() публичный Метод

The storage determines the scope of the bucket.
public __construct ( integer $capacity, Rate $rate, bandwidthThrottle\tokenBucket\storage\Storage $storage )
$capacity integer positive capacity of the bucket
$rate 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);
    }