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.

CouldNotSendNotification   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 37
ccs 2
cts 8
cp 0.25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A msTeamsRespondedWithAnError() 0 7 1
A couldNotCommunicateWithMsTeams() 0 4 1
A connectorWebHookUrlMissing() 0 4 1
1
<?php
2
3
namespace NotificationChannels\MsTeams\Exceptions;
4
5
use GuzzleHttp\Exception\ClientException;
6
7
class CouldNotSendNotification extends \Exception
8
{
9
    /**
10
     * Thrown when there's a bad request and an error is responded.
11
     *
12
     * @param ClientException $exception
13
     *
14
     * @return static
15
     */
16
    public static function msTeamsRespondedWithAnError(ClientException $exception)
17
    {
18
        $statusCode = $exception->getResponse()->getStatusCode();
19
        $description = $exception->getMessage();
20
21
        return new static("Ms Teams responded with an error `{$statusCode} - {$description}`");
22
    }
23
24
    /**
25
     * Thrown when we're unable to communicate with Ms Teams.
26
     *
27
     * @return static
28
     */
29
    public static function couldNotCommunicateWithMsTeams($message)
30
    {
31
        return new static("The communication with Ms Teams failed. `{$message}`");
32
    }
33
34
    /**
35
     * Thrown when there is no chat id provided.
36
     *
37
     * @return static
38
     */
39 1
    public static function connectorWebHookUrlMissing()
40
    {
41 1
        return new static('Ms Teams a webhook url is missing.');
42
    }
43
}
44