Completed
Push — master ( 5691d5...040ff4 )
by Simon
08:26
created

CouldNotSendNotification::noSmsId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Simonkub\Laravel\Notifications\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
    public static function noRecipient()
14
    {
15
        return new static(self::NO_RECIPIENT);
16
    }
17
18
    public static function connectionFailed(GuzzleException $exception)
19
    {
20
        return new static(
21
            sprintf(self::CONNECTION_FAILED, $exception->getCode(), $exception->getMessage())
22
        );
23
    }
24
}
25