From 8f6e923e8507c3bf0d90d4237185ef3a396a01f3 Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Wed, 18 Jan 2017 12:44:19 +0100 Subject: [PATCH] Fix indentation --- lib/Service/BoardService.php | 15 ++++-------- lib/Service/CardService.php | 40 +++++++++++++++---------------- lib/Service/LabelService.php | 5 +--- lib/Service/PermissionService.php | 21 +++++++--------- 4 files changed, 33 insertions(+), 48 deletions(-) diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index 8b59b65fa..4bcbdd25e 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -43,13 +43,7 @@ class BoardService { private $l10n; private $permissionService; - public function __construct( - BoardMapper $boardMapper, - IL10N $l10n, - LabelMapper $labelMapper, - AclMapper $aclMapper, - PermissionService $permissionService - ) { + public function __construct(BoardMapper $boardMapper, IL10N $l10n, LabelMapper $labelMapper, AclMapper $aclMapper, PermissionService $permissionService) { $this->boardMapper = $boardMapper; $this->labelMapper = $labelMapper; $this->aclMapper = $aclMapper; @@ -78,10 +72,11 @@ class BoardService { // create new labels $default_labels = [ - '31CC7C' => $this->l10n->t('Finished'), - '317CCC' => $this->l10n->t('To review'), + '31CC7C' => $this->l10n->t('Finished'), + '317CCC' => $this->l10n->t('To review'), 'FF7A66' => $this->l10n->t('Action needed'), - 'F1DB50' => $this->l10n->t('Later')]; + 'F1DB50' => $this->l10n->t('Later') + ]; $labels = []; foreach ($default_labels as $color => $title) { $label = new Label(); diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 0878302fe..8d6082b3a 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -5,20 +5,20 @@ * @author Julius Härtl * * @license GNU AGPL version 3 or any later version - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * + * */ namespace OCA\Deck\Service; @@ -30,15 +30,11 @@ use OCA\Deck\CardArchivedException; use OCA\Deck\Db\StackMapper; -class CardService { +class CardService { private $cardMapper; - public function __construct( - CardMapper $cardMapper, - StackMapper $stackMapper, - PermissionService $permissionService - ) { + public function __construct(CardMapper $cardMapper, StackMapper $stackMapper, PermissionService $permissionService) { $this->cardMapper = $cardMapper; $this->stackMapper = $stackMapper; $this->permissionService = $permissionService; @@ -48,6 +44,7 @@ class CardService { $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ); return $this->cardMapper->find($cardId); } + public function create($title, $stackId, $type, $order, $owner) { $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); $card = new Card(); @@ -68,7 +65,7 @@ class CardService { public function update($id, $title, $stackId, $type, $order, $description, $owner) { $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); $card = $this->cardMapper->find($id); - if($card->getArchived()) { + if ($card->getArchived()) { throw new CardArchivedException(); } $card->setTitle($title); @@ -83,30 +80,31 @@ class CardService { public function rename($id, $title) { $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); $card = $this->cardMapper->find($id); - if($card->getArchived()) { + if ($card->getArchived()) { throw new CardArchivedException(); } $card->setTitle($title); return $this->cardMapper->update($card); } + public function reorder($id, $stackId, $order) { $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); $cards = $this->cardMapper->findAll($stackId); $result = []; $i = 0; foreach ($cards as $card) { - if($card->getArchived()) { + if ($card->getArchived()) { throw new CardArchivedException(); } - if($card->id === $id) { + if ($card->id === $id) { $card->setOrder($order); - $card->setLastModified(time()); - } + $card->setLastModified(time()); + } - if($i === $order) + if ($i === $order) $i++; - if($card->id !== $id) { + if ($card->id !== $id) { $card->setOrder($i++); } $this->cardMapper->update($card); @@ -122,7 +120,7 @@ class CardService { $card->setArchived(true); return $this->cardMapper->update($card); } - + public function unarchive($id) { $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); $card = $this->cardMapper->find($id); @@ -133,7 +131,7 @@ class CardService { public function assignLabel($cardId, $labelId) { $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); $card = $this->cardMapper->find($cardId); - if($card->getArchived()) { + if ($card->getArchived()) { throw new CardArchivedException(); } $this->cardMapper->assignLabel($cardId, $labelId); @@ -142,7 +140,7 @@ class CardService { public function removeLabel($cardId, $labelId) { $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); $card = $this->cardMapper->find($cardId); - if($card->getArchived()) { + if ($card->getArchived()) { throw new CardArchivedException(); } $this->cardMapper->removeLabel($cardId, $labelId); diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index 9e88f93be..ef5c9944c 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -32,10 +32,7 @@ class LabelService { private $labelMapper; - public function __construct( - LabelMapper $labelMapper, - PermissionService $permissionService - ) { + public function __construct(LabelMapper $labelMapper, PermissionService $permissionService) { $this->labelMapper = $labelMapper; $this->permissionService = $permissionService; } diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index 1e9ff905a..612446201 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -43,12 +43,7 @@ class PermissionService { private $logger; private $userId; - public function __construct(ILogger $logger, - AclMapper $aclMapper, - BoardMapper $boardMapper, - IGroupManager $groupManager, - $userId - ) { + public function __construct(ILogger $logger, AclMapper $aclMapper, BoardMapper $boardMapper, IGroupManager $groupManager, $userId) { $this->aclMapper = $aclMapper; $this->boardMapper = $boardMapper; $this->logger = $logger; @@ -82,14 +77,14 @@ class PermissionService { * @return bool * @throws NoPermissionException */ - public function checkPermission($mapper, $id, $permission) { - try { - if($mapper instanceof IPermissionMapper) { + public function checkPermission($mapper, $id, $permission) { + try { + if ($mapper instanceof IPermissionMapper) { $boardId = $mapper->findBoardId($id); } else { - $boardId = $id; + $boardId = $id; } - if($boardId === null) { + if ($boardId === null) { // Throw NoPermission to not leak information about existing entries throw new NoPermissionException('Permission denied'); } @@ -104,8 +99,8 @@ class PermissionService { } } catch (DoesNotExistException $exception) { - // Throw NoPermission to not leak information about existing entries - throw new NoPermissionException('Permission denied'); + // Throw NoPermission to not leak information about existing entries + throw new NoPermissionException('Permission denied'); } throw new NoPermissionException('Permission denied.');