RecordDecoder
FinalYes
Decodes the records of one file or stream: the header it resolves from the first record is that source's.
Methods
- __construct() : mixed
- decode() : null|array<string, mixed>|string
- An extra empty cell ('' or null) loses nothing, so only a non-empty one makes a record corrupted. A missing cell makes it corrupted unless missingColumnsAsNull; a present '' cell is null under emptyToNull.
- headers() : null|array<int, string>
Methods
__construct()
public
__construct(bool $withHeader, bool $emptyToNull[, bool $missingColumnsAsNull = false ][, null|array<int, string> $headers = null ]) : mixed
Parameters
- $withHeader : bool
- $emptyToNull : bool
- $missingColumnsAsNull : bool = false
- $headers : null|array<int, string> = null
-
the names of a stream that carries no header record - a window cut past a file's first record; withHeader must be false
Tags
decode()
An extra empty cell ('' or null) loses nothing, so only a non-empty one makes a record corrupted. A missing cell makes it corrupted unless missingColumnsAsNull; a present '' cell is null under emptyToNull.
public
decode(array<string|int, mixed> $cells) : null|array<string, mixed>|string
Parameters
- $cells : array<string|int, mixed>
Return values
null|array<string, mixed>|string —null for a record that is no row (the header, an empty record), why the record is corrupted, or the row's values
headers()
public
headers() : null|array<int, string>
Return values
null|array<int, string> —null before the first decode() resolved them