@@ -63,7 +63,7 @@ |
||
63 | 63 | * Check if user exists before assigning it to a card |
64 | 64 | * |
65 | 65 | * @param Entity $entity |
66 | - * @return null|Entity |
|
66 | + * @return AssignedUsers|null |
|
67 | 67 | */ |
68 | 68 | public function insert(Entity $entity) { |
69 | 69 | $user = $this->userManager->get($entity->getParticipant()); |
@@ -163,7 +163,7 @@ |
||
163 | 163 | * @param $cardId |
164 | 164 | * @param $attachmentId |
165 | 165 | * @param $request |
166 | - * @return mixed |
|
166 | + * @return \OCP\AppFramework\Db\Entity |
|
167 | 167 | * @throws \OCA\Deck\NoPermissionException |
168 | 168 | * @throws \OCP\AppFramework\Db\DoesNotExistException |
169 | 169 | * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException |
@@ -99,16 +99,16 @@ |
||
99 | 99 | $data = []; |
100 | 100 | foreach ($boards as $board) { |
101 | 101 | $fullBoard = $this->boardMapper->find($board->getId(), true, true); |
102 | - $data[$board->getId()] = (array)$fullBoard->jsonSerialize(); |
|
102 | + $data[$board->getId()] = (array) $fullBoard->jsonSerialize(); |
|
103 | 103 | $stacks = $this->stackMapper->findAll($board->getId()); |
104 | 104 | foreach ($stacks as $stack) { |
105 | - $data[$board->getId()]['stacks'][] = (array)$stack->jsonSerialize(); |
|
105 | + $data[$board->getId()]['stacks'][] = (array) $stack->jsonSerialize(); |
|
106 | 106 | $cards = $this->cardMapper->findAllByStack($stack->getId()); |
107 | 107 | foreach ($cards as $card) { |
108 | 108 | $fullCard = $this->cardMapper->find($card->getId()); |
109 | 109 | $assignedUsers = $this->assignedUsersMapper->find($card->getId()); |
110 | 110 | $fullCard->setAssignedUsers($assignedUsers); |
111 | - $data[$board->getId()]['stacks'][$stack->getId()]['cards'][] = (array)$fullCard->jsonSerialize(); |
|
111 | + $data[$board->getId()]['stacks'][$stack->getId()]['cards'][] = (array) $fullCard->jsonSerialize(); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @throws NotPermittedException |
86 | 86 | */ |
87 | 87 | private function getFolder(Attachment $attachment) { |
88 | - $folderName = 'file-card-' . (int)$attachment->getCardId(); |
|
88 | + $folderName = 'file-card-' . (int) $attachment->getCardId(); |
|
89 | 89 | try { |
90 | 90 | $folder = $this->appData->getFolder($folderName); |
91 | 91 | } catch (NotFoundException $e) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return array |
117 | 117 | * @throws StatusException |
118 | 118 | */ |
119 | - private function getUploadedFile () { |
|
119 | + private function getUploadedFile() { |
|
120 | 120 | $file = $this->request->getUploadedFile('file'); |
121 | 121 | $error = null; |
122 | 122 | $phpFileUploadErrors = [ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @throws \Exception |
191 | 191 | */ |
192 | 192 | private function getFileFromRootFolder(Attachment $attachment) { |
193 | - $folderName = 'file-card-' . (int)$attachment->getCardId(); |
|
193 | + $folderName = 'file-card-' . (int) $attachment->getCardId(); |
|
194 | 194 | $instanceId = $this->config->getSystemValue('instanceid', null); |
195 | 195 | if ($instanceId === null) { |
196 | 196 | throw new \Exception('no instance id!'); |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | |
68 | 68 | $cursor = $qb->execute(); |
69 | 69 | $row = $cursor->fetch(PDO::FETCH_ASSOC); |
70 | - if($row === false) { |
|
70 | + if ($row === false) { |
|
71 | 71 | $cursor->closeCursor(); |
72 | 72 | throw new DoesNotExistException('Did expect one result but found none when executing' . $qb); |
73 | 73 | } |
74 | 74 | |
75 | 75 | $row2 = $cursor->fetch(); |
76 | 76 | $cursor->closeCursor(); |
77 | - if($row2 !== false ) { |
|
77 | + if ($row2 !== false) { |
|
78 | 78 | throw new MultipleObjectsReturnedException('Did not expect more than one result when executing' . $query); |
79 | 79 | } |
80 | 80 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $entities = []; |
99 | 99 | $cursor = $qb->execute(); |
100 | - while($row = $cursor->fetch()){ |
|
100 | + while ($row = $cursor->fetch()) { |
|
101 | 101 | $entities[] = $this->mapRowToEntity($row); |
102 | 102 | } |
103 | 103 | $cursor->closeCursor(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | $entities = []; |
129 | 129 | $cursor = $qb->execute(); |
130 | - while($row = $cursor->fetch()){ |
|
130 | + while ($row = $cursor->fetch()) { |
|
131 | 131 | $entities[] = $this->mapRowToEntity($row); |
132 | 132 | } |
133 | 133 | $cursor->closeCursor(); |
@@ -136,6 +136,9 @@ |
||
136 | 136 | return parent::delete($entity); |
137 | 137 | } |
138 | 138 | |
139 | + /** |
|
140 | + * @param integer $stackId |
|
141 | + */ |
|
139 | 142 | public function deleteByStack($stackId) { |
140 | 143 | $cards = $this->findAllByStack($stackId); |
141 | 144 | foreach ($cards as $card) { |
@@ -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); |
@@ -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}'); |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | try { |
303 | 303 | $object = $this->findObjectForEntity($objectType, $entity); |
304 | 304 | } catch (DoesNotExistException $e) { |
305 | - \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array)$entity); |
|
305 | + \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array) $entity); |
|
306 | 306 | return null; |
307 | 307 | } catch (MultipleObjectsReturnedException $e) { |
308 | - \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array)$entity); |
|
308 | + \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array) $entity); |
|
309 | 309 | return null; |
310 | 310 | } |
311 | 311 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | break; |
376 | 376 | } |
377 | 377 | |
378 | - if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){ |
|
378 | + if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) { |
|
379 | 379 | $card = $subjectParams['card']; |
380 | 380 | if ($card->getLastEditor() === $this->userId) { |
381 | 381 | return null; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $event->setApp('deck') |
395 | 395 | ->setType($eventType) |
396 | 396 | ->setAuthor($author === null ? $this->userId : $author) |
397 | - ->setObject($objectType, (int)$object->getId(), $object->getTitle()) |
|
397 | + ->setObject($objectType, (int) $object->getId(), $object->getTitle()) |
|
398 | 398 | ->setSubject($subject, array_merge($subjectParams, $additionalParams)) |
399 | 399 | ->setTimestamp(time()); |
400 | 400 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $objectId = $entity->getObjectId(); |
456 | 456 | break; |
457 | 457 | default: |
458 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
458 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
459 | 459 | } |
460 | 460 | return $this->cardMapper->find($objectId); |
461 | 461 | } |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | $objectId = $entity->getBoardId(); |
471 | 471 | break; |
472 | 472 | default: |
473 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
473 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
474 | 474 | } |
475 | 475 | return $this->boardMapper->find($objectId); |
476 | 476 | } |
477 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
477 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | private function findDetailsForStack($stackId) { |