CouldNotSendNotification::invalidFrom()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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