CouldNotSendNotification::connectionFailed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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