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.

facebookPageTokenNotProvided()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NotificationChannels\Facebook\Exceptions;
4
5
use Exception;
6
use GuzzleHttp\Exception\ClientException;
7
8
/**
9
 * Class CouldNotSendNotification.
10
 */
11
class CouldNotSendNotification extends Exception
12
{
13
    /**
14
     * Thrown when there's a bad request and an error is responded.
15
     *
16
     * @param  ClientException  $exception
17
     *
18
     * @return static
19
     */
20
    public static function facebookRespondedWithAnError(ClientException $exception): self
21
    {
22
        if ($exception->hasResponse()) {
23
            $result = json_decode($exception->getResponse()->getBody(), false);
24
25
            return new static("Facebook responded with an error `{$result->error->code} - {$result->error->type} {$result->error->message}`");
26
        }
27
28
        return new static('Facebook responded with an error');
29
    }
30
31
    /**
32
     * Thrown when there's no page token provided.
33
     *
34
     * @param  string  $message
35
     *
36
     * @return static
37
     */
38
    public static function facebookPageTokenNotProvided(string $message): self
39
    {
40
        return new static($message);
41
    }
42
43
    /**
44
     * Thrown when we're unable to communicate with Telegram.
45
     *
46
     * @param  Exception  $exception
47
     *
48
     * @return static
49
     */
50
    public static function couldNotCommunicateWithFacebook(Exception $exception): self
51
    {
52
        return new static('The communication with Facebook failed. Reason: '.$exception->getMessage());
53
    }
54
}
55