ColumnConsistencyValidator
in package
A class to manage column consistency on data insertion into a CSV
Tags
Table of Contents
- $columns_count : int
- The number of column per row
- $detect_columns_count : bool
- should the class detect the column count based the inserted row
- __invoke() : bool
- Is the submitted row valid
- autodetectColumnsCount() : mixed
- The method will set the $columns_count property according to the next inserted row and therefore will also validate the next line whatever length it has no matter the current $columns_count property value.
- getColumnsCount() : int
- Column count getter
- setColumnsCount() : mixed
- Set Inserted row column count
Properties
$columns_count
The number of column per row
private
int
$columns_count
= -1
$detect_columns_count
should the class detect the column count based the inserted row
private
bool
$detect_columns_count
= false
Methods
__invoke()
Is the submitted row valid
public
__invoke(array<string|int, mixed> $row) : bool
Parameters
- $row : array<string|int, mixed>
Return values
bool —autodetectColumnsCount()
The method will set the $columns_count property according to the next inserted row and therefore will also validate the next line whatever length it has no matter the current $columns_count property value.
public
autodetectColumnsCount() : mixed
Return values
mixed —getColumnsCount()
Column count getter
public
getColumnsCount() : int
Return values
int —setColumnsCount()
Set Inserted row column count
public
setColumnsCount(int $value) : mixed
Parameters
- $value : int