IValidatorContainer
IValidatorContainer is an interface for classes which contains several child validators
Synopsis
Section titled “Synopsis”interface IValidatorContainer
| Implemented by | OperatorValidator, ValidationManager |
| Since | 1.0.0 |
| Source | Validator/IValidatorContainer.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
addArgumentResult(ValidationArgument $argument, int $result, ?Validator $validator = null): void | Adds a intermediate result of an validator for the given argument |
addChild(Validator $validator): void | Adds a new validator to the list of children. |
addIncident(ValidationIncident $incident): void | Adds an incident to the validation result. |
getBase(): VirtualArrayPath | Return the current base path used for relative argument resolution. |
getChild(string $name): Validator | Returns a named child validator. |
getChilds(): array<string, Validator> | Returns all child validators. |
getDependencyManager(): DependencyManager | Fetches the dependency manager |
addArgumentResult()
Section titled “addArgumentResult()”abstract public function addArgumentResult(ValidationArgument $argument, int $result, ?Validator $validator = null): void
Adds a intermediate result of an validator for the given argument
The validator (if the error was caused inside a validator).
| Parameter | Type | Description |
|---|---|---|
$argument | ValidationArgument | The argument |
$result | int | The arguments result. |
$validator | ?Validator | The validator (if the error was caused inside a validator). |
addChild()
Section titled “addChild()”abstract public function addChild(Validator $validator): void
Adds a new validator to the list of children.
The new child.
| Parameter | Type | Description |
|---|---|---|
$validator | Validator | The new child. |
addIncident()
Section titled “addIncident()”abstract public function addIncident(ValidationIncident $incident): void
Adds an incident to the validation result.
The incident.
| Parameter | Type | Description |
|---|---|---|
$incident | ValidationIncident | The incident. |
getBase()
Section titled “getBase()”abstract public function getBase(): VirtualArrayPath
Return the current base path used for relative argument resolution.
Implementations like ValidationManager provide this; validators rely on it.
Returns VirtualArrayPath
getChild()
Section titled “getChild()”abstract public function getChild(string $name): Validator
Returns a named child validator.
The name of the child validator.
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the child validator. |
Returns Validator — The named child validator.
getChilds()
Section titled “getChilds()”abstract public function getChilds(): array<string, Validator>
Returns all child validators.
Returns array``<``string``, Validator> — An array of Validator instances.
getDependencyManager()
Section titled “getDependencyManager()”abstract public function getDependencyManager(): DependencyManager
Fetches the dependency manager
Returns DependencyManager — The dependency manager to be used by child validators.