Skip to content

Commit 40562bd

Browse files
committed
FIX: Check for string or array
1 parent 8308ac5 commit 40562bd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/EDI/Analyser.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,18 @@ public function process(array $data, array $rawSegments = null): string
225225
}
226226
$r[] = ' type: '.$d_sub_desc_attr['type'];
227227

228-
$jsoncomposite[$d_sub_desc_attr['name']][] = $d_detail;
228+
if (isset($jsoncomposite[$d_sub_desc_attr['name']])) {
229+
if (is_array($jsoncomposite[$d_sub_desc_attr['name']])) {
230+
$jsoncomposite[$d_sub_desc_attr['name']][] = $d_detail;
231+
} else {
232+
$jsoncomposite[$d_sub_desc_attr['name']] = [
233+
$jsoncomposite[$d_sub_desc_attr['name']],
234+
$d_detail
235+
];
236+
}
237+
} else {
238+
$jsoncomposite[$d_sub_desc_attr['name']] = $d_detail;
239+
}
229240

230241
if (isset($d_sub_desc_attr['maxlength'])) {
231242
$r[] = ' maxlen: '.$d_sub_desc_attr['maxlength'];

0 commit comments

Comments
 (0)