From 8c532efd5f02f7a7e5ea322a07ddcf49d130a8ec Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 17 Oct 2015 10:09:03 -0400 Subject: Run php-cs-fixer on the code base --- app/Api/Action.php | 9 ++++----- app/Api/Auth.php | 6 ++---- app/Api/Base.php | 3 +-- app/Api/Category.php | 4 ++-- app/Api/Comment.php | 4 ++-- app/Api/File.php | 4 +--- app/Api/Link.php | 4 ++-- app/Api/Me.php | 2 +- app/Api/Project.php | 4 ++-- app/Api/Subtask.php | 4 ++-- app/Api/Task.php | 2 +- app/Api/User.php | 4 ++-- 12 files changed, 22 insertions(+), 28 deletions(-) (limited to 'app/Api') diff --git a/app/Api/Action.php b/app/Api/Action.php index eab20a6c..0ae91f10 100644 --- a/app/Api/Action.php +++ b/app/Api/Action.php @@ -35,10 +35,9 @@ class Action extends \Kanboard\Core\Base $actions = $this->action->getAllByProject($project_id); foreach ($actions as $index => $action) { - $params = array(); - foreach($action['params'] as $param) { + foreach ($action['params'] as $param) { $params[$param['name']] = $param['value']; } @@ -57,7 +56,7 @@ class Action extends \Kanboard\Core\Base 'params' => $params, ); - list($valid,) = $this->action->validateCreation($values); + list($valid, ) = $this->action->validateCreation($values); if (! $valid) { return false; @@ -80,14 +79,14 @@ class Action extends \Kanboard\Core\Base $required_params = $action->getActionRequiredParameters(); // Check missing parameters - foreach($required_params as $param => $value) { + foreach ($required_params as $param => $value) { if (! isset($params[$param])) { return false; } } // Check extra parameters - foreach($params as $param => $value) { + foreach ($params as $param => $value) { if (! isset($required_params[$param])) { return false; } diff --git a/app/Api/Auth.php b/app/Api/Auth.php index b741694b..b3627e4b 100644 --- a/app/Api/Auth.php +++ b/app/Api/Auth.php @@ -29,11 +29,9 @@ class Auth extends Base if ($username !== 'jsonrpc' && ! $this->authentication->hasCaptcha($username) && $this->authentication->authenticate($username, $password)) { $this->checkProcedurePermission(true, $method); $this->userSession->refresh($this->user->getByUsername($username)); - } - else if ($username === 'jsonrpc' && $password === $this->config->get('api_token')) { + } elseif ($username === 'jsonrpc' && $password === $this->config->get('api_token')) { $this->checkProcedurePermission(false, $method); - } - else { + } else { throw new AuthenticationFailure('Wrong credentials'); } } diff --git a/app/Api/Base.php b/app/Api/Base.php index 152ceeab..82397b20 100644 --- a/app/Api/Base.php +++ b/app/Api/Base.php @@ -50,8 +50,7 @@ abstract class Base extends \Kanboard\Core\Base if ($is_user && ! $is_both_procedure && ! $is_user_procedure) { throw new AccessDeniedException('Permission denied'); - } - else if (! $is_user && ! $is_both_procedure && $is_user_procedure) { + } elseif (! $is_user && ! $is_both_procedure && $is_user_procedure) { throw new AccessDeniedException('Permission denied'); } diff --git a/app/Api/Category.php b/app/Api/Category.php index 3e5b3a34..458eaef6 100644 --- a/app/Api/Category.php +++ b/app/Api/Category.php @@ -32,7 +32,7 @@ class Category extends \Kanboard\Core\Base 'name' => $name, ); - list($valid,) = $this->category->validateCreation($values); + list($valid, ) = $this->category->validateCreation($values); return $valid ? $this->category->create($values) : false; } @@ -43,7 +43,7 @@ class Category extends \Kanboard\Core\Base 'name' => $name, ); - list($valid,) = $this->category->validateModification($values); + list($valid, ) = $this->category->validateModification($values); return $valid && $this->category->update($values); } } diff --git a/app/Api/Comment.php b/app/Api/Comment.php index a13c36d4..26b632e9 100644 --- a/app/Api/Comment.php +++ b/app/Api/Comment.php @@ -33,7 +33,7 @@ class Comment extends \Kanboard\Core\Base 'comment' => $content, ); - list($valid,) = $this->comment->validateCreation($values); + list($valid, ) = $this->comment->validateCreation($values); return $valid ? $this->comment->create($values) : false; } @@ -45,7 +45,7 @@ class Comment extends \Kanboard\Core\Base 'comment' => $content, ); - list($valid,) = $this->comment->validateModification($values); + list($valid, ) = $this->comment->validateModification($values); return $valid && $this->comment->update($values); } } diff --git a/app/Api/File.php b/app/Api/File.php index 760ee5ed..be415ecb 100644 --- a/app/Api/File.php +++ b/app/Api/File.php @@ -25,14 +25,12 @@ class File extends \Kanboard\Core\Base public function downloadFile($file_id) { try { - $file = $this->file->getById($file_id); if (! empty($file)) { return base64_encode($this->objectStorage->get($file['path'])); } - } - catch (ObjectStorageException $e) { + } catch (ObjectStorageException $e) { $this->logger->error($e->getMessage()); } diff --git a/app/Api/Link.php b/app/Api/Link.php index 049fcddb..d4df18fe 100644 --- a/app/Api/Link.php +++ b/app/Api/Link.php @@ -72,7 +72,7 @@ class Link extends \Kanboard\Core\Base 'opposite_label' => $opposite_label, ); - list($valid,) = $this->link->validateCreation($values); + list($valid, ) = $this->link->validateCreation($values); return $valid ? $this->link->create($label, $opposite_label) : false; } @@ -93,7 +93,7 @@ class Link extends \Kanboard\Core\Base 'label' => $label, ); - list($valid,) = $this->link->validateModification($values); + list($valid, ) = $this->link->validateModification($values); return $valid && $this->link->update($values); } diff --git a/app/Api/Me.php b/app/Api/Me.php index f4857b58..16ce0aee 100644 --- a/app/Api/Me.php +++ b/app/Api/Me.php @@ -45,7 +45,7 @@ class Me extends Base 'is_private' => 1, ); - list($valid,) = $this->project->validateCreation($values); + list($valid, ) = $this->project->validateCreation($values); return $valid ? $this->project->create($values, $this->userSession->getId(), true) : false; } diff --git a/app/Api/Project.php b/app/Api/Project.php index 4c491ced..f934432d 100644 --- a/app/Api/Project.php +++ b/app/Api/Project.php @@ -69,7 +69,7 @@ class Project extends Base 'description' => $description ); - list($valid,) = $this->project->validateCreation($values); + list($valid, ) = $this->project->validateCreation($values); return $valid ? $this->project->create($values) : false; } @@ -81,7 +81,7 @@ class Project extends Base 'description' => $description ); - list($valid,) = $this->project->validateModification($values); + list($valid, ) = $this->project->validateModification($values); return $valid && $this->project->update($values); } } diff --git a/app/Api/Subtask.php b/app/Api/Subtask.php index 7b526023..7baee3d3 100644 --- a/app/Api/Subtask.php +++ b/app/Api/Subtask.php @@ -36,7 +36,7 @@ class Subtask extends \Kanboard\Core\Base 'status' => $status, ); - list($valid,) = $this->subtask->validateCreation($values); + list($valid, ) = $this->subtask->validateCreation($values); return $valid ? $this->subtask->create($values) : false; } @@ -58,7 +58,7 @@ class Subtask extends \Kanboard\Core\Base } } - list($valid,) = $this->subtask->validateApiModification($values); + list($valid, ) = $this->subtask->validateApiModification($values); return $valid && $this->subtask->update($values); } } diff --git a/app/Api/Task.php b/app/Api/Task.php index 8911c2f1..0dceb209 100644 --- a/app/Api/Task.php +++ b/app/Api/Task.php @@ -91,7 +91,7 @@ class Task extends Base 'reference' => $reference, ); - list($valid,) = $this->taskValidator->validateCreation($values); + list($valid, ) = $this->taskValidator->validateCreation($values); return $valid ? $this->taskCreation->create($values) : false; } diff --git a/app/Api/User.php b/app/Api/User.php index 00d35796..105723d3 100644 --- a/app/Api/User.php +++ b/app/Api/User.php @@ -39,7 +39,7 @@ class User extends \Kanboard\Core\Base 'is_project_admin' => $is_project_admin, ); - list($valid,) = $this->user->validateCreation($values); + list($valid, ) = $this->user->validateCreation($values); return $valid ? $this->user->create($values) : false; } @@ -81,7 +81,7 @@ class User extends \Kanboard\Core\Base } } - list($valid,) = $this->user->validateApiModification($values); + list($valid, ) = $this->user->validateApiModification($values); return $valid && $this->user->update($values); } } -- cgit v1.2.3