Documentation

ColumnConsistencyValidator
in package

A class to manage column consistency on data insertion into a CSV

Tags
since
7.0.0

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

$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

setColumnsCount()

Set Inserted row column count

public setColumnsCount(int $value) : mixed
Parameters
$value : int
Tags
throws
InvalidArgumentException

If $value is lesser than -1

Return values
mixed

Search results