| 1 | <?php |
||
| 5 | class Throttler { |
||
| 6 | |||
| 7 | /** |
||
| 8 | * @var float|null |
||
| 9 | */ |
||
| 10 | private $lastTime = null; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * interval to wait in seconds, can be float |
||
| 14 | * |
||
| 15 | * @var float |
||
| 16 | */ |
||
| 17 | private $interval; |
||
| 18 | |||
| 19 | 3 | public function __construct($interval) { |
|
| 22 | |||
| 23 | 5 | public function waitForThrottle() { |
|
| 38 | |||
| 39 | private static $instances = []; |
||
| 40 | |||
| 41 | 65 | public static function getInstance($key, $interval) { |
|
| 48 | } |
||
| 49 |