Minor code improvements
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Kanboard\Action;
|
||||
|
||||
use Kanboard\Model\Task;
|
||||
|
||||
/**
|
||||
* Close automatically a task
|
||||
*
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Kanboard\Core\Http;
|
||||
|
||||
use RuntimeException;
|
||||
use Kanboard\Core\Base;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ class User
|
||||
* @access public
|
||||
* @param Client $client
|
||||
* @param string $username
|
||||
* @return array
|
||||
* @return LdapUserProvider
|
||||
*/
|
||||
public static function getUser(Client $client, $username)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Kanboard\Model;
|
||||
|
||||
use Kanboard\Core\Translator;
|
||||
use Kanboard\Core\Security\Token;
|
||||
use Kanboard\Core\Session\SessionManager;
|
||||
|
||||
/**
|
||||
* Config model
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace Kanboard\Model;
|
||||
|
||||
use SimpleValidator\Validator;
|
||||
use SimpleValidator\Validators;
|
||||
|
||||
/**
|
||||
* Group Model
|
||||
*
|
||||
|
||||
@@ -28,7 +28,7 @@ class ProjectUserRole extends Base
|
||||
*/
|
||||
public function getActiveProjectsByUser($user_id)
|
||||
{
|
||||
return $this->getProjectsByUser($user_id, $status = array(Project::ACTIVE));
|
||||
return $this->getProjectsByUser($user_id, array(Project::ACTIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ use Kanboard\Subscriber\NotificationSubscriber;
|
||||
use Kanboard\Subscriber\ProjectDailySummarySubscriber;
|
||||
use Kanboard\Subscriber\ProjectModificationDateSubscriber;
|
||||
use Kanboard\Subscriber\SubtaskTimeTrackingSubscriber;
|
||||
use Kanboard\Subscriber\TaskMovedDateSubscriber;
|
||||
use Kanboard\Subscriber\TransitionSubscriber;
|
||||
use Kanboard\Subscriber\RecurringTaskSubscriber;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user