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 ( b935a0...4818bb )
by Irfaq
01:59
created

CouldNotSendNotification::recipientNotProvided()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
     * Thrown when number of buttons in message exceeds.
50
     *
51
     * @return static
52
     */
53
    public static function messageButtonsLimitExceeded()
54
    {
55
        return new static('You cannot add more than 3 buttons in 1 notification message.');
56
    }
57
58
    /**
59
     * Thrown when there is no user id or phone number provided.
60
     *
61
     * @return static
62
     */
63
    public static function recipientNotProvided()
64
    {
65
        return new static('Facebook notification recipient ID or Phone Number was not provided. Please refer usage docs.');
66
    }
67
}
68