(int $httpCode, array $responseData)
| 285 | } |
| 286 | |
| 287 | private function getHttpErrorMessage(int $httpCode, array $responseData): string { |
| 288 | if ($httpCode === 401) { |
| 289 | return $this->l10n->t('Missing or invalid GitHub access token'); |
| 290 | } |
| 291 | if ($httpCode === 403) { |
| 292 | $message = $this->getGithubErrorMessage($responseData); |
| 293 | if ($message !== '' && stripos($message, 'rate limit') === false) { |
| 294 | return 'GitHub API error: ' . $message; |
| 295 | } |
| 296 | |
| 297 | return $this->l10n->t('Rate limit exceeded'); |
| 298 | } |
| 299 | if ($httpCode === 0) { |
| 300 | return $this->l10n->t('Report not available'); |
| 301 | } |
| 302 | |
| 303 | return 'HTTP response code: ' . $httpCode; |
| 304 | } |
| 305 | |
| 306 | private function getGithubErrorMessage(array $responseData): string { |
| 307 | if (isset($responseData['message']) && is_string($responseData['message'])) { |
no test coverage detected