Closed chaungoclong closed 4 months ago
Hi @chaungoclong . Perhaps has_filter
would be also nice to add?
Hi @filisko , Thanks for the suggestion! I can add the has_filter method in this pull request along with has_validator. I'll get started on it.
Added more stuff here #351
This method checks if a validator method exists for a given rule.
The reason for adding this method is to prevent exceptions from being thrown when using the
add_validator
method with a rule that already exists. By usinghas_validator
, we can ensure that a rule does not exist before adding it.Here are the key changes:
New Method: The
has_validator
method takes a rule as a string parameter and returns a boolean value. It checks if a validator method exists for the given rule in theValidator
class or if the rule is present in thevalidation_methods
array.Test Cases: Test cases for both happy and unhappy paths have been included to validate the functionality of the new has_validator method.