CouldNotSendNotification   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A missingFrom() 0 3 1
A invalidMessageObject() 0 7 2
A invalidFrom() 0 3 1
A invalidReceiver() 0 3 1
1
<?php
2
3
namespace NotificationChannels\Sendberry\Exceptions;
4
5
use NotificationChannels\Sendberry\SendberryMessage;
6
use Exception;
7
8
class CouldNotSendNotification extends Exception
9
{
10
    /**
11
     * @return static
12
     */
13
    public static function invalidFrom()
14
    {
15
        return new static('Notification was not sent.Invalid `from` number.');
16
    }
17
18
    public static function missingFrom()
19
    {
20
        return new static('Notification was not sent. Missing `from` number.');
21
    }
22
23
    /**
24
     * @return CouldNotSendNotification
25
     */
26
    public static function invalidReceiver()
27
    {
28
        return new static("The notifiable did not have a receiving phone number. Add a <routeNotificationForSmsru>
29
            method or a <phone> attribute to your notifiable.");
30
    }
31
32
    public static function invalidMessageObject($message)
33
    {
34
        $className = get_class($message) ?: 'Unknown';
35
36
        return new static(
37
            "Notification was not sent. Message object class `{$className}` is invalid. It should
38
            be either `".SendberryMessage::class);
39
    }
40
}
41