@@ -109,14 +109,21 @@ public function parse($file2)
109
109
$ this ->analyseUNA (substr ($ line , 4 , 6 ));
110
110
}
111
111
unset($ file2 [$ x ]);
112
- continue ;
112
+ break ;
113
113
case "UNB " :
114
114
if (!$ this ->unbChecked ) {
115
- $ this ->analyseUNB (substr ($ line , 4 ));
115
+ $ line =$ this ->splitSegment ($ line );
116
+ $ this ->analyseUNB ($ line [1 ]);
116
117
}
117
118
break ;
119
+ case "UNH " :
120
+ $ line =$ this ->splitSegment ($ line );
121
+ $ this ->analyseUNH ($ line );
122
+ break ;
123
+ default :
124
+ $ line =$ this ->splitSegment ($ line );
125
+ break ;
118
126
}
119
- $ line =$ this ->splitSegment ($ line );
120
127
}
121
128
$ this ->parsedfile =array_values ($ file2 ); //reindex
122
129
return $ file2 ;
@@ -174,19 +181,31 @@ public function analyseUNA($line)
174
181
}
175
182
}
176
183
177
- /**
184
+ /**
178
185
* Read UNA's characters definition
179
- * @param string $line : UNB definition line (without UNA tag). Example : :+.? '
186
+ * @param string $line : UNB definition line (without UNB tag). Example : :+.? '
180
187
*/
181
- public function analyseUNB ($ line )
188
+ public function analyseUNB ($ encoding )
182
189
{
183
- $ encoding = substr ($ line , 0 , 4 );
190
+ if (is_array ($ encoding )) {
191
+ $ encoding = $ encoding [0 ];
192
+ }
193
+ $ this ->encoding = $ encoding ;
184
194
if (isset ($ this ->encodingToStripChars [$ encoding ])) { // we have a normed char set for your content
185
195
$ this ->setStripRegex ($ this ->encodingToStripChars [$ encoding ]);
186
196
}
187
197
$ this ->unbChecked = true ;
188
198
}
189
199
200
+ /**
201
+ * Identify message type
202
+ * @param string $line : UNH segment
203
+ */
204
+ public function analyseUNH ($ line )
205
+ {
206
+
207
+ }
208
+
190
209
//unwrap string splitting rows on terminator (if not escaped)
191
210
private function unwrap ($ string )
192
211
{
0 commit comments