Validation class in PHP