class StringFieldValidator extends FieldValidator (View source)

Validates that a value is a string and optionally checks its multi-byte length.

Properties

protected string $name

The name of the field being validated

from  FieldValidator
protected mixed $value

The value to validate

from  FieldValidator
protected bool $allowNull

Whether null is considered a valid value

from  FieldValidator

Methods

public
__construct(string $name, mixed $value, int|null $minLength = null, int|null $maxLength = null)

No description

public
validate()

Validate the value

protected
validateValue()

Inner validation method that performs the actual validation logic

Details

__construct(string $name, mixed $value, int|null $minLength = null, int|null $maxLength = null)

No description

Parameters

string $name
mixed $value
int|null $minLength
int|null $maxLength

ValidationResult validate()

Validate the value

Return Value

ValidationResult

protected ValidationResult validateValue()

Inner validation method that performs the actual validation logic

Return Value

ValidationResult