CouldNotSendNotification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A connectionFailed() 0 4 1
A noRecipient() 0 3 1
1
<?php
2
3
namespace NotificationChannels\Sipgate\Exceptions;
4
5
use Exception;
6
use GuzzleHttp\Exception\GuzzleException;
7
8
class CouldNotSendNotification extends Exception
9
{
10
    const NO_RECIPIENT = 'Could not find recipient for notification';
11
    const CONNECTION_FAILED = 'Could not connect to sipgate: %s: %s';
12
13 1
    public static function noRecipient()
14
    {
15 1
        return new static(self::NO_RECIPIENT);
16
    }
17
18 1
    public static function connectionFailed(GuzzleException $exception)
19
    {
20 1
        return new static(
21 1
            sprintf(self::CONNECTION_FAILED, $exception->getCode(), $exception->getMessage())
22
        );
23
    }
24
}
25