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
Pull Request — master (#10)
by
unknown
02:43
created

CouldNotSendNotification::recipientNotProvided()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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