Minor code improvements

This commit is contained in:
Frederic Guillot
2016-01-16 22:29:29 -05:00
parent ff149c354e
commit 27b9b7a727
8 changed files with 11 additions and 30 deletions

View File

@@ -2,8 +2,6 @@
namespace Kanboard\Action;
use Kanboard\Model\Task;
/**
* Close automatically a task
*

View File

@@ -2,7 +2,6 @@
namespace Kanboard\Core\Http;
use RuntimeException;
use Kanboard\Core\Base;
/**

View File

@@ -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)
{

View File

@@ -4,7 +4,6 @@ namespace Kanboard\Model;
use Kanboard\Core\Translator;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Session\SessionManager;
/**
* Config model

View File

@@ -2,9 +2,6 @@
namespace Kanboard\Model;
use SimpleValidator\Validator;
use SimpleValidator\Validators;
/**
* Group Model
*

View File

@@ -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));
}
/**

View File

@@ -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;

View File

@@ -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();