Completed
Push — master ( 953e3f...307f6c )
by Simon
03:54 queued 02:56
created

CouldNotSendNotification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A noRecipient() 0 4 1
A connectionFailed() 0 6 1
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 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