class Validator

config 가 유효한지 확인하는 역할을 수행 함

Properties

private int $minNameLength minimum name length
private int $maxNameLength maximum name length
protected Factory $factory validation factory instance
protected array $customTargets custom target list array
protected array $customRules custom rule list array
protected array $customMessages custom message list array

Methods

__construct(Factory $factory)

constructor

void
extending()

add new rule to validation factory

Validator
validate(ConfigEntity $config)

validate a given object

array
getRules()

the rules

array
getMessages()

validation failure messages

void
addRule(string $keyword, string $ruleName, Closure $target, string|null $message = null)

add validation rule

Factory
getFactory()

validation factory instance

Details

at line 78
__construct(Factory $factory)

constructor

Parameters

Factory $factory validation factory instance

at line 90
private void extending()

add new rule to validation factory

Return Value

void

at line 107
Validator validate(ConfigEntity $config)

validate a given object

Parameters

ConfigEntity $config config object

Return Value

Validator

at line 129
protected array getRules()

the rules

Return Value

array

at line 142
protected array getMessages()

validation failure messages

Return Value

array

at line 158
void addRule(string $keyword, string $ruleName, Closure $target, string|null $message = null)

add validation rule

Parameters

string $keyword match keyword(ex. name, email ..)
string $ruleName rule name(ex. require, min, max ..)
Closure $target validate target
string|null $message rule failure message

Return Value

void

at line 173
Factory getFactory()

validation factory instance

Return Value

Factory