Test Failed
Pull Request — master (#2)
by Talha Zekeriya
19:57 queued 09:46
created

CouldNotSendNotification   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 8
c 1
b 0
f 0
dl 0
loc 35
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidMessageContent() 0 3 1
A emptyRecipients() 0 3 1
A invalidHeader() 0 3 1
A invalidRequest() 0 3 1
A serviceRespondedWithAnError() 0 3 1
A invalidResponse() 0 3 1
A unknownError() 0 3 1
1
<?php
2
3
namespace NotificationChannels\NetGsm\Exceptions;
4
5
class CouldNotSendNotification extends \Exception
6
{
7
    public static function serviceRespondedWithAnError(\Exception $exception)
8
    {
9
        return new static("NetGsm service responded with an error '{$exception->getCode()}: {$exception->getMessage()}'");
10
    }
11
12
    public static function emptyRecipients()
13
    {
14
        return new static('In order to send notification via NetGsm you need to add some recipients.');
15
    }
16
17
    public static function invalidResponse()
18
    {
19
        return new static('Invalid response from NetGSM server.');
20
    }
21
22
    public static function invalidMessageContent()
23
    {
24
        return new static('Invalid message content.');
25
    }
26
27
    public static function invalidHeader()
28
    {
29
        return new static('Invalid message header.');
30
    }
31
32
    public static function invalidRequest()
33
    {
34
        return new static('Invalid request.');
35
    }
36
37
    public static function unknownError()
38
    {
39
        return new static('Unknown Error.');
40
    }
41
}
42