| 1 | <?php |
||
| 8 | class ThrottleConfiguration implements RequestMatcherInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var RequestMatcherInterface |
||
| 12 | */ |
||
| 13 | private $requestMatcher; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var int |
||
| 17 | */ |
||
| 18 | private $maxRequests; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var float |
||
| 22 | */ |
||
| 23 | private $duration; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | private $storageKey; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * ThrottleConfiguration constructor. |
||
| 32 | * @param RequestMatcherInterface $requestMatcher |
||
| 33 | * @param int $maxRequests |
||
| 34 | * @param float $duration |
||
| 35 | * @param string $storageKey |
||
| 36 | */ |
||
| 37 | public function __construct(RequestMatcherInterface $requestMatcher, int $maxRequests, float $duration, string $storageKey) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @inheritdoc |
||
| 47 | */ |
||
| 48 | public function matchRequest(RequestInterface $request) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return int |
||
| 55 | */ |
||
| 56 | public function getMaxRequests(): int |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return float |
||
| 63 | */ |
||
| 64 | public function getDuration(): float |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | public function getStorageKey(): string |
||
| 76 | } |
||
| 77 |