CouldNotSendNotification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 4
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serviceRespondedWithAnError() 0 3 1
A invalidReceiver() 0 3 1
1
<?php
2
3
namespace NotificationChannels\AfricasTalking\Exceptions;
4
5
use Exception;
6
7
class CouldNotSendNotification extends Exception
8
{
9
    /**
10
     * @param  string  $error
11
     * @return CouldNotSendNotification
12
     */
13
    public static function serviceRespondedWithAnError(string $error): self
14
    {
15
        return new static("AfricasTalking service responded with an error: {$error}");
16
    }
17
18
    public static function invalidReceiver(): self
19
    {
20
        return new static('The notifiable did not have a receiving phone number. Add a routeNotificationForAfricasTalking
21
            method or a phone_number attribute to your notifiable.');
22
    }
23
}
24