macder / wfv-validation

Input validation API for WordPress
https://macder.github.io/wfv/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Create new validator class that receives a single validation strategy (ValidateInterface) for each field rule #113

Closed macder closed 7 years ago

macder commented 7 years ago

Currently the FormComposite holds an array of validation strategies (ValidateInterface) and loops through them during validation. This is somewhat confusing, making it unclear that a strategy pattern is being used. It also add's too much responsibility to the FormComposite.

The new Validator class will be added to the FormComposite as a class member, and the FormComposite will feed it a single strategy at a time.

The only validation responsibility the FormComposite should have is providing correct strategies to the Validator