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.

DiscordIdentityProviderException::fromResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the wohali/oauth2-discord-new library
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright Copyright (c) Joan Touzet <[email protected]>
9
 * @license http://opensource.org/licenses/MIT MIT
10
 * @link https://packagist.org/packages/wohali/oauth2-discord-new Packagist
11
 * @link https://github.com/wohali/oauth2-discord-new GitHub
12
 */
13
14
namespace Wohali\OAuth2\Client\Provider\Exception;
15
16
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
17
use Psr\Http\Message\ResponseInterface;
18
19
class DiscordIdentityProviderException extends IdentityProviderException
20
{
21
    /**
22
     * Creates client exception from response
23
     *
24
     * @param  ResponseInterface $response
25
     * @param  array $data Parsed response data
26
     *
27
     * @return IdentityProviderException
28
     */
29 3
    public static function clientException(ResponseInterface $response, $data)
30
    {
31 3
        return static::fromResponse(
32 3
            $response,
33 3
            isset($data['message']) ? $data['message'] : json_encode($data)
34 1
        );
35
    }
36
37
    /**
38
     * Creates identity exception from response
39
     *
40
     * @param  ResponseInterface $response
41
     * @param  string $message
42
     *
43
     * @return IdentityProviderException
44
     */
45 3
    protected static function fromResponse(ResponseInterface $response, $message = null)
46
    {
47 3
        return new static($message, $response->getStatusCode(), (string) $response->getBody());
48
    }
49
}
50