File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -1297,20 +1297,21 @@ private function domnodeToArray($node)
1297
1297
$ output [$ child ->tagName ][] = $ v ;
1298
1298
} else {
1299
1299
$ s = (string ) $ v ;
1300
- if (strlen ($ s ) > 0 ) {
1300
+ if (! empty ($ s )) {
1301
1301
$ output = $ s ;
1302
- break ;
1303
1302
}
1304
1303
}
1305
1304
}
1306
- if ($ node ->hasAttributes ()) {
1307
- foreach ($ node ->attributes as $ attrNode ) {
1308
- $ output ['@attributes ' ][$ attrNode ->name ] = (string ) $ attrNode ->value ;
1305
+ if (is_array ($ output )) {
1306
+ if ($ node ->hasAttributes ()) {
1307
+ foreach ($ node ->attributes as $ attrNode ) {
1308
+ $ output ['@attributes ' ][$ attrNode ->name ] = (string ) $ attrNode ->value ;
1309
+ }
1309
1310
}
1310
- }
1311
- foreach ( $ output as $ t => $ v ) {
1312
- if ( is_array ( $ v ) && count ( $ v ) == 1 && $ t != ' @attributes ' ) {
1313
- $ output [ $ t ] = $ v [ 0 ];
1311
+ foreach ( $ output as $ t => $ v ) {
1312
+ if ( is_array ( $ v ) && ( count ( $ v ) === 1 ) && ( $ t !== ' @attributes ' ) ) {
1313
+ $ output [ $ t ] = $ v [ 0 ];
1314
+ }
1314
1315
}
1315
1316
}
1316
1317
break ;
You can’t perform that action at this time.
0 commit comments