Conditions | 3 |
Paths | 4 |
Total Lines | 218 |
Code Lines | 210 |
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 |
||
24 | protected function getErrorTextFromQueueErrorCode($errorCode) |
||
25 | { |
||
26 | $recognizedErrors = [ |
||
27 | '1' => 'Invalid date', |
||
28 | '107' => 'Invalid Airline Designator/Vendor Supplier', |
||
29 | '109' => 'Invalid Country Code', |
||
30 | '111' => 'Invalid Agent\'s Code', |
||
31 | '112' => 'Requestor Identification Required', |
||
32 | '113' => 'Invalid Period of Operation', |
||
33 | '114' => 'Invalid Flight Number', |
||
34 | '115' => 'Invalid Arrival Date', |
||
35 | '116' => 'Invalid Arrival Time', |
||
36 | '118' => 'System Unable to Process', |
||
37 | '12' => 'Invalid product details qualifier coded', |
||
38 | '120' => 'Invalid Action Code', |
||
39 | '129' => 'No PNR Match Found', |
||
40 | '130' => 'Invalid Origin and Destination Pair', |
||
41 | '134' => 'Advise Times Different from Booked', |
||
42 | '135' => 'Advise Dates Different from Booked', |
||
43 | '136' => 'Advise Class Different from Booked', |
||
44 | '144' => 'Invalid Requestor Identification', |
||
45 | '149' => 'Surname too Long', |
||
46 | '151' => 'Surname Mandatory', |
||
47 | '152' => 'Given Name/Title Mandatory', |
||
48 | '153' => 'Name Mismatch', |
||
49 | '154' => 'Message Function Invalid', |
||
50 | '155' => 'Message Function Not Supported', |
||
51 | '156' => 'Business Function Invalid', |
||
52 | '157' => 'Business Function Not Supported', |
||
53 | '159' => 'Phone Field Required', |
||
54 | '18' => 'Invalid on-time performance indicator', |
||
55 | '19' => 'Invalid type of call at port coded', |
||
56 | '190' => 'Invalid Processing Indicator', |
||
57 | '191' => 'Name Reference Required', |
||
58 | '192' => 'Name Reference Inhibited', |
||
59 | '193' => 'Segment Reference Required', |
||
60 | '194' => 'Segment Reference Inhibited', |
||
61 | '2' => 'Invalid time', |
||
62 | '20' => 'Invalid government action coded', |
||
63 | '21' => 'Invalid facility type coded', |
||
64 | '22' => 'Invalid traffic restriction coded', |
||
65 | '23' => 'Invalid traffic restriction type coded', |
||
66 | '24' => 'Invalid traffic restriction qualifier coded', |
||
67 | '244' => 'Not allowed on marketing flights', |
||
68 | '245' => 'Please request on operating carrier', |
||
69 | '25' => 'Invalid transport stage qualifier coded', |
||
70 | '259' => 'Invalid Combination of Generic Codes', |
||
71 | '260' => 'Invalid Frequent Traveler Number', |
||
72 | '266' => 'Limited Recline Seat has been Reserved', |
||
73 | '267' => 'Name in the Request Does Not Match Name in Reservation', |
||
74 | '268' => 'Need Names, Passenger Name Information Required to Reserve Seats', |
||
75 | '269' => 'Indicates that Additional Data for this Message Reference Number follows', |
||
76 | '288' => 'Unable to Satisfy, Need Confirmed Flight Status', |
||
77 | '289' => 'Unable to Retrieve PNR, Database Error', |
||
78 | '294' => 'Invalid Format', |
||
79 | '295' => 'No Flights Requested', |
||
80 | '3' => 'Invalid transfer sequence', |
||
81 | '301' => 'Application Suspended', |
||
82 | '302' => 'Invalid Length', |
||
83 | '304' => 'System Temporarily Unavailable', |
||
84 | '305' => 'Security/Audit Failure', |
||
85 | '306' => 'Invalid Language Code', |
||
86 | '307' => 'Received from data missing', |
||
87 | '308' => 'Received from data invalid', |
||
88 | '309' => 'Received from data missing or invalid', |
||
89 | '310' => 'Ticket arrangement data missing', |
||
90 | '311' => 'Ticket arrangement data invalid', |
||
91 | '312' => 'Ticket arrangement data missing or invalid', |
||
92 | '320' => 'Invalid segment status', |
||
93 | '321' => 'Duplicate flight segment', |
||
94 | '325' => 'Related system reference error', |
||
95 | '326' => 'Sending system reference error', |
||
96 | '327' => 'Invalid segment data in itinerary', |
||
97 | '328' => 'Invalid aircraft registration', |
||
98 | '329' => 'Invalid hold version', |
||
99 | '330' => 'invalid loading type', |
||
100 | '331' => 'Invalid ULD type', |
||
101 | '332' => 'Invalid serial number', |
||
102 | '333' => 'Invalid contour/height code', |
||
103 | '334' => 'Invalid tare weight', |
||
104 | '335' => 'Unit code unknown', |
||
105 | '336' => 'Invalid category code', |
||
106 | '337' => 'Invalid special load reference', |
||
107 | '338' => 'Invalid weight status', |
||
108 | '347' => 'Incompatible loads', |
||
109 | '348' => 'Invalid flight status', |
||
110 | '349' => 'Invalid application/product identification', |
||
111 | '352' => 'Link to inventory system is unavailable', |
||
112 | '354' => 'Invalid product status', |
||
113 | '356' => 'Query control tables full', |
||
114 | '357' => 'Declined to process interactively-default to backup', |
||
115 | '360' => 'Invalid PNR file address', |
||
116 | '361' => 'PNR is secured', |
||
117 | '362' => 'Unable to display PNR and/or name list', |
||
118 | '363' => 'PNR too long', |
||
119 | '364' => 'Invalid ticket number', |
||
120 | '365' => 'Invalid responding system in-house code', |
||
121 | '366' => 'Name list too long', |
||
122 | '367' => 'No active itinerary', |
||
123 | '368' => 'Not authorized', |
||
124 | '369' => 'No PNR is active, redisplay PNR required', |
||
125 | '370' => 'Simultaneous changes to PNR', |
||
126 | '371' => 'Prior PNR display required', |
||
127 | '375' => 'Requestor not authorized for this function for this PNR', |
||
128 | '381' => 'Record locator required', |
||
129 | '382' => 'PNR status value not equal', |
||
130 | '383' => 'Invalid change to status code', |
||
131 | '384' => 'Multiple Name Matches', |
||
132 | '385' => 'Mutually exclusive optional parameters', |
||
133 | '386' => 'Invalid minimum/maximum connect time specified', |
||
134 | '390' => 'Unable to reformat', |
||
135 | '391' => 'PNR contains non air segments', |
||
136 | '392' => 'Invalid block type/name', |
||
137 | '393' => 'Block sell restricted-request block name change', |
||
138 | '394' => 'Segment not valid for electronic ticketing', |
||
139 | '395' => 'Already ticketed', |
||
140 | '396' => 'Invalid ticket/coupon status', |
||
141 | '397' => 'Maximum ticket limit reached', |
||
142 | '399' => 'Duplicate Name', |
||
143 | '4' => 'Invalid city/airport code', |
||
144 | '400' => 'Duplicate ticket number', |
||
145 | '401' => 'Ticket number not found', |
||
146 | '403' => 'Requested Data Not Sorted', |
||
147 | '408' => 'No More Data Available', |
||
148 | '414' => 'Need Prior Availability Request', |
||
149 | '415' => 'Need Prior Schedule Request', |
||
150 | '416' => 'Need Prior Timetable Request', |
||
151 | '417' => 'Repeat Request Updating in Progress', |
||
152 | '437' => 'Carrier must be in separate PNR', |
||
153 | '438' => 'Request is outside system date range for this carrier within this system', |
||
154 | '440' => 'Void request on already voided or printed coupons', |
||
155 | '441' => 'Invalid Priority Number', |
||
156 | '442' => 'System in control of device is unknown', |
||
157 | '443' => 'Device address is unknown', |
||
158 | '445' => 'Security indicator requires originator ID', |
||
159 | '448' => 'Contact Service Provider directly', |
||
160 | '450' => 'All electronic ticket coupons have been printed', |
||
161 | '451' => 'Only individual seat request allowed at this time', |
||
162 | '457' => 'Unable-Connection Market Unavailable', |
||
163 | '459' => 'Owner Equal to Requestor', |
||
164 | '462' => 'Invalid authorization number', |
||
165 | '463' => 'Authorization number already used', |
||
166 | '466' => 'Form of payment missing or invalid for electronic ticketing', |
||
167 | '472' => 'Account does not allow redemption', |
||
168 | '473' => 'No award inventory available for requested market and date', |
||
169 | '5' => 'Invalid time mode', |
||
170 | '6' => 'Invalid operational suffix', |
||
171 | '7' => 'Invalid period of schedule validity', |
||
172 | '705' => 'Invalid or missing Coupon/Booklet Number', |
||
173 | '706' => 'Invalid Certificate Number', |
||
174 | '708' => 'Incorrect credit card information', |
||
175 | '709' => 'Invalid and/or missing frequent traveler information', |
||
176 | '70D' => 'Display criteria not supported', |
||
177 | '710' => 'Free text qualifier error', |
||
178 | '711' => 'Invalid Fare Calculation Status Code', |
||
179 | '712' => 'Missing and/or invalid monetary information', |
||
180 | '713' => 'Invalid Price Type Qualifier', |
||
181 | '716' => 'Missing and/or invalid reservation control information', |
||
182 | '717' => 'Missing and/or invalid travel agent and/or system identification', |
||
183 | '718' => 'Invalid Document Type', |
||
184 | '721' => 'Too much data', |
||
185 | '723' => 'Invalid category', |
||
186 | '724' => 'Invalid routing', |
||
187 | '725' => 'Domestic itinerary', |
||
188 | '726' => 'Invalid global indicator', |
||
189 | '727' => 'Invalid amount', |
||
190 | '728' => 'Invalid conversion type', |
||
191 | '729' => 'Invalid currency code', |
||
192 | '738' => 'Overflow', |
||
193 | '743' => 'Electronic ticket record purposely not accessable', |
||
194 | '745' => 'Refund (full or partial) not allowed', |
||
195 | '746' => 'Open segment(s) not permitted for first coupon or entire itinerary', |
||
196 | '747' => 'Validity date(s) required for electronic tickets', |
||
197 | '748' => 'Status change denied', |
||
198 | '749' => 'Coupon status not open', |
||
199 | '750' => 'Endorsement restriction', |
||
200 | '754' => 'Electronic ticket outside validity date', |
||
201 | '755' => 'Invalid exchange/coupon media', |
||
202 | '757' => 'Exchange paper to electronic ticket not allowed', |
||
203 | '760' => 'Conjunction ticket numbers are not sequential', |
||
204 | '761' => 'Exchange/Reissue must include all unused coupons', |
||
205 | '762' => 'Invalid tax amount', |
||
206 | '763' => 'Invalid tax code', |
||
207 | '766' => 'Ticket has no residual value', |
||
208 | '767' => 'Historical data not available - unable to process', |
||
209 | '790' => 'Exchange denied - no further exchanges allowed', |
||
210 | '791' => 'Unable to void exchanged/reissued ticket', |
||
211 | '792' => 'Segment not eligible for interline electronic ticket', |
||
212 | '793' => 'Fare/tax amount too long', |
||
213 | '794' => 'Invalid or missing fare calculation', |
||
214 | '795' => 'Invalid, missing or conflicting search criteria', |
||
215 | '796' => 'Partial void of ticket coupons not allowed', |
||
216 | '797' => 'Invalid stopover indicator', |
||
217 | '798' => 'Invalid stopover code usage', |
||
218 | '799' => 'Electronic ticket exists, no match on specified criteria', |
||
219 | '79A' => 'Invalid office identification', |
||
220 | '8' => 'Invalid days of operation', |
||
221 | '9' => 'Invalid frequency rate', |
||
222 | '900' => 'Inactivity Time Out Value Exceeded', |
||
223 | '901' => 'Communications Line Unavailable', |
||
224 | '902' => 'Prior message being processed or already processed', |
||
225 | '911' => 'Unable to process - system error', |
||
226 | '912' => 'Incomplete message - data missing in query', |
||
227 | '913' => 'Item/data not found or data not existing in processing host', |
||
228 | '914' => 'Invalid format/data - data does not match EDIFACT rules', |
||
229 | '915' => 'No action - processing host cannot support function', |
||
230 | '916' => 'EDIFACT version not supported', |
||
231 | '917' => 'EDIFACT message size exceeded', |
||
232 | |||
233 | ]; |
||
234 | |||
235 | $errorMessage = (array_key_exists($errorCode, $recognizedErrors)) ? $recognizedErrors[$errorCode] : ''; |
||
236 | |||
237 | if ($errorMessage === '') { |
||
238 | $errorMessage = "PROCESS E-TICKET ERROR '" . $errorCode . "' (Error message unavailable)"; |
||
239 | } |
||
240 | |||
241 | return $errorMessage; |
||
242 | } |
||
244 |