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

CouldNotSendNotification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 17
ccs 0
cts 13
cp 0
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
    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