| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)] |
||
| 14 | class RateLimit |
||
| 15 | { |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param int $period The number of seconds in which the limit is applied. (in milliseconds) |
||
| 19 | * @param int $rate The number of requests allowed in the period. |
||
| 20 | */ |
||
| 21 | public function __construct(protected int $period, protected int $rate) |
||
| 23 | |||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return int |
||
| 28 | */ |
||
| 29 | public function getPeriod(): int |
||
| 30 | { |
||
| 31 | return $this->period; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return int |
||
| 36 | */ |
||
| 37 | public function getRate(): int |
||
| 40 | } |
||
| 41 | |||
| 42 | } |