diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-16 22:29:29 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-16 22:29:29 -0500 |
commit | 27b9b7a727de7a9608d85bce6ca94e81bbdf7ffb (patch) | |
tree | 2b04dada6912fa1234c92d4e92c8f0c3aa3bb00d /app/Validator | |
parent | ff149c354e8ab01840842a6a47a65aac6a4c304f (diff) |
Minor code improvements
Diffstat (limited to 'app/Validator')
-rw-r--r-- | app/Validator/AuthValidator.php | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/app/Validator/AuthValidator.php b/app/Validator/AuthValidator.php index e77a88c8..36ccdff0 100644 --- a/app/Validator/AuthValidator.php +++ b/app/Validator/AuthValidator.php @@ -23,28 +23,17 @@ class AuthValidator extends Base */ public function validateForm(array $values) { - $result = false; - $errors = array(); - - foreach (array('validateFields', 'validateLocking', 'validateCaptcha', 'validateCredentials') as $method) { - list($result, $errors) = $this->$method($values); - - if (! $result) { - break; - } - } - - return array($result, $errors); + return $this->executeValidators(array('validateFields', 'validateLocking', 'validateCaptcha', 'validateCredentials'), $values); } /** * Validate credentials syntax * - * @access private + * @access protected * @param array $values Form values * @return array $valid, $errors [0] = Success or not, [1] = List of errors */ - private function validateFields(array $values) + protected function validateFields(array $values) { $v = new Validator($values, array( new Validators\Required('username', t('The username is required')), @@ -61,11 +50,11 @@ class AuthValidator extends Base /** * Validate user locking * - * @access private + * @access protected * @param array $values Form values * @return array $valid, $errors [0] = Success or not, [1] = List of errors */ - private function validateLocking(array $values) + protected function validateLocking(array $values) { $result = true; $errors = array(); @@ -82,11 +71,11 @@ class AuthValidator extends Base /** * Validate password syntax * - * @access private + * @access protected * @param array $values Form values * @return array $valid, $errors [0] = Success or not, [1] = List of errors */ - private function validateCredentials(array $values) + protected function validateCredentials(array $values) { $result = true; $errors = array(); @@ -102,11 +91,11 @@ class AuthValidator extends Base /** * Validate captcha * - * @access private + * @access protected * @param array $values Form values * @return boolean */ - private function validateCaptcha(array $values) + protected function validateCaptcha(array $values) { $result = true; $errors = array(); |