-
-
Notifications
You must be signed in to change notification settings - Fork 598
Closed
Description
Hi,
$response = $client->getHttpClient()->getLastResponse();
var_dump($response);
// Guzzle\Http\Message\Response {#163 ...
Then:
var_dump(ResponseMediator::getApiLimit($response));
outputs:
PHP Notice: Object of class Guzzle\Http\Message\Header could not be converted to int in /My/Path/To/Acme/vendor/knplabs/github-api/lib/Github/HttpClient/Message/ResponseMediator.php on line 46
https://github.com/KnpLabs/php-github-api/blob/master/lib/Github/HttpClient/Message/ResponseMediator.php
public static function getApiLimit(Response $response)
{
$remainingCalls = $response->getHeader('X-RateLimit-Remaining');
if (null !== $remainingCalls && 1 > $remainingCalls) {
throw new ApiLimitExceedException($remainingCalls);
}
return $remainingCalls;
}
if (null !== $remainingCalls && 1 > $remainingCalls)
the php notice comes from the 1 > $remainingCalls
.
Metadata
Metadata
Assignees
Labels
No labels