ZonerSmsGatewayException::unexpectedHttpStatus()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NotificationChannels\ZonerSmsGateway\Exceptions;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
class ZonerSmsGatewayException extends \Exception
8
{
9 1
    public static function serviceRespondedWithAnError($code)
10
    {
11 1
        return new static("Zoner SMS-Gateway returned error code $code", $code);
12
    }
13
14
    public static function unexpectedHttpStatus(ResponseInterface $response)
15
    {
16
        return new static('Zoner SMS-Gateway returned HTTP status '.$response->getStatusCode());
17
    }
18
19
    public static function usernameNotProvided()
20
    {
21
        return new static('You must provide your Zoner SMS-Gateway username to make any API requests.');
22
    }
23
24
    public static function receiverNotProvided()
25
    {
26
        return new static('Receiver number not defined.');
27
    }
28
29
    public static function senderNotProvided()
30
    {
31
        return new static('Sender number not defined.');
32
    }
33
34
    public static function emptyMessage()
35
    {
36
        return new static('Message is empty.');
37
    }
38
39
    public static function unknownZonerResponse($response)
40
    {
41
        return new static("Zoner SMS-Gateway returned unknown response: $response");
42
    }
43
}
44