1 | <?php |
||
5 | class LimitedApiRate implements ApiRate |
||
6 | { |
||
7 | /** @var int */ |
||
8 | private $limit; |
||
9 | |||
10 | /** @var int */ |
||
11 | private $remaining; |
||
12 | |||
13 | /** @var \DateTimeInterface */ |
||
14 | private $reset; |
||
15 | |||
16 | /** |
||
17 | * LimitedApiRate constructor. |
||
18 | * |
||
19 | * @param int $limit |
||
20 | * @param int $remaining |
||
21 | * @param int $reset |
||
22 | */ |
||
23 | 9 | public function __construct( |
|
36 | |||
37 | /** |
||
38 | * @return int |
||
39 | */ |
||
40 | 6 | public function getLimit() |
|
41 | { |
||
42 | 6 | return $this->limit; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return bool |
||
47 | */ |
||
48 | 6 | public function canMakeAnotherCall() |
|
49 | { |
||
50 | 6 | return $this->remaining > 0; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return \DateTimeInterface |
||
55 | */ |
||
56 | 9 | public function nextWindow() |
|
60 | } |
||
61 |