I am trying to implement validation functionality on a website on which i am working.
I have created an interface entitled Validator which my classes then implement. The single function in my interface is validate($input).
Then I have a class e.g EmailValidator which now implements this. In its implementation of validate() it checks if the input is a valid email and returns true or false respectively.
Now.. I want to implement a check whereby two inputs are sent and I check if they are equal. For example in the case of passwords. As this interface function only takes one input it is not suitable.
I can create a second interface with a validate function which takes two inputs e.g PairValidator. Is this however the optimal way to implement what i want?
My concern arise because due to the possibility of validation functions i may need i could plausibly have loads of interfaces e.g SetValidator for checking if a value is in a set..
Thanks
Validatorclass which has methods to validate different field types.$validator->validate(array("val1"=>"Test", "val2"=>"Test2");