GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 42533c...5611c9 )
by Dragos
13:44
created

ApiKeyInvalidException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A forResponse() 0 8 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Speicher210\KontaktIO\Exception;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Speicher210\KontaktIO\Model\ApiErrorResponse;
9
10
/**
11
 * Exception thrown whe the API key is not valid or not having enough permissions.
12
 */
13
final class ApiKeyInvalidException extends ApiException
14
{
15
    /**
16
     * @param ResponseInterface $response The API response.
17
     * @return ApiKeyInvalidException
18
     */
19
    public static function forResponse(ResponseInterface $response): ApiKeyInvalidException
20
    {
21
        $apiErrorResponse = new ApiErrorResponse();
22
        $apiErrorResponse->setStatus($response->getStatusCode());
23
        $apiErrorResponse->setMessage($response->getReasonPhrase());
24
25
        return new static($apiErrorResponse);
26
    }
27
}
28