Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
41 | 2 | protected function handleRateLimitException(ClientException $e) |
|
42 | { |
||
43 | 2 | if ($e->getResponse()->getHeader(self::HEADER_RATE_LIMIT_TYPE)[0] === self::RATE_LIMIT_TYPE_USER) { |
|
44 | 1 | $exception = new UserRateLimitException(); |
|
45 | 1 | } else { |
|
46 | 1 | $exception = new ServiceRateLimitException(); |
|
47 | } |
||
48 | |||
49 | return $exception |
||
50 | 2 | ->setClientException($e) |
|
51 | 2 | ->setRetryAfter($e->getResponse()->getHeader(self::HEADER_RETRY_AFTER)[0]); |
|
52 | } |
||
53 | } |
||
54 |