Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Oct 26, 2023
1 parent 136bc30 commit 114c2c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/9.0/reader/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions docs/9.0/reader/tabular-data-reader.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -107,7 +105,7 @@ var_dump([...$records][0]);
// ]
```

<p class="message-notice">full mapper usage was completed in version <code>9.12</code> for <code>Reader</code> and <code>ResultSet</code></code>.</p>
<p class="message-notice">full mapper usage was completed in version <code>9.12</code> for <code>Reader</code> and <code>ResultSet</code>.</p>
<p class="message-notice">Added in version <code>9.6.0</code> for <code>ResultSet</code>.</p>
<p class="message-warning">If the header record contains non-unique string values, a <code>Exception</code> exception is triggered.</p>
<p class="message-notice">since <code>9.12.0</code> the optional <code>$header</code> is a full mapper</p>
Expand Down
6 changes: 4 additions & 2 deletions src/TabularDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function count(): int;
* filled with null values while extra record fields are strip from
* the returned object.
*
* @return Iterator<array-key, array<mixed>>
* @return Iterator<array-key, array<array-key, mixed>>
*/
public function getIterator(): Iterator;

Expand Down Expand Up @@ -85,7 +85,7 @@ public function getHeader(): array;
*
* @param array<string> $header an optional header mapper to use instead of the CSV document header
*
* @return Iterator<array-key,array<mixed>>
* @return Iterator<array-key, array<array-key, mixed>>
*/
public function getRecords(array $header = []): Iterator;

Expand Down Expand Up @@ -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<int, mixed>
*/
public function fetchColumn($index = 0): Iterator;
}

0 comments on commit 114c2c3

Please sign in to comment.