Skip to content

Commit ca3a663

Browse files
authored
Merge pull request #1 from GrahamCampbell/patch-1
Fix getApiLimit in a way that variables only have one type
2 parents d2d0fa6 + d6ab64a commit ca3a663

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Github/HttpClient/Message/ResponseMediator.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ public static function getPagination(ResponseInterface $response)
5656
*/
5757
public static function getApiLimit(ResponseInterface $response)
5858
{
59-
$remainingCalls = self::getHeader($response, 'X-RateLimit-Remaining');
59+
$remainingCallsHeader = self::getHeader($response, 'X-RateLimit-Remaining');
6060

61-
if (null !== $remainingCalls && 1 > $remainingCalls) {
61+
if (null === $remainingCallsHeader) {
62+
return null;
63+
}
64+
65+
$remainingCalls = (int) $remainingCallsHeader;
66+
67+
if (1 > $remainingCalls) {
6268
throw new ApiLimitExceedException((int) $remainingCalls);
6369
}
6470

0 commit comments

Comments
 (0)