Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RateLimitExceededException issue #862

Open
gitstashgithub opened this issue Jul 17, 2022 · 0 comments
Open

RateLimitExceededException issue #862

gitstashgithub opened this issue Jul 17, 2022 · 0 comments

Comments

@gitstashgithub
Copy link

Hi guys,

In src/XeroPHP/Remote/Exception/RateLimitExceededException.php file createFromHeaders() function,

    public static function createFromHeaders($headers)
    {
        $headers = array_change_key_case($headers, CASE_LOWER);

        $problem = isset($headers['x-rate-limit-problem']) ? current($headers['x-rate-limit-problem']) : null;
        $retryAfter = isset($headers['retry-after']) ? current($headers['retry-after']) : null;

        $exception = new self();
        $exception->setRateLimitProblem($problem);
        $exception->setRetryAfter($retryAfter);

        return $exception;
    }

I don't understand why the current() function is being used to get $headers['x-rate-limit-problem'] value. Is it supposed to be an array or object? I thought it's a string value like Day or Minute. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant