Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
9 | public function isRateLimitExceed() |
||
10 | { |
||
11 | $timeNow = microtime(true); |
||
12 | |||
13 | // is key not exists |
||
14 | if(!isset($this->keyList[$this->key])) { |
||
15 | return false; |
||
16 | } |
||
17 | |||
18 | // is in time slot |
||
19 | if($this->keyList[$this->key]['expired'] < $timeNow) { |
||
20 | return false; |
||
21 | } |
||
22 | |||
23 | // is requests limit reached |
||
24 | return $this->keyList[$this->key]['requestNum'] >= $this->requestNum; |
||
25 | } |
||
26 | |||
37 | } |