1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NotificationChannels\Facebook\Exceptions; |
4
|
|
|
|
5
|
|
|
use Exception; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class CouldNotCreateMessage. |
9
|
|
|
*/ |
10
|
|
|
class CouldNotCreateMessage extends Exception |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Thrown when the message text is not provided. |
14
|
|
|
* |
15
|
|
|
* @return static |
16
|
|
|
*/ |
17
|
|
|
public static function textTooLong(): self |
18
|
|
|
{ |
19
|
|
|
return new static('Message text is too long, A 320 character limited string should be provided.'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Thrown when invalid notification type provided. |
24
|
|
|
* |
25
|
|
|
* @return static |
26
|
|
|
*/ |
27
|
|
|
public static function invalidNotificationType(): self |
28
|
|
|
{ |
29
|
|
|
return new static('Notification Type provided is invalid.'); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Thrown when invalid attachment type provided. |
34
|
|
|
* |
35
|
|
|
* @return static |
36
|
|
|
*/ |
37
|
|
|
public static function invalidAttachmentType(): self |
38
|
|
|
{ |
39
|
|
|
return new static('Attachment Type provided is invalid.'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Thrown when a URl should be provided for an attachment. |
44
|
|
|
* |
45
|
|
|
* @return static |
46
|
|
|
*/ |
47
|
|
|
public static function urlNotProvided(): self |
48
|
|
|
{ |
49
|
|
|
return new static('You have not provided a Url for an attachment'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Thrown when enough data is not provided. |
54
|
|
|
* |
55
|
|
|
* @return static |
56
|
|
|
*/ |
57
|
|
|
public static function dataNotProvided(): self |
58
|
|
|
{ |
59
|
|
|
return new static('Your message was missing critical information'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Thrown when number of buttons in message exceeds. |
64
|
|
|
* |
65
|
|
|
* @return static |
66
|
|
|
*/ |
67
|
|
|
public static function messageButtonsLimitExceeded(): self |
68
|
|
|
{ |
69
|
|
|
return new static('You cannot add more than 3 buttons in 1 notification message.'); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Thrown when number of cards in message exceeds. |
74
|
|
|
* |
75
|
|
|
* @return static |
76
|
|
|
*/ |
77
|
|
|
public static function messageCardsLimitExceeded(): self |
78
|
|
|
{ |
79
|
|
|
return new static('You cannot add more than 10 cards in 1 notification message.'); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Thrown when there is no user id or phone number provided. |
84
|
|
|
* |
85
|
|
|
* @return static |
86
|
|
|
*/ |
87
|
|
|
public static function recipientNotProvided(): self |
88
|
|
|
{ |
89
|
|
|
return new static('Facebook notification recipient ID or Phone Number was not provided. Please refer usage docs.'); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|