@param list > $columns * @param list $header * @param list > $rows * @return array */
(array $columns, array $header, array $rows)
| 754 | * @return array<string,mixed> |
| 755 | */ |
| 756 | private function positionalImportMapping(array $columns, array $header, array $rows): array |
| 757 | { |
| 758 | $count = count($columns); |
| 759 | if (count($header) !== $count) { |
| 760 | throw new FlexibleStorageException('invalid_source_columns', 'The import must have one field for each dataset column, in the same order.'); |
| 761 | } |
| 762 | foreach ($rows as $index => $row) { |
| 763 | if (!is_array($row) || count($row) !== $count) { |
| 764 | throw new FlexibleStorageException('invalid_source_row', 'Each imported row must have one field for each dataset column.', ['record' => $index]); |
| 765 | } |
| 766 | } |
| 767 | return [ |
| 768 | 'schemaVersion' => 1, |
| 769 | 'sourceHeader' => $header, |
| 770 | 'columns' => array_map(static fn (array $column, int $index): array => [ |
| 771 | 'column' => $column['ref'], |
| 772 | 'sourceIndex' => $index, |
| 773 | ], $columns, array_keys($columns)), |
| 774 | ]; |
| 775 | } |
| 776 | |
| 777 | private function getDataloadMetadata(int $dataloadId, bool $enforceOwnership) |
| 778 | { |
no test coverage detected