File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,14 @@ class Parser
43
43
* @var string : encoding (default UNOB)
44
44
*/
45
45
private $ encoding ;
46
+ /**
47
+ * @var string : message format from UNH
48
+ */
49
+ private $ messageFormat ;
50
+ /**
51
+ * @var string : message directory
52
+ */
53
+ private $ messageDirectory ;
46
54
47
55
private $ encodingToStripChars = [
48
56
"UNOA " => "/[ \x01- \x1F\x80- \xFF]/ " , // not as restrictive as it should be
@@ -203,7 +211,16 @@ public function analyseUNB($encoding)
203
211
*/
204
212
public function analyseUNH ($ line )
205
213
{
206
-
214
+ if (count ($ line )<3 ) {
215
+ return ;
216
+ }
217
+ $ lineElement = $ line [2 ];
218
+ if (!is_array ($ lineElement )) {
219
+ $ this ->messageFormat = $ lineElement ;
220
+ return ;
221
+ }
222
+ $ this ->messageFormat = $ lineElement [0 ];
223
+ $ this ->messageDirectory = $ lineElement [2 ];
207
224
}
208
225
209
226
//unwrap string splitting rows on terminator (if not escaped)
@@ -296,4 +313,14 @@ public function setStripRegex($regex)
296
313
{
297
314
$ this ->stripChars =$ regex ;
298
315
}
316
+
317
+ public function getMessageFormat ()
318
+ {
319
+ return $ this ->messageFormat ;
320
+ }
321
+
322
+ public function getMessageDirectory ()
323
+ {
324
+ return $ this ->messageDirectory ;
325
+ }
299
326
}
You can’t perform that action at this time.
0 commit comments