solution = [ 'serviceSid' => $serviceSid, 'rateLimitSid' => $rateLimitSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) .'/RateLimits/' . \rawurlencode($rateLimitSid) .'/Buckets/' . \rawurlencode($sid) .''; } /** * Delete the BucketInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the BucketInstance * * @return BucketInstance Fetched BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BucketInstance { $payload = $this->version->fetch('GET', $this->uri); return new BucketInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['rateLimitSid'], $this->solution['sid'] ); } /** * Update the BucketInstance * * @param array|Options $options Optional Arguments * @return BucketInstance Updated BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): BucketInstance { $options = new Values($options); $data = Values::of([ 'Max' => $options['max'], 'Interval' => $options['interval'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new BucketInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['rateLimitSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.BucketContext ' . \implode(' ', $context) . ']'; } }