Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change EmailValidator::isValid interface #62

Closed
egulias opened this issue May 4, 2015 · 0 comments
Closed

Change EmailValidator::isValid interface #62

egulias opened this issue May 4, 2015 · 0 comments
Milestone

Comments

@egulias
Copy link
Owner

egulias commented May 4, 2015

As a first approach, use the Strategy pattern so upon construction EmailValidator requires the strategies objects to be used for validation.
Strategies will be evaluated in an AND fashion. E.g

//$result has been setted after the first validation
foreach ($this->strategies as $strategy) {
  $result = $result && $strategy->isValid($email, $this->lexer, $this->getWarnings());
}

Right now $this->lexer is mutable, probably needs to be immutable so there's no riks while passing it around.
Should also define ValidationStretegy::isValid interface.
RFCs validation would be the only one "hardcoded" within the validator. Probably being added in the constructor.

EmailValidator::__construct(ValidationStrategies $stretegies)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant