| @@ 105-112 (lines=8) @@ | ||
| 102 | * @access public |
|
| 103 | * @return integer |
|
| 104 | */ |
|
| 105 | public function getRateLimit() |
|
| 106 | { |
|
| 107 | $header = $this->request->getHeaders(); |
|
| 108 | if (is_array($header)) { |
|
| 109 | $header = array_change_key_case($header, CASE_LOWER); |
|
| 110 | } |
|
| 111 | return (isset($header['x-ratelimit-limit']) ? $header['x-ratelimit-limit'] : 1000); |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Get rate limit remaining from the headers |
|
| @@ 120-127 (lines=8) @@ | ||
| 117 | * @access public |
|
| 118 | * @return mixed |
|
| 119 | */ |
|
| 120 | public function getRateLimitRemaining() |
|
| 121 | { |
|
| 122 | $header = $this->request->getHeaders(); |
|
| 123 | if (is_array($header)) { |
|
| 124 | $header = array_change_key_case($header, CASE_LOWER); |
|
| 125 | } |
|
| 126 | return (isset($header['x-ratelimit-remaining']) ? $header['x-ratelimit-remaining'] : 'unknown'); |
|
| 127 | } |
|
| 128 | } |
|
| 129 | ||