Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:validator:compositevalidator

This is an old revision of the document!


CompositeValidator

Layer: Validator · Source: lib/validator/CompositeValidator.php:21 (lines 21–66)


class CompositeValidator

Aggregate validator that runs multiple sub-validators.

Iterates over a list of callables, each receiving the PostRequestDto, and merges all ValidationResult objects into one.

Docblock Metadata

^ Tag ^ Value ^
| ''@category'' | Validator |
| ''@author'' | M.Noermoehammad |
| ''@license'' | MIT |
| ''@version'' | 1.0 |
| ''@since'' | Since Release 1.0 |

Inheritance

No parent, interface or trait. This is a root type.

Constants (0)

None.

Properties (1)

^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private'' | ''(untyped)'' | ''$validators'' | ''[];'' | 24 |

Methods (3)

^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''add()'' | Register a validator callable. | 32 |
| public | ''validate()'' | Run all registered validators and merge results. | 44 |
| public | ''count()'' | Return the number of registered validators. | 62 |

add()

public function add(callable $validator)

lines 32–36 (5)

Register a validator callable.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$validator'' | ''callable'' | //required// | Receives PostRequestDto, returns ValidationResult |

Returns: (none declared) — self

validate()

public function validate(PostRequestDto $dto)

lines 44–55 (12)

Run all registered validators and merge results.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$dto'' | [[scriptlog:lib:dto:postrequestdto|''PostRequestDto'']] | //required// | //none// |

Returns: (none declared) — ValidationResult

count()

public function count()

lines 62–65 (4)

Return the number of registered validators.

Takes no parameters.

Returns: (none declared) — int

Imports

^ Alias ^ Fully-qualified name ^
| ''PostRequestDto'' | [[scriptlog:lib:dto:postrequestdto|''Scriptlog\Dto\PostRequestDto'']] |

This page is generated from source by 'tools/gendoc'. Edits will be overwritten.

scriptlog/lib/validator/compositevalidator.1790413761.txt.gz · Last modified: by admin