Completed
Push — master ( 77d207...af47af )
by Atymic
05:06
created

CouldNotSendNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidMessageObject() 0 6 2
A invalidReceiver() 0 4 1
1
<?php
2
3
namespace NotificationChannels\AwsSns\Exceptions;
4
5
use NotificationChannels\AwsSns\SnsMessage;
6
7
class CouldNotSendNotification extends \Exception
8
{
9
    /**
10
     * @return static
11
     */
12 1
    public static function invalidReceiver()
13
    {
14 1
        return new static(
15 1
            'The notifiable did not have a receiving phone number. Add a routeNotificationForSns
16
            method or one of the conventional attributes to your notifiable.'
17
        );
18
    }
19
20
    /**
21
     * @param mixed $message
22
     *
23
     * @return static
24
     */
25 1
    public static function invalidMessageObject($message)
26
    {
27 1
        $type = is_object($message) ? get_class($message) : gettype($message);
28
29 1
        return new static(
30 1
            'Notification was not sent. The message should be a instance of `'.SnsMessage::class."` and a `{$type}` was given."
31
        );
32
    }
33
}
34