diff --git a/docs/9.0/reader/index.md b/docs/9.0/reader/index.md index 5537d9af..af9b0b9c 100644 --- a/docs/9.0/reader/index.md +++ b/docs/9.0/reader/index.md @@ -39,8 +39,8 @@ The returned records are normalized using the following rules: - Empty records are skipped if present. - The document BOM sequence is skipped if present. - If a header record was provided, the number of fields is normalized to the number of fields contained in that record: - - Extra fields are truncated. - - Missing fields are added with a `null` value. + - Extra fields are truncated. + - Missing fields are added with a `null` value. - Field values are formatter if formatters are provided **Since version 9.11** ```php diff --git a/docs/9.0/reader/tabular-data-reader.md b/docs/9.0/reader/tabular-data-reader.md index 5cedd606..60021ced 100644 --- a/docs/9.0/reader/tabular-data-reader.md +++ b/docs/9.0/reader/tabular-data-reader.md @@ -29,11 +29,9 @@ $records = Reader::createFromPath('/path/to/file.csv') ->filter(fn (array $record): bool => false !== filter_var($record[2] ?? '', FILTER_VALIDATE_EMAIL)) ->select(1, 4, 5) ->slice(3, 5) - ->getRecords(); - -foreach ($record as $record) { - //do something meaningful with the found records -} + ->each(function (array $record) { + //do something meaningful with the found records + }); ``` Once you created a `TabularDataReader` implementing instance, here we are using the `Reader` you will @@ -107,7 +105,7 @@ var_dump([...$records][0]); // ] ``` -

full mapper usage was completed in version 9.12 for Reader and ResultSet.

+

full mapper usage was completed in version 9.12 for Reader and ResultSet.

Added in version 9.6.0 for ResultSet.

If the header record contains non-unique string values, a Exception exception is triggered.

since 9.12.0 the optional $header is a full mapper

diff --git a/src/TabularDataReader.php b/src/TabularDataReader.php index fc2981e5..78d65d00 100644 --- a/src/TabularDataReader.php +++ b/src/TabularDataReader.php @@ -57,7 +57,7 @@ public function count(): int; * filled with null values while extra record fields are strip from * the returned object. * - * @return Iterator> + * @return Iterator> */ public function getIterator(): Iterator; @@ -85,7 +85,7 @@ public function getHeader(): array; * * @param array $header an optional header mapper to use instead of the CSV document header * - * @return Iterator> + * @return Iterator> */ public function getRecords(array $header = []): Iterator; @@ -134,6 +134,8 @@ public function fetchOne(int $nth_record = 0): array; * @param string|int $index CSV column index * * @throws UnableToProcessCsv if the column index is invalid or not found + * + * @return Iterator */ public function fetchColumn($index = 0): Iterator; }