File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88class TabularInlineDataStream extends TabularDataStream
99{
10+
11+ /**
12+ * @throws \frictionlessdata\datapackage\Exceptions\DataStreamOpenException
13+ */
1014 protected function getDataSourceObject ()
1115 {
1216 $ data = json_decode (json_encode ($ this ->dataSource ), true );
1317 if (is_array ($ data )) {
1418 $ numFields = count ($ this ->schema ->fields ());
1519 $ objRows = [];
16- if (array_sum (array_keys ($ data [0 ])) == array_sum (range (0 , $ numFields - 1 ))) {
20+ if (!function_exists ('array_is_list ' )) {
21+ function array_is_list (array $ arr ):bool
22+ {
23+ if ($ arr === []) {
24+ return true ;
25+ }
26+ return array_keys ($ arr ) === range (0 , count ($ arr ) - 1 );
27+ }
28+ }
29+
30+ if (array_is_list ($ data [0 ]) && (count ($ data [0 ])) == $ numFields ) {
1731 // Row Arrays - convert to Row Objects
1832 $ header = array_shift ($ data );
1933 foreach ($ data as $ row ) {
You can’t perform that action at this time.
0 commit comments