@@ -24,7 +24,6 @@ |
||
24 | 24 | namespace OCA\Deck\Controller; |
25 | 25 | |
26 | 26 | use OCP\AppFramework\ApiController; |
27 | - use OCP\AppFramework\Http; |
|
28 | 27 | use OCP\AppFramework\Http\DataResponse; |
29 | 28 | use OCP\IRequest; |
30 | 29 | use OCA\Deck\Service\CardService; |
@@ -31,10 +31,10 @@ |
||
31 | 31 | use OCA\Deck\Service\CardService; |
32 | 32 | |
33 | 33 | /** |
34 | - * Class BoardApiController |
|
35 | - * |
|
36 | - * @package OCA\Deck\Controller |
|
37 | - */ |
|
34 | + * Class BoardApiController |
|
35 | + * |
|
36 | + * @package OCA\Deck\Controller |
|
37 | + */ |
|
38 | 38 | class CardApiController extends ApiController { |
39 | 39 | private $cardService; |
40 | 40 | private $userId; |
@@ -147,7 +147,7 @@ |
||
147 | 147 | * Assign a user to a card |
148 | 148 | */ |
149 | 149 | public function assignUser($userId) { |
150 | - $card = $this->cardService->assignUser($this->request->getParam('cardId'), $userId);; |
|
150 | + $card = $this->cardService->assignUser($this->request->getParam('cardId'), $userId); ; |
|
151 | 151 | return new DataResponse($card, HTTP::STATUS_OK); |
152 | 152 | } |
153 | 153 |
@@ -173,6 +173,9 @@ |
||
173 | 173 | return ($board->getOwner() === $userId); |
174 | 174 | } |
175 | 175 | |
176 | + /** |
|
177 | + * @param string $id |
|
178 | + */ |
|
176 | 179 | public function findBoardId($id) { |
177 | 180 | return $id; |
178 | 181 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | */ |
23 | 23 | |
24 | -if ((@include_once __DIR__ . '/../vendor/autoload.php')===false) { |
|
24 | +if ((@include_once __DIR__ . '/../vendor/autoload.php') === false) { |
|
25 | 25 | throw new Exception('Cannot include autoload. Did you run install dependencies using composer?'); |
26 | 26 | } |
27 | 27 |
@@ -45,6 +45,9 @@ |
||
45 | 45 | return $this->findEntity($sql, [$id]); |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $sql |
|
50 | + */ |
|
48 | 51 | protected function execute($sql, array $params = [], $limit = null, $offset = null) { |
49 | 52 | return parent::execute($sql, $params, $limit, $offset); |
50 | 53 | } |
@@ -66,6 +66,9 @@ discard block |
||
66 | 66 | return $result; |
67 | 67 | } |
68 | 68 | |
69 | + /** |
|
70 | + * @param integer $labelId |
|
71 | + */ |
|
69 | 72 | public function deleteLabelAssignments($labelId) { |
70 | 73 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE label_id = ?'; |
71 | 74 | $stmt = $this->db->prepare($sql); |
@@ -73,6 +76,9 @@ discard block |
||
73 | 76 | $stmt->execute(); |
74 | 77 | } |
75 | 78 | |
79 | + /** |
|
80 | + * @param integer $cardId |
|
81 | + */ |
|
76 | 82 | public function deleteLabelAssignmentsForCard($cardId) { |
77 | 83 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE card_id = ?'; |
78 | 84 | $stmt = $this->db->prepare($sql); |
@@ -34,7 +34,6 @@ |
||
34 | 34 | use OCA\Deck\Db\StackMapper; |
35 | 35 | use OCA\Deck\StatusException; |
36 | 36 | use OCA\Deck\BadRequestException; |
37 | -use OCP\Comments\ICommentsManager; |
|
38 | 37 | |
39 | 38 | |
40 | 39 | class StackService { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | private function enrichStackWithCards($stack, $since = -1) { |
78 | 78 | $cards = $this->cardMapper->findAll($stack->getId(), null, null, $since); |
79 | 79 | |
80 | - if(\count($cards) === 0) { |
|
80 | + if (\count($cards) === 0) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function delete($id) { |
218 | 218 | |
219 | - if ( is_numeric($id) === false ) { |
|
219 | + if (is_numeric($id) === false) { |
|
220 | 220 | throw new BadRequestException('stack id must be a number'); |
221 | 221 | } |
222 | 222 |
@@ -142,7 +142,7 @@ |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | protected function registerCommentsEventHandler() { |
145 | - $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () { |
|
145 | + $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function() { |
|
146 | 146 | return $this->getContainer()->query(CommentEventHandler::class); |
147 | 147 | }); |
148 | 148 | } |
@@ -31,7 +31,6 @@ |
||
31 | 31 | use OCA\Deck\Middleware\ExceptionMiddleware; |
32 | 32 | use OCA\Deck\Notification\Notifier; |
33 | 33 | use OCP\AppFramework\App; |
34 | -use OCA\Deck\Middleware\SharingMiddleware; |
|
35 | 34 | use OCP\Comments\CommentsEntityEvent; |
36 | 35 | use OCP\IGroup; |
37 | 36 | use OCP\IUser; |
@@ -124,7 +124,7 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param $subjectIdentifier |
|
127 | + * @param string $subjectIdentifier |
|
128 | 128 | * @param array $subjectParams |
129 | 129 | * @param bool $ownActivity |
130 | 130 | * @return string |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $subject = ''; |
134 | 134 | switch ($subjectIdentifier) { |
135 | 135 | case self::SUBJECT_BOARD_CREATE: |
136 | - $subject = $ownActivity ? $this->l10n->t('You have created a new board {board}'): $this->l10n->t('{user} has created a new board {board}'); |
|
136 | + $subject = $ownActivity ? $this->l10n->t('You have created a new board {board}') : $this->l10n->t('{user} has created a new board {board}'); |
|
137 | 137 | break; |
138 | 138 | case self::SUBJECT_BOARD_DELETE: |
139 | 139 | $subject = $ownActivity ? $this->l10n->t('You have deleted the board {board}') : $this->l10n->t('{user} has deleted the board {board}'); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | break; |
374 | 374 | } |
375 | 375 | |
376 | - if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){ |
|
376 | + if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) { |
|
377 | 377 | $card = $subjectParams['card']; |
378 | 378 | if ($card->getLastEditor() === $this->userId) { |
379 | 379 | return null; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $event->setApp('deck') |
393 | 393 | ->setType($eventType) |
394 | 394 | ->setAuthor($author === null ? $this->userId : $author) |
395 | - ->setObject($objectType, (int)$object->getId(), $object->getTitle()) |
|
395 | + ->setObject($objectType, (int) $object->getId(), $object->getTitle()) |
|
396 | 396 | ->setSubject($subject, array_merge($subjectParams, $additionalParams)) |
397 | 397 | ->setTimestamp(time()); |
398 | 398 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $objectId = $entity->getObjectId(); |
454 | 454 | break; |
455 | 455 | default: |
456 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
456 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
457 | 457 | } |
458 | 458 | return $this->cardMapper->find($objectId); |
459 | 459 | } |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | $objectId = $entity->getBoardId(); |
469 | 469 | break; |
470 | 470 | default: |
471 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
471 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
472 | 472 | } |
473 | 473 | return $this->boardMapper->find($objectId); |
474 | 474 | } |
475 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
475 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | private function findDetailsForStack($stackId) { |
@@ -91,8 +91,8 @@ |
||
91 | 91 | $card->setLabels($this->labelMapper->findAssignedLabelsForCard($cardId)); |
92 | 92 | $card->setAttachmentCount($this->attachmentService->count($cardId)); |
93 | 93 | $user = $this->userManager->get($this->currentUser); |
94 | - $lastRead = $this->commentsManager->getReadMark('deckCard', (string)$card->getId(), $user); |
|
95 | - $count = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string)$card->getId(), $lastRead); |
|
94 | + $lastRead = $this->commentsManager->getReadMark('deckCard', (string) $card->getId(), $user); |
|
95 | + $count = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string) $card->getId(), $lastRead); |
|
96 | 96 | $card->setCommentsUnread($count); |
97 | 97 | } |
98 | 98 |