Documentation

RowFilter

Trait to format and validate the row before insertion

Tags
since
7.0.0

Table of Contents

$formatters  : array<string|int, callable>
Callables to format the row before insertion
$validators  : array<string|int, callable>
Callables to validate the row before insertion
addFormatter()  : $this
add a formatter to the collection
addValidator()  : $this
add a Validator to the collection
clearFormatters()  : $this
Remove all registered formatter
clearValidators()  : $this
Remove all registered validators
hasFormatter()  : bool
Detect if the formatter is already registered
hasValidator()  : bool
Detect if a validator is already registered
removeFormatter()  : $this
Remove a formatter from the collection
removeValidator()  : $this
Remove a validator from the collection
formatRow()  : array<string|int, mixed>
Format the given row
validateRow()  : mixed
Validate a row
validateString()  : mixed

Properties

$formatters

Callables to format the row before insertion

protected array<string|int, callable> $formatters = []

$validators

Callables to validate the row before insertion

protected array<string|int, callable> $validators = []

Methods

addFormatter()

add a formatter to the collection

public addFormatter(callable $callable) : $this
Parameters
$callable : callable
Return values
$this

addValidator()

add a Validator to the collection

public addValidator(callable $callable, string $name) : $this
Parameters
$callable : callable
$name : string

the rule name

Return values
$this

clearFormatters()

Remove all registered formatter

public clearFormatters() : $this
Return values
$this

clearValidators()

Remove all registered validators

public clearValidators() : $this
Return values
$this

hasFormatter()

Detect if the formatter is already registered

public hasFormatter(callable $callable) : bool
Parameters
$callable : callable
Return values
bool

hasValidator()

Detect if a validator is already registered

public hasValidator(string $name) : bool
Parameters
$name : string

the validator name

Return values
bool

removeFormatter()

Remove a formatter from the collection

public removeFormatter(callable $callable) : $this
Parameters
$callable : callable
Return values
$this

removeValidator()

Remove a validator from the collection

public removeValidator(string $name) : $this
Parameters
$name : string

the validator name

Return values
$this

formatRow()

Format the given row

protected formatRow(array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
$row : array<string|int, mixed>
Return values
array<string|int, mixed>

validateRow()

Validate a row

protected validateRow(array<string|int, mixed> $row) : mixed
Parameters
$row : array<string|int, mixed>
Tags
throws
InvalidRowException

If the validation failed

Return values
mixed

validateString()

protected abstract validateString(mixed $str) : mixed
Parameters
$str : mixed
Tags
inheritdoc
Return values
mixed

Search results