From f7d50d53ea28b34f7eee7f4d7d0f9f8f2387e889 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 21 Feb 2017 09:17:08 +0100 Subject: [PATCH] Move method 'validateEmailAddress' from class 'Auth' to 'UserManager' --- src/Auth.php | 21 --------------------- src/UserManager.php | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Auth.php b/src/Auth.php index 7df90d2..0c0b867 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -271,27 +271,6 @@ final class Auth extends UserManager { $this->authenticateUserInternal($password, null, $username, $rememberDuration); } - /** - * Validates an email address - * - * @param string $email the email address to validate - * @return string the email address if it's valid - * @throws InvalidEmailException if the email address was invalid - */ - private static function validateEmailAddress($email) { - if (empty($email)) { - throw new InvalidEmailException(); - } - - $email = trim($email); - - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - throw new InvalidEmailException(); - } - - return $email; - } - /** * Validates a password * diff --git a/src/UserManager.php b/src/UserManager.php index 90021e6..60855cf 100644 --- a/src/UserManager.php +++ b/src/UserManager.php @@ -65,6 +65,27 @@ abstract class UserManager { } } + /** + * Validates an email address + * + * @param string $email the email address to validate + * @return string the email address if it's valid + * @throws InvalidEmailException if the email address was invalid + */ + protected static function validateEmailAddress($email) { + if (empty($email)) { + throw new InvalidEmailException(); + } + + $email = trim($email); + + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + throw new InvalidEmailException(); + } + + return $email; + } + /** * Throttles the specified action for the user to protect against too many requests *