(int $httpCode, array $responseData)
| 272 | } |
| 273 | |
| 274 | private function getHttpErrorMessage(int $httpCode, array $responseData): string { |
| 275 | if ($httpCode === 401) { |
| 276 | return $this->l10n->t('Missing or invalid GitHub access token'); |
| 277 | } |
| 278 | if ($httpCode === 403) { |
| 279 | $message = $this->getGithubErrorMessage($responseData); |
| 280 | if ($message !== '' && stripos($message, 'rate limit') === false) { |
| 281 | return 'GitHub API error: ' . $message; |
| 282 | } |
| 283 | |
| 284 | return $this->l10n->t('Rate limit exceeded'); |
| 285 | } |
| 286 | if ($httpCode === 0) { |
| 287 | return $this->l10n->t('Report not available'); |
| 288 | } |
| 289 | |
| 290 | return 'HTTP response code: ' . $httpCode; |
| 291 | } |
| 292 | |
| 293 | private function getGithubErrorMessage(array $responseData): string { |
| 294 | if (isset($responseData['message']) && is_string($responseData['message'])) { |
no test coverage detected