CSVRecordResync
Read onlyYes
FinalYes
A newline after a cut is accepted once $confirmations consecutive records tokenise to $expectedFields fields.
Methods
- __construct() : mixed
- after() : null|int<0, max>
- The first byte offset at or after $from where a record provably starts; null when none does. Offset 0 starts one by definition. Monotonic in $from, so neighbouring windows cut at after(offset) share every boundary.
- confirms() : bool
- Whether the $confirmations records starting at $position each tokenise, strictly, to $expectedFields fields - an enclosure may only open a field and must close it, so text cut out of a quoted value, which fgetcsv would read as a record, is rejected at its first stray enclosure. Blank lines are skipped; a stream that ends first confirms when at least one record was read and every one of them matched.
Methods
__construct()
public
__construct(CSVDialect $dialect, int $expectedFields[, int $confirmations = 3 ]) : mixed
Parameters
- $dialect : CSVDialect
- $expectedFields : int
- $confirmations : int = 3
after()
The first byte offset at or after $from where a record provably starts; null when none does. Offset 0 starts one by definition. Monotonic in $from, so neighbouring windows cut at after(offset) share every boundary.
public
after(SourceStream $stream, int<0, max> $from) : null|int<0, max>
Parameters
- $stream : SourceStream
- $from : int<0, max>
Return values
null|int<0, max>confirms()
Whether the $confirmations records starting at $position each tokenise, strictly, to $expectedFields fields - an enclosure may only open a field and must close it, so text cut out of a quoted value, which fgetcsv would read as a record, is rejected at its first stray enclosure. Blank lines are skipped; a stream that ends first confirms when at least one record was read and every one of them matched.
public
confirms(SourceStream $stream, int<0, max> $position) : bool
Parameters
- $stream : SourceStream
- $position : int<0, max>