\PhapperRateLimiter

Summary

Methods
Properties
Constants
__construct()
enable()
disable()
setInterval()
wait()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$enabled
$interval
$last_request
N/A

Properties

$enabled

$enabled : 

Type

$interval

$interval : 

Type

$last_request

$last_request : 

Type

Methods

__construct()

__construct(  $enabled = true,   $interval = 2) 

Parameters

$enabled
$interval

enable()

enable() 

Enable the rate limiter, on by default.

disable()

disable() 

Disable the rate limiter.

This is meant to allow you to perform requests in bursts, but me mindful of reddit's rate limits and your program's structure. https://github.com/reddit/reddit/wiki/API

setInterval()

setInterval(integer|float  $interval) 

Set the rate limiter to wait the specified number of seconds past the previous API call to make the next one.

If this time has already elapsed during execution of other parts of the program, no wait is needed.

Parameters

integer|float $interval

Number of seconds that must elapse between each API call.

wait()

wait() 

Used by Phapper object to wait until another API call can be made.