CSVSourceOpener implements Describable
Interfaces
- Describable
Methods
- __construct() : mixed
- columns() : array<int, string>
- The column names of $stream's first record - the header, or the e00.. names; $stream stays open: the view it is read through is never closed, closing it would close $stream.
- describe() : Description|null
- The extension is detected per process, never described.
- dialect() : CSVDialect
- A fully declared dialect reads nothing; otherwise the undeclared parts are detected from $stream.
- fromDescription() : static
- open() : CSVOpenSource
- openSplit() : CSVOpenSource
- The records whose first byte lies in the split's window. Both window ends are resynced to a record start, so a split ends exactly where its neighbour begins; only the first split reads the header and the BOM, and only the first split refuses a header diverging from $inferred - once per file.
- over() : CSVOpenSource
Methods
__construct()
public
__construct(Filesystem $filesystem, CSVReadOptions $options[, CSVDialects $dialects = new CSVDialects() ][, FlowPhpExtension|null $extension = null ]) : mixed
Parameters
- $filesystem : Filesystem
- $options : CSVReadOptions
- $dialects : CSVDialects = new CSVDialects()
-
the dialects known by uri; a file opened without one records the dialect it detected
- $extension : FlowPhpExtension|null = null
Tags
columns()
The column names of $stream's first record - the header, or the e00.. names; $stream stays open: the view it is read through is never closed, closing it would close $stream.
public
columns(SourceStream $stream, CSVDialect $dialect) : array<int, string>
Parameters
- $stream : SourceStream
- $dialect : CSVDialect
Return values
array<int, string>describe()
The extension is detected per process, never described.
public
describe() : Description|null
Return values
Description|nulldialect()
A fully declared dialect reads nothing; otherwise the undeclared parts are detected from $stream.
public
dialect(SourceStream $stream) : CSVDialect
Parameters
- $stream : SourceStream
Return values
CSVDialectfromDescription()
public
static fromDescription(array<string|int, mixed> $data, Rebuild $rebuild) : static
Parameters
- $data : array<string|int, mixed>
- $rebuild : Rebuild
Return values
staticopen()
public
open(SourceFile $source[, null|InferredColumns $inferred = null ]) : CSVOpenSource
Parameters
- $source : SourceFile
- $inferred : null|InferredColumns = null
-
the columns the file must carry; checked before a row is built
Tags
Return values
CSVOpenSourceopenSplit()
The records whose first byte lies in the split's window. Both window ends are resynced to a record start, so a split ends exactly where its neighbour begins; only the first split reads the header and the BOM, and only the first split refuses a header diverging from $inferred - once per file.
public
openSplit(SourceFile $source, FileSplit $split[, InferredColumns|null $inferred = null ]) : CSVOpenSource
Parameters
- $source : SourceFile
- $split : FileSplit
- $inferred : InferredColumns|null = null
Tags
Return values
CSVOpenSourceover()
public
over(SourceStream $stream, CSVDialect $dialect, null|array<int, string> $headers, null|int<1, max> $charactersReadInLine) : CSVOpenSource
Parameters
- $stream : SourceStream
- $dialect : CSVDialect
- $headers : null|array<int, string>
-
null reads $stream from a file's start - header and BOM as the options say; a list names the records of a window past the first one
- $charactersReadInLine : null|int<1, max>