...
If you want to write validation classes your class have to inherit from the cValidatorAbstract class. The minimal feature of your class should be the implementation of the isValid method with the logic if a given value matches the validation or not. If there are any entries in the $cfg array with the same name of the suffix of your validation class name (cValidatorEmail -> email) these settings will be added automatically as options for your validation class.
Class diagramm
Methods
Method name | Description |
---|---|
setOptions(options) | This method can be used to set an array validation options |
setOption(name, value) | This method can be used to set an validation option |
getOption(name) | This method returns a option by its name |
getErrors() | This method returns errors |
isValid(value) | This method can be used to run a value against your specified options |
Existing validation classes
Class name | Description |
---|---|
cValidatorEmail | This class can be used to validate email adresses |
cValidatorRegex | This class can be used to validate regular expressions |
How to use
At first you need to get an validator object. To reach this goal you have to call the static getInstance method from the cValidatorFactory class.
...