Conditions | 1 |
Paths | 1 |
Total Lines | 103 |
Code Lines | 68 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
95 | private function getErrors(): array |
||
96 | { |
||
97 | $errors = []; |
||
98 | $errors[1]['title'] = 'INVALID_RECIPIENT_NUMBER'; |
||
99 | $errors[1]['desc'] = 'the string you presented as recipient numbers are not valid phone numbers, please check them again'; |
||
100 | |||
101 | $errors[2]['title'] = 'INVALID_SENDER_NUMBER'; |
||
102 | $errors[2]['desc'] = 'the string you presented as sender numbers(3000-xxx) are not valid numbers, please check them again'; |
||
103 | |||
104 | $errors[3]['title'] = 'INVALID_ENCODING'; |
||
105 | $errors[3]['desc'] = 'are You sure You\'ve entered the right encoding for this message? You can try other encodings to bypass this error code'; |
||
106 | |||
107 | $errors[4]['title'] = 'INVALID_MESSAGE_CLASS'; |
||
108 | $errors[4]['desc'] = 'entered MessageClass is not valid. for a normal MClass, leave this entry empty'; |
||
109 | |||
110 | $errors[6]['title'] = 'INVALID_UDH'; |
||
111 | $errors[6]['desc'] = 'entered UDH is invalid. in order to send a simple message, leave this entry empty'; |
||
112 | |||
113 | $errors[12]['title'] = 'INVALID_ACCOUNT_ID'; |
||
114 | $errors[12]['desc'] = 'you\'re trying to use a service from another account??? check your UN/Password/NumberRange again'; |
||
115 | |||
116 | $errors[13]['title'] = 'NULL_MESSAGE'; |
||
117 | $errors[13]['desc'] = 'check the text of your message. it seems to be null'; |
||
118 | |||
119 | $errors[14]['title'] = 'CREDIT_NOT_ENOUGH'; |
||
120 | $errors[14]['desc'] = 'Your credit\'s not enough to send this message. you might want to buy some credit.call'; |
||
121 | |||
122 | $errors[15]['title'] = 'SERVER_ERROR'; |
||
123 | $errors[15]['desc'] = 'something bad happened on server side, you might want to call MAGFA Support about this:'; |
||
124 | |||
125 | $errors[16]['title'] = 'ACCOUNT_INACTIVE'; |
||
126 | $errors[16]['desc'] = 'Your account is not active right now, call -- to activate it'; |
||
127 | |||
128 | $errors[17]['title'] = 'ACCOUNT_EXPIRED'; |
||
129 | $errors[17]['desc'] = 'looks like Your account\'s reached its expiration time, call -- for more information'; |
||
130 | |||
131 | $errors[18]['title'] = 'INVALID_USERNAME_PASSWORD_DOMAIN'; // todo : note : one of them are empty |
||
132 | $errors[18]['desc'] = 'the combination of entered Username/Password/Domain is not valid. check\'em again'; |
||
133 | |||
134 | $errors[19]['title'] = 'AUTHENTICATION_FAILED'; // todo : note : wrong arguments supplied ... |
||
135 | $errors[19]['desc'] = 'You\'re not entering the correct combination of Username/Password'; |
||
136 | |||
137 | $errors[20]['title'] = 'SERVICE_TYPE_NOT_FOUND'; |
||
138 | $errors[20]['desc'] = 'check the service type you\'re requesting. we don\'t get what service you want to use. your sender number might be wrong, too.'; |
||
139 | |||
140 | $errors[22]['title'] = 'ACCOUNT_SERVICE_NOT_FOUND'; |
||
141 | $errors[22]['desc'] = 'your current number range does\'t have the permission to use Webservices'; |
||
142 | |||
143 | $errors[23]['title'] = 'SERVER_BUSY'; |
||
144 | $errors[23]['desc'] = 'Sorry, Server\'s under heavy traffic pressure, try testing another time please'; |
||
145 | |||
146 | $errors[24]['title'] = 'INVALID_MESSAGE_ID'; |
||
147 | $errors[24]['desc'] = 'entered message-id seems to be invalid, are you sure You entered the right thing?'; |
||
148 | |||
149 | $errors[25]['title'] = 'INVALID_METHOD_NAME'; |
||
150 | $errors[25]['desc'] = 'the method name call is invalid'; |
||
151 | |||
152 | $errors[27]['title'] = 'RECEIVER_NUMBER_IN_BLACK_LIST'; |
||
153 | $errors[27]['desc'] = 'the receiver number is in the black list'; |
||
154 | |||
155 | $errors[28]['title'] = 'PREFIX_RECEIVER_NUMBER_IS_BLOCKED'; |
||
156 | $errors[28]['desc'] = 'the receiver number is in the block list of magfa'; |
||
157 | |||
158 | $errors[29]['title'] = 'YOU_IP_ADDRESS_NOT_VALID'; |
||
159 | $errors[29]['desc'] = 'server ip address is not valid to use service'; |
||
160 | |||
161 | $errors[30]['title'] = 'LARGE_SMS_CONTENT'; |
||
162 | $errors[30]['desc'] = 'the sms content is more than 255 character'; |
||
163 | |||
164 | $errors[101]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_SIZE_NOT_EQUAL_MESSAGE_CLASS_ARRAY_BODIES'; |
||
165 | $errors[101]['desc'] = 'this happens when you try to define MClasses for your messages. in this case you must define one recipient number for each MClass'; |
||
166 | |||
167 | $errors[102]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_SIZE_NOT_EQUAL_MESSAGE_CLASS_ARRAY'; |
||
168 | $errors[102]['desc'] = 'this happens when you try to define MClasses for your messages. in this case you must define one recipient number for each MClass'; |
||
169 | |||
170 | $errors[103]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_SIZE_NOT_EQUAL_SENDER_NUMBER_ARRAY'; |
||
171 | $errors[103]['desc'] = 'This error happens when you have more than one sender-number for message. when you have more than one sender number, for each sender-number you must define a recipient number...'; |
||
172 | |||
173 | $errors[104]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_SIZE_NOT_EQUAL_MESSAGE_ARRAY'; |
||
174 | $errors[104]['desc'] = 'this happens when you try to define UDHs for your messages. in this case you must define one recipient number for each udh'; |
||
175 | |||
176 | $errors[105]['title'] = 'PRIORITIES_ARRAY_SIZE_NOT_EQUAL_RECEIVERS'; |
||
177 | $errors[105]['desc'] = 'priorities array size not equal receivers'; |
||
178 | |||
179 | $errors[106]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_IS_NULL'; |
||
180 | $errors[106]['desc'] = 'array of recipient numbers must have at least one member'; |
||
181 | |||
182 | $errors[107]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_TOO_LONG'; |
||
183 | $errors[107]['desc'] = 'the maximum number of recipients per message is 90'; |
||
184 | |||
185 | $errors[108]['title'] = 'WEB_SENDER_NUMBER_ARRAY_IS_NULL'; |
||
186 | $errors[108]['desc'] = 'array of sender numbers must have at least one member'; |
||
187 | |||
188 | $errors[109]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_SIZE_NOT_EQUAL_ENCODING_ARRAY'; |
||
189 | $errors[109]['desc'] = 'this happens when you try to define encodings for your messages. in this case you must define one recipient number for each Encoding'; |
||
190 | |||
191 | $errors[110]['title'] = 'WEB_RECIPIENT_NUMBER_ARRAY_SIZE_NOT_EQUAL_CHECKING_MESSAGE_IDS__ARRAY'; |
||
192 | $errors[110]['desc'] = 'this happens when you try to define checking-message-ids for your messages. in this case you must define one recipient number for each checking-message-id'; |
||
193 | |||
194 | $errors[-1]['title'] = 'NOT_AVAILABLE'; |
||
195 | $errors[-1]['desc'] = 'The target of report is not available(e.g. no message is associated with entered IDs)'; |
||
196 | |||
197 | return $errors; |
||
198 | } |
||
200 |