php class to validate user input