diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 6928b3335..aee4a6f04 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -40,7 +40,7 @@ class Application extends App { $container = $this->getContainer(); $server = $container->getServer(); - $container->registerService('SharingMiddleware', function ($container) use ($server) { + $container->registerService('SharingMiddleware', function($container) use ($server) { return new SharingMiddleware( $container, $server->getRequest(), @@ -55,7 +55,7 @@ class Application extends App { public function registerNavigationEntry() { $container = $this->getContainer(); - $container->query('OCP\INavigationManager')->add(function () use ($container) { + $container->query('OCP\INavigationManager')->add(function() use ($container) { $urlGenerator = $container->query('OCP\IURLGenerator'); $l10n = $container->query('OCP\IL10N'); return [ diff --git a/lib/CardArchivedException.php b/lib/CardArchivedException.php index b5f13ef84..4586f7813 100644 --- a/lib/CardArchivedException.php +++ b/lib/CardArchivedException.php @@ -28,7 +28,7 @@ class CardArchivedException extends \Exception { * Constructor * @param string $msg the error message */ - public function __construct($msg=""){ + public function __construct($msg = "") { parent::__construct($msg); } } \ No newline at end of file diff --git a/lib/Controller/CardController.php b/lib/Controller/CardController.php index 90d5d066c..c7e6b4913 100644 --- a/lib/Controller/CardController.php +++ b/lib/Controller/CardController.php @@ -32,7 +32,7 @@ class CardController extends Controller { private $userId; private $cardService; - public function __construct($appName, IRequest $request, CardService $cardService, $userId){ + public function __construct($appName, IRequest $request, CardService $cardService, $userId) { parent::__construct($appName, $request); $this->userId = $userId; $this->cardService = $cardService; @@ -76,7 +76,7 @@ class CardController extends Controller { * @param int $order * @return \OCP\AppFramework\Db\Entity */ - public function create($title, $stackId, $type, $order=999) { + public function create($title, $stackId, $type, $order = 999) { return $this->cardService->create($title, $stackId, $type, $order, $this->userId); } diff --git a/lib/Controller/LabelController.php b/lib/Controller/LabelController.php index 1b18b42b0..519169eb2 100644 --- a/lib/Controller/LabelController.php +++ b/lib/Controller/LabelController.php @@ -32,7 +32,7 @@ class LabelController extends Controller { private $labelService; - public function __construct($appName, IRequest $request, LabelService $labelService){ + public function __construct($appName, IRequest $request, LabelService $labelService) { parent::__construct($appName, $request); $this->labelService = $labelService; } diff --git a/lib/Controller/ShareController.php b/lib/Controller/ShareController.php index 58f2e5624..1a89976cc 100644 --- a/lib/Controller/ShareController.php +++ b/lib/Controller/ShareController.php @@ -67,8 +67,9 @@ class ShareController extends Controller { } $limit = 10; foreach ($this->userManager->searchDisplayName($search, $limit, $offset) as $idx => $user) { - if ($user->getUID() === $this->userId) - continue; + if ($user->getUID() === $this->userId) { + continue; + } $acl = new Acl(); $acl->setType('user'); $acl->setParticipant($user->getUID()); diff --git a/lib/Controller/StackController.php b/lib/Controller/StackController.php index a2fbbe56e..b2cbb14e0 100644 --- a/lib/Controller/StackController.php +++ b/lib/Controller/StackController.php @@ -33,7 +33,7 @@ use OCP\AppFramework\Controller; class StackController extends Controller { private $userId; private $stackService; - public function __construct($appName, IRequest $request, StackService $cardService, $userId){ + public function __construct($appName, IRequest $request, StackService $cardService, $userId) { parent::__construct($appName, $request); $this->userId = $userId; $this->stackService = $cardService; @@ -64,7 +64,7 @@ class StackController extends Controller { * @param int $order * @return \OCP\AppFramework\Db\Entity */ - public function create($title, $boardId, $order=999) { + public function create($title, $boardId, $order = 999) { return $this->stackService->create($title, $boardId, $order); } diff --git a/lib/Db/AclMapper.php b/lib/Db/AclMapper.php index c67e5797b..f0b5a1cc8 100644 --- a/lib/Db/AclMapper.php +++ b/lib/Db/AclMapper.php @@ -32,7 +32,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper { parent::__construct($db, 'deck_board_acl', '\OCA\Deck\Db\Acl'); } - public function findAll($boardId, $limit=null, $offset=null) { + public function findAll($boardId, $limit = null, $offset = null) { $sql = 'SELECT id, board_id, type, participant, permission_edit, permission_share, permission_manage FROM `*PREFIX*deck_board_acl` WHERE `board_id` = ? '; return $this->findEntities($sql, [$boardId], $limit, $offset); } diff --git a/lib/Db/Board.php b/lib/Db/Board.php index cac026e30..8a3c02d9e 100644 --- a/lib/Db/Board.php +++ b/lib/Db/Board.php @@ -37,9 +37,9 @@ class Board extends Entity implements JsonSerializable { protected $shared; public function __construct() { - $this->addType('id','integer'); - $this->addType('shared','integer'); - $this->addType('archived','boolean'); + $this->addType('id', 'integer'); + $this->addType('shared', 'integer'); + $this->addType('archived', 'boolean'); $this->addRelation('labels'); $this->addRelation('acl'); $this->addRelation('shared'); @@ -55,7 +55,7 @@ class Board extends Entity implements JsonSerializable { 'labels' => $this->labels, 'acl' => $this->acl, ]; - if($this->shared!==-1) { + if ($this->shared !== -1) { $result['shared'] = $this->shared; } return $result; diff --git a/lib/Db/Card.php b/lib/Db/Card.php index ff2010933..ed3046bc1 100644 --- a/lib/Db/Card.php +++ b/lib/Db/Card.php @@ -41,12 +41,12 @@ class Card extends Entity implements JsonSerializable { protected $archived = false; public function __construct() { - $this->addType('id','integer'); - $this->addType('stackId','integer'); - $this->addType('order','integer'); + $this->addType('id', 'integer'); + $this->addType('stackId', 'integer'); + $this->addType('order', 'integer'); $this->addType('lastModified', 'integer'); $this->addType('createdAt', 'integer'); - $this->addType('archived','boolean'); + $this->addType('archived', 'boolean'); $this->addRelation('labels'); } diff --git a/lib/Db/Entity.php b/lib/Db/Entity.php index 0bafe5b75..eabc44aba 100644 --- a/lib/Db/Entity.php +++ b/lib/Db/Entity.php @@ -50,8 +50,8 @@ class Entity extends \OCP\AppFramework\Db\Entity { * @param string $attribute the name of the attribute * @since 7.0.0 */ - protected function markFieldUpdated($attribute){ - if(!in_array($attribute, $this->_relations)) { + protected function markFieldUpdated($attribute) { + if (!in_array($attribute, $this->_relations)) { parent::markFieldUpdated($attribute); } } diff --git a/lib/Db/Label.php b/lib/Db/Label.php index 545300406..6f8f9d09c 100644 --- a/lib/Db/Label.php +++ b/lib/Db/Label.php @@ -34,7 +34,7 @@ class Label extends Entity implements JsonSerializable { protected $boardId; protected $cardId; public function __construct() { - $this->addType('id','integer'); + $this->addType('id', 'integer'); } public function jsonSerialize() { return [ diff --git a/lib/Db/LabelMapper.php b/lib/Db/LabelMapper.php index 80835edd3..d53774b06 100644 --- a/lib/Db/LabelMapper.php +++ b/lib/Db/LabelMapper.php @@ -32,7 +32,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper { parent::__construct($db, 'deck_labels', '\OCA\Deck\Db\Label'); } - public function findAll($boardId, $limit=null, $offset=null) { + public function findAll($boardId, $limit = null, $offset = null) { $sql = 'SELECT * FROM `*PREFIX*deck_labels` WHERE `board_id` = ? ORDER BY `id`'; return $this->findEntities($sql, [$boardId], $limit, $offset); } @@ -44,11 +44,11 @@ class LabelMapper extends DeckMapper implements IPermissionMapper { return parent::delete($entity); } - public function findAssignedLabelsForCard($cardId, $limit=null, $offset=null) { + public function findAssignedLabelsForCard($cardId, $limit = null, $offset = null) { $sql = 'SELECT l.* FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id'; return $this->findEntities($sql, [$cardId], $limit, $offset); } - public function findAssignedLabelsForBoard($boardId, $limit=null, $offset=null) { + public function findAssignedLabelsForBoard($boardId, $limit = null, $offset = null) { $sql = "SELECT c.id as card_id, l.id as id, l.title as title, l.color as color FROM oc_deck_cards as c " . " INNER JOIN oc_deck_assigned_labels as al ON al.card_id = c.id INNER JOIN oc_deck_labels as l ON al.label_id = l.id WHERE board_id=? ORDER BY l.id"; $entities = $this->findEntities($sql, [$boardId], $limit, $offset); @@ -59,7 +59,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper { $labels = $this->findAssignedLabelsForBoard($boardId); $result = array(); foreach ($labels as $label) { - if(!array_key_exists($label->getCardId(), $result)) { + if (!array_key_exists($label->getCardId(), $result)) { $result[$label->getCardId()] = array(); } $result[$label->getCardId()][] = $label; @@ -70,14 +70,14 @@ class LabelMapper extends DeckMapper implements IPermissionMapper { public function deleteLabelAssignments($labelId) { $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE label_id = ?'; $stmt = $this->db->prepare($sql); - $stmt->bindParam(1, $labelId, \PDO::PARAM_INT); + $stmt->bindParam(1, $labelId, \PDO::PARAM_INT); $stmt->execute(); } public function deleteLabelAssignmentsForCard($cardId) { $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE card_id = ?'; $stmt = $this->db->prepare($sql); - $stmt->bindParam(1, $cardId, \PDO::PARAM_INT); + $stmt->bindParam(1, $cardId, \PDO::PARAM_INT); $stmt->execute(); } diff --git a/lib/Db/StackMapper.php b/lib/Db/StackMapper.php index ecbdd8211..0d1283f67 100644 --- a/lib/Db/StackMapper.php +++ b/lib/Db/StackMapper.php @@ -48,7 +48,7 @@ class StackMapper extends DeckMapper implements IPermissionMapper { } - public function findAll($boardId, $limit=null, $offset=null) { + public function findAll($boardId, $limit = null, $offset = null) { $sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ? ORDER BY `order`'; return $this->findEntities($sql, [$boardId], $limit, $offset); } diff --git a/lib/NoPermissionException.php b/lib/NoPermissionException.php index bc7abdc36..982b8127a 100644 --- a/lib/NoPermissionException.php +++ b/lib/NoPermissionException.php @@ -26,9 +26,9 @@ namespace OCA\Deck; class NoPermissionException extends StatusException { - public function __construct($message, $controller=null, $method=null) { + public function __construct($message, $controller = null, $method = null) { parent::__construct($message); - if($controller && $method) { + if ($controller && $method) { $this->message = get_class($controller) . "#" . $method . ": " . $message; } } diff --git a/lib/NotFoundException.php b/lib/NotFoundException.php index 15dc11953..c50d3a53b 100644 --- a/lib/NotFoundException.php +++ b/lib/NotFoundException.php @@ -26,7 +26,7 @@ namespace OCA\Deck; class NotFoundException extends StatusException { - public function __construct($message="") { + public function __construct($message = "") { parent::__construct($message); } diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 8d6082b3a..77cc7f7be 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -101,8 +101,9 @@ class CardService { $card->setLastModified(time()); } - if ($i === $order) - $i++; + if ($i === $order) { + $i++; + } if ($card->id !== $id) { $card->setOrder($i++); diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index ef5c9944c..64beabe8c 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -28,7 +28,7 @@ use OCA\Deck\Db\Acl; use OCA\Deck\Db\LabelMapper; -class LabelService { +class LabelService { private $labelMapper; diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index 81a89a46d..37c865f85 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -26,10 +26,8 @@ namespace OCA\Deck\Service; use OCA\Deck\Db\Acl; use OCA\Deck\Db\AclMapper; use OCA\Deck\Db\BoardMapper; - use OCA\Deck\Db\IPermissionMapper; use OCA\Deck\NoPermissionException; - use OCP\AppFramework\Db\DoesNotExistException; use OCP\IGroupManager; use OCP\ILogger; diff --git a/lib/Service/StackService.php b/lib/Service/StackService.php index b890dc965..043ada05b 100644 --- a/lib/Service/StackService.php +++ b/lib/Service/StackService.php @@ -33,7 +33,7 @@ use OCA\Deck\Db\Stack; use OCA\Deck\Db\StackMapper; -class StackService { +class StackService { private $stackMapper; private $cardMapper; @@ -54,7 +54,7 @@ class StackService { foreach ($stacks as $stackIndex => $stack) { $cards = $this->cardMapper->findAll($stack->id); foreach ($cards as $cardIndex => $card) { - if(array_key_exists($card->id, $labels)) { + if (array_key_exists($card->id, $labels)) { $cards[$cardIndex]->setLabels($labels[$card->id]); } } @@ -70,7 +70,7 @@ class StackService { foreach ($stacks as $stackIndex => $stack) { $cards = $this->cardMapper->findAllArchived($stack->id); foreach ($cards as $cardIndex => $card) { - if(array_key_exists($card->id, $labels)) { + if (array_key_exists($card->id, $labels)) { $cards[$cardIndex]->setLabels($labels[$card->id]); } }