Skip to content

Commit a364bae

Browse files
authored
Merge pull request #2 from socketlabs/SendResultModification
Changed SendResult constants from number to string
2 parents 1be5a39 + 234256a commit a364bae

File tree

1 file changed

+37
-50
lines changed

1 file changed

+37
-50
lines changed

InjectionApi/src/SendResult.php

Lines changed: 37 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,187 +8,187 @@ abstract class SendResult{
88
/**
99
* An error has occured that was unforeseen
1010
*/
11-
const UnknownError = 0;
11+
const UnknownError = "UnknownError";
1212

1313
/**
1414
* A timeout occurred sending the message
1515
*/
16-
const Timeout = 1;
16+
const Timeout = "Timeout";
1717

1818
/**
1919
* Successful send of message
2020
*/
21-
const Success = 2;
21+
const Success = "Success";
2222

2323
/**
2424
* Warnings were found while sending the message
2525
*/
26-
const Warning = 3;
26+
const Warning = "Warning";
2727

2828
/**
2929
* Internal server error
3030
*/
31-
const InternalError = 4;
31+
const InternalError = "InternalError";
3232

3333
/**
3434
* Message size has exceeded the size limit
3535
*/
36-
const MessageTooLarge = 5;
36+
const MessageTooLarge = "MessageTooLarge";
3737

3838
/**
3939
* Message exceeded maximum recipient count in the message
4040
*/
41-
const TooManyRecipients = 6;
41+
const TooManyRecipients = "TooManyRecipients";
4242

4343
/**
4444
* Invalid data was found on the message
4545
*/
46-
const InvalidData = 7;
46+
const InvalidData = "InvalidData";
4747

4848
/**
4949
* The account is over the send quota, rate limit exceeded
5050
*/
51-
const OverQuota = 8;
51+
const OverQuota = "OverQuota";
5252

5353
/**
5454
* Too many errors occurred sending the message
5555
*/
56-
const TooManyErrors = 9;
56+
const TooManyErrors = "TooManyErrors";
5757

5858
/**
5959
* The ServerId/ApiKey combination is invalid
6060
*/
61-
const InvalidAuthentication = 10;
61+
const InvalidAuthentication = "InvalidAuthentication";
6262

6363
/**
6464
* The account has been disabled
6565
*/
66-
const AccountDisabled = 11;
66+
const AccountDisabled = "AccountDisabled";
6767

6868
/**
6969
* Too many messages were found in the request
7070
*/
71-
const TooManyMessages = 12;
71+
const TooManyMessages = "TooManyMessages";
7272

7373
/**
7474
* No valid recipients were found in the message
7575
*/
76-
const NoValidRecipients = 13;
76+
const NoValidRecipients = "NoValidRecipients";
7777

7878
/**
7979
* An invalid recipient were found on the message
8080
*/
81-
const InvalidAddress = 14;
81+
const InvalidAddress = "InvalidAddress";
8282

8383
/**
8484
* An invalid attachment were found on the message
8585
*/
86-
const InvalidAttachment = 15;
86+
const InvalidAttachment = "InvalidAttachment";
8787

8888
/**
8989
* No message body was found in the message
9090
*/
91-
const NoMessages = 16;
91+
const NoMessages = "NoMessages";
9292

9393
/**
9494
* No message body was found in the message
9595
*/
96-
const EmptyMessage = 17;
96+
const EmptyMessage = "EmptyMessage";
9797

9898
/**
9999
* No subject was found in the message
100100
*/
101-
const EmptySubject = 18;
101+
const EmptySubject = "EmptySubject";
102102

103103
/**
104104
* An invalid from address was found on the message
105105
*/
106-
const InvalidFrom = 19;
106+
const InvalidFrom = "InvalidFrom";
107107

108108
/**
109109
* No To addresses were found in the message
110110
*/
111-
const EmptyToAddress = 20;
111+
const EmptyToAddress = "EmptyToAddress";
112112

113113
/**
114114
* No valid message body was found in the message
115115
*/
116-
const NoValidBodyParts = 21;
116+
const NoValidBodyParts = "NoValidBodyParts";
117117

118118
/**
119119
* An invalid TemplateId was found in the message
120120
*/
121-
const InvalidTemplateId = 22;
121+
const InvalidTemplateId = "InvalidTemplateId";
122122

123123
/**
124124
* The specified TemplateId has no content for the message
125125
*/
126-
const TemplateHasNoContent = 23;
126+
const TemplateHasNoContent = "TemplateHasNoContent";
127127

128128
/**
129129
* A conflict occurred on the message body of the message
130130
*/
131-
const MessageBodyConflict = 24;
131+
const MessageBodyConflict = "MessageBodyConflict";
132132

133133
/**
134134
* Invalid MergeData was found on the message
135135
*/
136-
const InvalidMergeData = 25;
136+
const InvalidMergeData = "InvalidMergeData";
137137

138138
/**
139139
* Authentication Error, Missing or invalid ServerId or ApiKey
140140
*/
141-
const AuthenticationValidationFailed = 26;
141+
const AuthenticationValidationFailed = "AuthenticationValidationFailed";
142142

143143
/**
144144
* From email address is missing in the message
145145
*/
146-
const EmailAddressValidationMissingFrom = 27;
146+
const EmailAddressValidationMissingFrom = "EmailAddressValidationMissingFrom";
147147

148148
/**
149149
* From email address in the message in invalid
150150
*/
151-
const EmailAddressValidationInvalidFrom = 28;
151+
const EmailAddressValidationInvalidFrom = "EmailAddressValidationInvalidFrom";
152152

153153
/**
154154
* Message exceeded maximum recipient count in the message
155155
*/
156-
const RecipientValidationMaxExceeded = 29;
156+
const RecipientValidationMaxExceeded = "RecipientValidationMaxExceeded";
157157

158158
/**
159159
* No recipients were found in the message
160160
*/
161-
const RecipientValidationNoneInMessage = 30;
161+
const RecipientValidationNoneInMessage = "RecipientValidationNoneInMessage";
162162

163163
/**
164164
* To addresses are missing in the message
165165
*/
166-
const RecipientValidationMissingTo = 31;
166+
const RecipientValidationMissingTo = "RecipientValidationMissingTo";
167167

168168
/**
169169
* Invalid ReplyTo address found
170170
*/
171-
const RecipientValidationInvalidReplyTo = 32;
171+
const RecipientValidationInvalidReplyTo = "RecipientValidationInvalidReplyTo";
172172

173173
/**
174174
* Invalid recipients found
175175
*/
176-
const RecipientValidationInvalidRecipients = 33;
176+
const RecipientValidationInvalidRecipients = "RecipientValidationInvalidRecipients";
177177

178178
/**
179179
* No subject was found in the message
180180
*/
181-
const MessageValidationEmptySubject = 34;
181+
const MessageValidationEmptySubject = "MessageValidationEmptySubject";
182182

183183
/**
184184
* No message body was found in the message
185185
*/
186-
const MessageValidationEmptyMessage = 35;
186+
const MessageValidationEmptyMessage = "MessageValidationEmptyMessage";
187187

188188
/**
189189
* Invalid custom headers found
190190
*/
191-
const MessageValidationInvalidCustomHeaders = 36;
191+
const MessageValidationInvalidCustomHeaders = "MessageValidationInvalidCustomHeaders";
192192

193193
/**
194194
* Get a value for a given name
@@ -204,17 +204,4 @@ public static function get_const($name) {
204204
return false;
205205
}
206206
}
207-
208-
/**
209-
* Get the name for a given value
210-
* @param $value
211-
* @return string
212-
*/
213-
public static function get_name($value)
214-
{
215-
$class = new ReflectionClass(__CLASS__);
216-
$constants = array_flip($class->getConstants());
217-
218-
return $constants[$value];
219-
}
220207
}

0 commit comments

Comments
 (0)