summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/Action.php8
-rw-r--r--app/Model/Authentication.php11
-rw-r--r--app/Model/Base.php2
-rw-r--r--app/Model/Board.php8
-rw-r--r--app/Model/Category.php2
-rw-r--r--app/Model/Color.php3
-rw-r--r--app/Model/File.php15
-rw-r--r--app/Model/LastLogin.php1
-rw-r--r--app/Model/Link.php1
-rw-r--r--app/Model/NotificationType.php2
-rw-r--r--app/Model/ProjectActivity.php6
-rw-r--r--app/Model/ProjectAnalytic.php2
-rw-r--r--app/Model/ProjectDailyColumnStats.php4
-rw-r--r--app/Model/ProjectDailyStats.php2
-rw-r--r--app/Model/ProjectPermission.php5
-rw-r--r--app/Model/Subtask.php3
-rw-r--r--app/Model/SubtaskTimeTracking.php1
-rw-r--r--app/Model/Swimlane.php7
-rw-r--r--app/Model/TaskAnalytic.php1
-rw-r--r--app/Model/TaskCreation.php1
-rwxr-xr-xapp/Model/TaskDuplication.php3
-rw-r--r--app/Model/TaskFilter.php20
-rw-r--r--app/Model/TaskImport.php6
-rw-r--r--app/Model/TaskLink.php1
-rw-r--r--app/Model/TaskModification.php3
-rw-r--r--app/Model/TaskPermission.php3
-rw-r--r--app/Model/TaskPosition.php12
-rw-r--r--app/Model/User.php10
-rw-r--r--app/Model/UserImport.php6
-rw-r--r--app/Model/UserNotification.php6
-rw-r--r--app/Model/Webhook.php4
31 files changed, 42 insertions, 117 deletions
diff --git a/app/Model/Action.php b/app/Model/Action.php
index b48e3ae3..ba74218f 100644
--- a/app/Model/Action.php
+++ b/app/Model/Action.php
@@ -184,7 +184,6 @@ class Action extends Base
$params = $this->db->table(self::TABLE_PARAMS)->findAll();
foreach ($actions as &$action) {
-
$action['params'] = array();
foreach ($params as $param) {
@@ -270,7 +269,6 @@ class Action extends Base
$action_id = $this->db->getLastId();
foreach ($values['params'] as $param_name => $param_value) {
-
$action_param = array(
'action_id' => $action_id,
'name' => $param_name,
@@ -298,7 +296,6 @@ class Action extends Base
$actions = $this->getAll();
foreach ($actions as $action) {
-
$listener = $this->load($action['action_name'], $action['project_id'], $action['event_name']);
foreach ($action['params'] as $param) {
@@ -320,7 +317,8 @@ class Action extends Base
*/
public function load($name, $project_id, $event)
{
- $className = $name{0} !== '\\' ? '\Kanboard\Action\\'.$name : $name;
+ $className = $name{0}
+ !== '\\' ? '\Kanboard\Action\\'.$name : $name;
return new $className($this->container, $project_id, $event);
}
@@ -337,7 +335,6 @@ class Action extends Base
$actions = $this->action->getAllByProject($src_project_id);
foreach ($actions as $action) {
-
$this->db->startTransaction();
$values = array(
@@ -378,7 +375,6 @@ class Action extends Base
public function duplicateParameters($project_id, $action_id, array $params)
{
foreach ($params as $param) {
-
$value = $this->resolveParameters($param, $project_id);
if ($value === false) {
diff --git a/app/Model/Authentication.php b/app/Model/Authentication.php
index acd563bc..116e0726 100644
--- a/app/Model/Authentication.php
+++ b/app/Model/Authentication.php
@@ -79,12 +79,10 @@ class Authentication extends Base
if ($this->user->isLocked($username)) {
$this->container['logger']->error('Account locked: '.$username);
return false;
- }
- else if ($this->backend('database')->authenticate($username, $password)) {
+ } elseif ($this->backend('database')->authenticate($username, $password)) {
$this->user->resetFailedLogin($username);
return true;
- }
- else if (LDAP_AUTH && $this->backend('ldap')->authenticate($username, $password)) {
+ } elseif (LDAP_AUTH && $this->backend('ldap')->authenticate($username, $password)) {
$this->user->resetFailedLogin($username);
return true;
}
@@ -133,11 +131,9 @@ class Authentication extends Base
list($result, $errors) = $this->validateFormCredentials($values);
if ($result) {
-
if ($this->validateFormCaptcha($values) && $this->authenticate($values['username'], $values['password'])) {
$this->createRememberMeSession($values);
- }
- else {
+ } else {
$result = false;
$errors['login'] = t('Bad username or password');
}
@@ -194,7 +190,6 @@ class Authentication extends Base
private function createRememberMeSession(array $values)
{
if (REMEMBER_ME_AUTH && ! empty($values['remember_me'])) {
-
$credentials = $this->backend('rememberMe')
->create($this->userSession->getId(), Request::getIpAddress(), Request::getUserAgent());
diff --git a/app/Model/Base.php b/app/Model/Base.php
index 4c7ada7c..ab07949b 100644
--- a/app/Model/Base.php
+++ b/app/Model/Base.php
@@ -22,7 +22,7 @@ abstract class Base extends \Kanboard\Core\Base
*/
public function persist($table, array $values)
{
- return $this->db->transaction(function($db) use ($table, $values) {
+ return $this->db->transaction(function ($db) use ($table, $values) {
if (! $db->table($table)->save($values)) {
return false;
diff --git a/app/Model/Board.php b/app/Model/Board.php
index 6b450d22..3af2e83d 100644
--- a/app/Model/Board.php
+++ b/app/Model/Board.php
@@ -43,7 +43,6 @@ class Board extends Base
$columns = array();
foreach ($column_names as $column_name) {
-
$column_name = trim($column_name);
if (! empty($column_name)) {
@@ -67,7 +66,6 @@ class Board extends Base
$position = 0;
foreach ($columns as $column) {
-
$values = array(
'title' => $column['title'],
'position' => ++$position,
@@ -120,7 +118,7 @@ class Board extends Base
'title' => $title,
'task_limit' => intval($task_limit),
'position' => $this->getLastColumnPosition($project_id) + 1,
- 'description' => $description,
+ 'description' => $description,
);
return $this->persist(self::TABLE, $values);
@@ -199,7 +197,6 @@ class Board extends Base
$positions = array_flip($columns);
if (isset($columns[$column_id]) && $columns[$column_id] < count($columns)) {
-
$position = ++$columns[$column_id];
$columns[$positions[$position]]--;
@@ -223,7 +220,6 @@ class Board extends Base
$positions = array_flip($columns);
if (isset($columns[$column_id]) && $columns[$column_id] > 1) {
-
$position = --$columns[$column_id];
$columns[$positions[$position]]++;
@@ -248,14 +244,12 @@ class Board extends Base
$nb_columns = count($columns);
for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) {
-
$swimlanes[$i]['columns'] = $columns;
$swimlanes[$i]['nb_columns'] = $nb_columns;
$swimlanes[$i]['nb_tasks'] = 0;
$swimlanes[$i]['nb_swimlanes'] = $ilen;
for ($j = 0; $j < $nb_columns; $j++) {
-
$column_id = $columns[$j]['id'];
$swimlane_id = $swimlanes[$i]['id'];
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 9cc2a193..bf40c60a 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -128,7 +128,6 @@ class Category extends Base
$categories = explode(',', $this->config->get('project_categories'));
foreach ($categories as $category) {
-
$category = trim($category);
if (! empty($category)) {
@@ -204,7 +203,6 @@ class Category extends Base
->findAll();
foreach ($categories as $category) {
-
$category['project_id'] = $dst_project_id;
if (! $this->db->table(self::TABLE)->save($category)) {
diff --git a/app/Model/Color.php b/app/Model/Color.php
index 4ded2e1e..d341dd3c 100644
--- a/app/Model/Color.php
+++ b/app/Model/Color.php
@@ -113,8 +113,7 @@ class Color extends Base
foreach ($this->default_colors as $color_id => $params) {
if ($color_id === $color) {
return $color_id;
- }
- else if ($color === strtolower($params['name'])) {
+ } elseif ($color === strtolower($params['name'])) {
return $color_id;
}
}
diff --git a/app/Model/File.php b/app/Model/File.php
index e4430217..daade517 100644
--- a/app/Model/File.php
+++ b/app/Model/File.php
@@ -50,7 +50,6 @@ class File extends Base
public function remove($file_id)
{
try {
-
$file = $this->getbyId($file_id);
$this->objectStorage->remove($file['path']);
@@ -59,8 +58,7 @@ class File extends Base
}
return $this->db->table(self::TABLE)->eq('id', $file['id'])->remove();
- }
- catch (ObjectStorageException $e) {
+ } catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
return false;
}
@@ -108,7 +106,6 @@ class File extends Base
));
if ($result) {
-
$this->container['dispatcher']->dispatch(
self::EVENT_CREATE,
new FileEvent(array('task_id' => $task_id, 'name' => $name))
@@ -266,15 +263,12 @@ class File extends Base
public function uploadFiles($project_id, $task_id, $form_name)
{
try {
-
if (empty($_FILES[$form_name])) {
return false;
}
foreach ($_FILES[$form_name]['error'] as $key => $error) {
-
if ($error == UPLOAD_ERR_OK && $_FILES[$form_name]['size'][$key] > 0) {
-
$original_filename = $_FILES[$form_name]['name'][$key];
$uploaded_filename = $_FILES[$form_name]['tmp_name'][$key];
$destination_filename = $this->generatePath($project_id, $task_id, $original_filename);
@@ -295,8 +289,7 @@ class File extends Base
}
return true;
- }
- catch (ObjectStorageException $e) {
+ } catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
return false;
}
@@ -330,7 +323,6 @@ class File extends Base
public function uploadContent($project_id, $task_id, $original_filename, $blob)
{
try {
-
$data = base64_decode($blob);
if (empty($data)) {
@@ -350,8 +342,7 @@ class File extends Base
$destination_filename,
strlen($data)
);
- }
- catch (ObjectStorageException $e) {
+ } catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
return false;
}
diff --git a/app/Model/LastLogin.php b/app/Model/LastLogin.php
index f4be8a9d..0f148ead 100644
--- a/app/Model/LastLogin.php
+++ b/app/Model/LastLogin.php
@@ -44,7 +44,6 @@ class LastLogin extends Base
->findAllByColumn('id');
if (count($connections) >= self::NB_LOGINS) {
-
$this->db->table(self::TABLE)
->eq('user_id', $user_id)
->notin('id', array_slice($connections, 0, self::NB_LOGINS - 1))
diff --git a/app/Model/Link.php b/app/Model/Link.php
index 4e1b4e6b..00b6dfc5 100644
--- a/app/Model/Link.php
+++ b/app/Model/Link.php
@@ -126,7 +126,6 @@ class Link extends Base
$label_id = $this->db->getLastId();
if (! empty($opposite_label)) {
-
$this->db
->table(self::TABLE)
->insert(array(
diff --git a/app/Model/NotificationType.php b/app/Model/NotificationType.php
index 9ec250ab..50d6080f 100644
--- a/app/Model/NotificationType.php
+++ b/app/Model/NotificationType.php
@@ -53,7 +53,7 @@ abstract class NotificationType extends Base
$container = $this->container;
$this->labels[$type] = $label;
- $this->classes[$type] = function() use ($class, $container) {
+ $this->classes[$type] = function () use ($class, $container) {
return new $class($container);
};
}
diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php
index 527abf58..2cc1c975 100644
--- a/app/Model/ProjectActivity.php
+++ b/app/Model/ProjectActivity.php
@@ -138,18 +138,17 @@ class ProjectActivity extends Base
*/
private function getEvents(\PicoDb\Table $query, $start, $end)
{
- if (! is_null($start)){
+ if (! is_null($start)) {
$query->gte('date_creation', $start);
}
- if (! is_null($end)){
+ if (! is_null($end)) {
$query->lte('date_creation', $end);
}
$events = $query->findAll();
foreach ($events as &$event) {
-
$event += $this->decode($event['data']);
unset($event['data']);
@@ -170,7 +169,6 @@ class ProjectActivity extends Base
public function cleanup($max)
{
if ($this->db->table(self::TABLE)->count() > $max) {
-
$this->db->execute('
DELETE FROM '.self::TABLE.'
WHERE id <= (
diff --git a/app/Model/ProjectAnalytic.php b/app/Model/ProjectAnalytic.php
index 34d152d1..92364c0c 100644
--- a/app/Model/ProjectAnalytic.php
+++ b/app/Model/ProjectAnalytic.php
@@ -24,7 +24,6 @@ class ProjectAnalytic extends Base
$columns = $this->board->getColumns($project_id);
foreach ($columns as $column) {
-
$nb_tasks = $this->taskFinder->countByColumnId($project_id, $column['id']);
$total += $nb_tasks;
@@ -60,7 +59,6 @@ class ProjectAnalytic extends Base
$users = $this->projectPermission->getMemberList($project_id);
foreach ($tasks as $task) {
-
$user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0];
$total++;
diff --git a/app/Model/ProjectDailyColumnStats.php b/app/Model/ProjectDailyColumnStats.php
index 2228dcf8..abab0241 100644
--- a/app/Model/ProjectDailyColumnStats.php
+++ b/app/Model/ProjectDailyColumnStats.php
@@ -32,7 +32,7 @@ class ProjectDailyColumnStats extends Base
{
$status = $this->config->get('cfd_include_closed_tasks') == 1 ? array(Task::STATUS_OPEN, Task::STATUS_CLOSED) : array(Task::STATUS_OPEN);
- return $this->db->transaction(function($db) use ($project_id, $date, $status) {
+ return $this->db->transaction(function ($db) use ($project_id, $date, $status) {
$column_ids = $db->table(Board::TABLE)->eq('project_id', $project_id)->findAllByColumn('id');
@@ -171,7 +171,6 @@ class ProjectDailyColumnStats extends Base
// Aggregate by day
foreach ($records as $record) {
-
if (! isset($aggregates[$record['day']])) {
$aggregates[$record['day']] = array($record['day']);
}
@@ -181,7 +180,6 @@ class ProjectDailyColumnStats extends Base
// Aggregate by row
foreach ($aggregates as $aggregate) {
-
$row = array($aggregate[0]);
foreach ($column_ids as $column_id) {
diff --git a/app/Model/ProjectDailyStats.php b/app/Model/ProjectDailyStats.php
index b98c23ff..538aea1a 100644
--- a/app/Model/ProjectDailyStats.php
+++ b/app/Model/ProjectDailyStats.php
@@ -29,7 +29,7 @@ class ProjectDailyStats extends Base
{
$lead_cycle_time = $this->projectAnalytic->getAverageLeadAndCycleTime($project_id);
- return $this->db->transaction(function($db) use ($project_id, $date, $lead_cycle_time) {
+ return $this->db->transaction(function ($db) use ($project_id, $date, $lead_cycle_time) {
// This call will fail if the record already exists
// (cross database driver hack for INSERT..ON DUPLICATE KEY UPDATE)
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php
index 36987d47..d9eef4db 100644
--- a/app/Model/ProjectPermission.php
+++ b/app/Model/ProjectPermission.php
@@ -280,9 +280,9 @@ class ProjectPermission extends Base
->eq('project_id', $project_id)
->eq('user_id', $user_id)
->exists();
- }
+ }
- /**
+ /**
* Check if a specific user is manager of a given project
*
* @access public
@@ -439,7 +439,6 @@ class ProjectPermission extends Base
->findAll();
foreach ($rows as $row) {
-
$result = $this->db
->table(self::TABLE)
->save(array(
diff --git a/app/Model/Subtask.php b/app/Model/Subtask.php
index bb6606b3..94b13a0e 100644
--- a/app/Model/Subtask.php
+++ b/app/Model/Subtask.php
@@ -148,7 +148,6 @@ class Subtask extends Base
public function getById($subtask_id, $more = false)
{
if ($more) {
-
return $this->db
->table(self::TABLE)
->eq(self::TABLE.'.id', $subtask_id)
@@ -341,7 +340,6 @@ class Subtask extends Base
$positions = array_flip($subtasks);
if (isset($subtasks[$subtask_id]) && $subtasks[$subtask_id] > 1) {
-
$position = --$subtasks[$subtask_id];
$subtasks[$positions[$position]]++;
@@ -446,7 +444,6 @@ class Subtask extends Base
->findAll();
foreach ($subtasks as &$subtask) {
-
$subtask['task_id'] = $dst_task_id;
if (! $db->table(Subtask::TABLE)->save($subtask)) {
diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php
index 86a4b213..a741dbb5 100644
--- a/app/Model/SubtaskTimeTracking.php
+++ b/app/Model/SubtaskTimeTracking.php
@@ -214,7 +214,6 @@ class SubtaskTimeTracking extends Base
$events = array();
foreach ($rows as $row) {
-
$user = isset($row['username']) ? ' ('.($row['user_fullname'] ?: $row['username']).')' : '';
$events[] = array(
diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php
index 1aa19fee..df44985a 100644
--- a/app/Model/Swimlane.php
+++ b/app/Model/Swimlane.php
@@ -142,8 +142,7 @@ class Swimlane extends Base
if ($status == self::ACTIVE) {
$query->asc('position');
- }
- else {
+ } else {
$query->asc('name');
}
@@ -172,7 +171,6 @@ class Swimlane extends Base
->findOneColumn('default_swimlane');
if ($default_swimlane) {
-
if ($default_swimlane === 'Default swimlane') {
$default_swimlane = t($default_swimlane);
}
@@ -396,7 +394,6 @@ class Swimlane extends Base
$positions = array_flip($swimlanes);
if (isset($swimlanes[$swimlane_id]) && $swimlanes[$swimlane_id] < count($swimlanes)) {
-
$position = ++$swimlanes[$swimlane_id];
$swimlanes[$positions[$position]]--;
@@ -430,7 +427,6 @@ class Swimlane extends Base
$positions = array_flip($swimlanes);
if (isset($swimlanes[$swimlane_id]) && $swimlanes[$swimlane_id] > 1) {
-
$position = --$swimlanes[$swimlane_id];
$swimlanes[$positions[$position]]++;
@@ -459,7 +455,6 @@ class Swimlane extends Base
$swimlanes = $this->getAll($project_from);
foreach ($swimlanes as $swimlane) {
-
unset($swimlane['id']);
$swimlane['project_id'] = $project_to;
diff --git a/app/Model/TaskAnalytic.php b/app/Model/TaskAnalytic.php
index c6d4191c..bdfec3cb 100644
--- a/app/Model/TaskAnalytic.php
+++ b/app/Model/TaskAnalytic.php
@@ -52,7 +52,6 @@ class TaskAnalytic extends Base
$sums = $this->transition->getTimeSpentByTask($task['id']);
foreach ($columns as $column_id => $column_title) {
-
$time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0;
if ($task['column_id'] == $column_id) {
diff --git a/app/Model/TaskCreation.php b/app/Model/TaskCreation.php
index b6d8fbae..5ef1a04b 100644
--- a/app/Model/TaskCreation.php
+++ b/app/Model/TaskCreation.php
@@ -31,7 +31,6 @@ class TaskCreation extends Base
$task_id = $this->persist(Task::TABLE, $values);
if ($task_id !== false) {
-
if ($position > 0 && $values['position'] > 1) {
$this->taskPosition->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false);
}
diff --git a/app/Model/TaskDuplication.php b/app/Model/TaskDuplication.php
index 60fcac0c..e81fb232 100755
--- a/app/Model/TaskDuplication.php
+++ b/app/Model/TaskDuplication.php
@@ -63,7 +63,6 @@ class TaskDuplication extends Base
$values = $this->copyFields($task_id);
if ($values['recurrence_status'] == Task::RECURRING_STATUS_PENDING) {
-
$values['recurrence_parent'] = $task_id;
$values['column_id'] = $this->board->getFirstColumn($values['project_id']);
$this->calculateRecurringTaskDueDate($values);
@@ -71,7 +70,6 @@ class TaskDuplication extends Base
$recurring_task_id = $this->save($task_id, $values);
if ($recurring_task_id > 0) {
-
$parent_update = $this->db
->table(Task::TABLE)
->eq('id', $task_id)
@@ -203,7 +201,6 @@ class TaskDuplication extends Base
public function calculateRecurringTaskDueDate(array &$values)
{
if (! empty($values['date_due']) && $values['recurrence_factor'] != 0) {
-
if ($values['recurrence_basedate'] == Task::RECURRING_BASEDATE_TRIGGERDATE) {
$values['date_due'] = time();
}
diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php
index 6500edda..137a7a8e 100644
--- a/app/Model/TaskFilter.php
+++ b/app/Model/TaskFilter.php
@@ -193,8 +193,7 @@ class TaskFilter extends Base
$this->query->eq(Task::TABLE.'.id', str_replace('#', '', $title));
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
$this->query->closeOr();
- }
- else {
+ } else {
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
}
@@ -244,8 +243,7 @@ class TaskFilter extends Base
foreach ($values as $project) {
if (ctype_digit($project)) {
$this->query->eq(Task::TABLE.'.project_id', $project);
- }
- else {
+ } else {
$this->query->ilike(Project::TABLE.'.name', $project);
}
}
@@ -267,8 +265,7 @@ class TaskFilter extends Base
foreach ($values as $swimlane) {
if ($swimlane === 'default') {
$this->query->eq(Task::TABLE.'.swimlane_id', 0);
- }
- else {
+ } else {
$this->query->ilike(Swimlane::TABLE.'.name', $swimlane);
$this->query->addCondition(Task::TABLE.'.swimlane_id=0 AND '.Project::TABLE.'.default_swimlane '.$this->db->getDriver()->getOperator('ILIKE')." '$swimlane'");
}
@@ -307,8 +304,7 @@ class TaskFilter extends Base
foreach ($values as $category) {
if ($category === 'none') {
$this->query->eq(Task::TABLE.'.category_id', 0);
- }
- else {
+ } else {
$this->query->eq(Category::TABLE.'.name', $category);
}
}
@@ -379,8 +375,7 @@ class TaskFilter extends Base
foreach ($values as $assignee) {
if ($assignee === 'me') {
$subtaskQuery->eq(Subtask::TABLE.'.user_id', $this->userSession->getId());
- }
- else {
+ } else {
$subtaskQuery->ilike(User::TABLE.'.username', '%'.$assignee.'%');
$subtaskQuery->ilike(User::TABLE.'.name', '%'.$assignee.'%');
}
@@ -646,7 +641,7 @@ class TaskFilter extends Base
$tasks = $this->filterByProject($project_id)->query->asc(Task::TABLE.'.position')->findAll();
return $this->board->getBoard($project_id, function ($project_id, $column_id, $swimlane_id) use ($tasks) {
- return array_filter($tasks, function(array $task) use ($column_id, $swimlane_id) {
+ return array_filter($tasks, function (array $task) use ($column_id, $swimlane_id) {
return $task['column_id'] == $column_id && $task['swimlane_id'] == $swimlane_id;
});
});
@@ -682,8 +677,7 @@ class TaskFilter extends Base
$timestamp = $this->dateParser->getTimestampFromIsoFormat($value);
$this->query->gte($field, $timestamp);
$this->query->lte($field, $timestamp + 86399);
- }
- else {
+ } else {
$this->query->eq($field, $value);
}
diff --git a/app/Model/TaskImport.php b/app/Model/TaskImport.php
index 92c8f400..da34559f 100644
--- a/app/Model/TaskImport.php
+++ b/app/Model/TaskImport.php
@@ -71,12 +71,10 @@ class TaskImport extends Base
if ($this->taskCreation->create($row) > 0) {
$this->logger->debug('TaskImport: imported successfully line '.$line_number);
$this->counter++;
- }
- else {
+ } else {
$this->logger->error('TaskImport: creation error at line '.$line_number);
}
- }
- else {
+ } else {
$this->logger->error('TaskImport: validation error at line '.$line_number);
}
}
diff --git a/app/Model/TaskLink.php b/app/Model/TaskLink.php
index fafcde65..1ac59203 100644
--- a/app/Model/TaskLink.php
+++ b/app/Model/TaskLink.php
@@ -112,7 +112,6 @@ class TaskLink extends Base
$result = array();
foreach ($links as $link) {
-
if (! isset($result[$link['label']])) {
$result[$link['label']] = array();
}
diff --git a/app/Model/TaskModification.php b/app/Model/TaskModification.php
index 9cca5b30..781646b8 100644
--- a/app/Model/TaskModification.php
+++ b/app/Model/TaskModification.php
@@ -51,8 +51,7 @@ class TaskModification extends Base
if ($this->isFieldModified('owner_id', $event_data['changes'])) {
$events[] = Task::EVENT_ASSIGNEE_CHANGE;
- }
- else {
+ } else {
$events[] = Task::EVENT_CREATE_UPDATE;
$events[] = Task::EVENT_UPDATE;
}
diff --git a/app/Model/TaskPermission.php b/app/Model/TaskPermission.php
index 501c8edc..4bbe6d1d 100644
--- a/app/Model/TaskPermission.php
+++ b/app/Model/TaskPermission.php
@@ -22,8 +22,7 @@ class TaskPermission extends Base
{
if ($this->userSession->isAdmin() || $this->projectPermission->isManager($task['project_id'], $this->userSession->getId())) {
return true;
- }
- else if (isset($task['creator_id']) && $task['creator_id'] == $this->userSession->getId()) {
+ } elseif (isset($task['creator_id']) && $task['creator_id'] == $this->userSession->getId()) {
return true;
}
diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPosition.php
index 1ad17b36..da363cb3 100644
--- a/app/Model/TaskPosition.php
+++ b/app/Model/TaskPosition.php
@@ -41,11 +41,9 @@ class TaskPosition extends Base
if ($task['swimlane_id'] != $swimlane_id) {
$result = $this->saveSwimlaneChange($project_id, $task_id, $position, $task['column_id'], $column_id, $task['swimlane_id'], $swimlane_id);
- }
- else if ($task['column_id'] != $column_id) {
+ } elseif ($task['column_id'] != $column_id) {
$result = $this->saveColumnChange($project_id, $task_id, $position, $swimlane_id, $task['column_id'], $column_id);
- }
- else if ($task['position'] != $position) {
+ } elseif ($task['position'] != $position) {
$result = $this->savePositionChange($project_id, $task_id, $position, $column_id, $swimlane_id);
}
@@ -224,11 +222,9 @@ class TaskPosition extends Base
if ($task['swimlane_id'] != $new_swimlane_id) {
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data));
- }
- else if ($task['column_id'] != $new_column_id) {
+ } elseif ($task['column_id'] != $new_column_id) {
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_COLUMN, new TaskEvent($event_data));
- }
- else if ($task['position'] != $new_position) {
+ } elseif ($task['position'] != $new_position) {
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_POSITION, new TaskEvent($event_data));
}
}
diff --git a/app/Model/User.php b/app/Model/User.php
index 138b77b2..c4d26c9c 100644
--- a/app/Model/User.php
+++ b/app/Model/User.php
@@ -280,11 +280,9 @@ class User extends Base
public function prepare(array &$values)
{
if (isset($values['password'])) {
-
if (! empty($values['password'])) {
$values['password'] = \password_hash($values['password'], PASSWORD_BCRYPT);
- }
- else {
+ } else {
unset($values['password']);
}
}
@@ -516,8 +514,7 @@ class User extends Base
if (isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1) {
$v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
- }
- else {
+ } else {
$v = new Validator($values, array_merge($rules, $this->commonValidationRules(), $this->commonPasswordValidationRules()));
}
@@ -591,8 +588,7 @@ class User extends Base
// Check password
if ($this->authentication->authenticate($this->session['user']['username'], $values['current_password'])) {
return array(true, array());
- }
- else {
+ } else {
return array(false, array('current_password' => array(t('Wrong password'))));
}
}
diff --git a/app/Model/UserImport.php b/app/Model/UserImport.php
index 1a398d12..199f2a90 100644
--- a/app/Model/UserImport.php
+++ b/app/Model/UserImport.php
@@ -56,12 +56,10 @@ class UserImport extends Base
if ($this->user->create($row)) {
$this->logger->debug('UserImport: imported successfully line '.$line_number);
$this->counter++;
- }
- else {
+ } else {
$this->logger->error('UserImport: creation error at line '.$line_number);
}
- }
- else {
+ } else {
$this->logger->error('UserImport: validation error at line '.$line_number);
}
}
diff --git a/app/Model/UserNotification.php b/app/Model/UserNotification.php
index b4ee77a9..3d98ebe9 100644
--- a/app/Model/UserNotification.php
+++ b/app/Model/UserNotification.php
@@ -51,8 +51,7 @@ class UserNotification extends Base
// Use the user language otherwise use the application language (do not use the session language)
if (! empty($user['language'])) {
Translator::load($user['language']);
- }
- else {
+ } else {
Translator::load($this->config->get('application_language', 'en_US'));
}
@@ -123,8 +122,7 @@ class UserNotification extends Base
$this->userNotificationFilter->saveFilter($user_id, $filter);
$this->userNotificationFilter->saveSelectedProjects($user_id, $projects);
$this->userNotificationType->saveSelectedTypes($user_id, $types);
- }
- else {
+ } else {
$this->disableNotification($user_id);
}
diff --git a/app/Model/Webhook.php b/app/Model/Webhook.php
index dd277bf8..7c17e61e 100644
--- a/app/Model/Webhook.php
+++ b/app/Model/Webhook.php
@@ -22,11 +22,9 @@ class Webhook extends Base
$token = $this->config->get('webhook_token');
if (! empty($url)) {
-
if (strpos($url, '?') !== false) {
$url .= '&token='.$token;
- }
- else {
+ } else {
$url .= '?token='.$token;
}