@param list > $columns * @param list $header * @param list > $rows * @return array */
(array $columns, array $header, array $rows)
| 736 | * @return array<string,mixed> |
| 737 | */ |
| 738 | private function positionalImportMapping(array $columns, array $header, array $rows): array |
| 739 | { |
| 740 | $count = count($columns); |
| 741 | if (count($header) !== $count) { |
| 742 | throw new FlexibleStorageException('invalid_source_columns', 'The import must have one field for each dataset column, in the same order.'); |
| 743 | } |
| 744 | foreach ($rows as $index => $row) { |
| 745 | if (!is_array($row) || count($row) !== $count) { |
| 746 | throw new FlexibleStorageException('invalid_source_row', 'Each imported row must have one field for each dataset column.', ['record' => $index]); |
| 747 | } |
| 748 | } |
| 749 | return [ |
| 750 | 'schemaVersion' => 1, |
| 751 | 'sourceHeader' => $header, |
| 752 | 'columns' => array_map(static fn (array $column, int $index): array => [ |
| 753 | 'column' => $column['ref'], |
| 754 | 'sourceIndex' => $index, |
| 755 | ], $columns, array_keys($columns)), |
| 756 | ]; |
| 757 | } |
| 758 | |
| 759 | private function getDataloadMetadata(int $dataloadId, bool $enforceOwnership) |
| 760 | { |
no test coverage detected