Completed
Push — master ( d834aa...40bc03 )
by antikainen
01:56
created

CouldNotSendNotification   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 16.66%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 32
ccs 2
cts 12
cp 0.1666
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A serviceRespondedWithAnError() 0 4 1
A unexpectedHttpStatus() 0 4 1
A usernameNotProvided() 0 4 1
A receiverNotProvided() 0 4 1
A senderNotProvided() 0 4 1
A emptyMessage() 0 4 1
1
<?php
2
3
namespace NotificationChannels\ZonerSmsGateway\Exceptions;
4
5
class CouldNotSendNotification extends \Exception
6
{
7 1
    public static function serviceRespondedWithAnError($code)
8
    {
9 1
        return new static("Zoner SMS-Gateway returned error code $code", $code);
10
    }
11
12
    public static function unexpectedHttpStatus($response)
13
    {
14
        return new static('Zoner SMS-Gateway returned HTTP status '.$response->getStatusCode());
15
    }
16
17
    public static function usernameNotProvided()
18
    {
19
        return new static('You must provide your Zoner SMS-Gateway username to make any API requests.');
20
    }
21
22
    public static function receiverNotProvided()
23
    {
24
        return new static('Receiver number not defined.');
25
    }
26
27
    public static function senderNotProvided()
28
    {
29
        return new static('Sender number not defined.');
30
    }
31
32
    public static function emptyMessage()
33
    {
34
        return new static('Message is empty.');
35
    }
36
}
37