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