PhpCSVOpenSource implements CSVOpenSource
Interfaces
Methods
- __construct() : mixed
- batches() : Generator<int, CorruptedRecordException|Rows>
- Batches of exactly $batchSize rows (the last may be shorter), keyed and ordered by $schema, and every corrupted record handed up in record order. This instance is consumed afterwards.
- close() : void
- columns() : array<int, string>
- This instance is consumed afterwards.
- headers() : array<int, string>
- The header records() resolved; [] before it ran or for a 0-byte source.
- producedBytes() : int<0, max>
- The bytes, as read, of the rows producedRows() counts: line endings included, the header record excluded.
- producedRows() : int<0, max>
- Rows read from the source so far by records() or sniff() - it may be more than a consumer took.
- records() : Generator<int, array<string|int, string|null>>
- CSVLineReader::readLines() already joins a quoted multi-line record, so never re-split or re-join here.
- sniff() : ColumnTypes
- ColumnTypes::sniff() over records(). This instance is consumed afterwards.
Methods
__construct()
public
__construct(SourceStream $stream, CSVDecoder $decoder, CSVLineReader $lineReader) : mixed
Parameters
- $stream : SourceStream
- $decoder : CSVDecoder
- $lineReader : CSVLineReader
batches()
Batches of exactly $batchSize rows (the last may be shorter), keyed and ordered by $schema, and every corrupted record handed up in record order. This instance is consumed afterwards.
public
batches(Schema $schema, int $batchSize, Backend $backend[, SchemaInference|null $inference = null ]) : Generator<int, CorruptedRecordException|Rows>
Parameters
- $schema : Schema
- $batchSize : int
- $backend : Backend
- $inference : SchemaInference|null = null
-
the inference that made $schema; null when it was declared
Return values
Generator<int, CorruptedRecordException|Rows>close()
public
close() : void
columns()
This instance is consumed afterwards.
public
columns() : array<int, string>
Return values
array<int, string>headers()
The header records() resolved; [] before it ran or for a 0-byte source.
public
headers() : array<int, string>
Return values
array<int, string>producedBytes()
The bytes, as read, of the rows producedRows() counts: line endings included, the header record excluded.
public
producedBytes() : int<0, max>
Return values
int<0, max>producedRows()
Rows read from the source so far by records() or sniff() - it may be more than a consumer took.
public
producedRows() : int<0, max>
Return values
int<0, max>records()
CSVLineReader::readLines() already joins a quoted multi-line record, so never re-split or re-join here.
public
records() : Generator<int, array<string|int, string|null>>
This instance is consumed afterwards.
Return values
Generator<int, array<string|int, string|null>>sniff()
ColumnTypes::sniff() over records(). This instance is consumed afterwards.
public
sniff(array<string|int, mixed> $names, int|null $rowBudget, TypeNarrower $typer) : ColumnTypes
Parameters
- $names : array<string|int, mixed>
- $rowBudget : int|null
-
- null for every row
- $typer : TypeNarrower