@@ -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 | } |
@@ -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}'); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | break; |
369 | 369 | } |
370 | 370 | |
371 | - if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){ |
|
371 | + if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) { |
|
372 | 372 | $subjectParams['diff'] = true; |
373 | 373 | } |
374 | 374 | if ($subject === self::SUBJECT_CARD_UPDATE_STACKID) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $event->setApp('deck') |
380 | 380 | ->setType('deck') |
381 | 381 | ->setAuthor($this->userId) |
382 | - ->setObject($objectType, (int)$object->getId(), $object->getTitle()) |
|
382 | + ->setObject($objectType, (int) $object->getId(), $object->getTitle()) |
|
383 | 383 | ->setSubject($subject, array_merge($subjectParams, $additionalParams)) |
384 | 384 | ->setTimestamp(time()); |
385 | 385 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | $objectId = $entity->getObjectId(); |
441 | 441 | break; |
442 | 442 | default: |
443 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
443 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
444 | 444 | } |
445 | 445 | return $this->cardMapper->find($objectId); |
446 | 446 | } |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | $objectId = $entity->getBoardId(); |
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->boardMapper->find($objectId); |
461 | 461 | } |
462 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
462 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | private function findDetailsForStack($stackId) { |
@@ -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 |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | * @param CommentsEvent $event |
44 | 44 | */ |
45 | 45 | public function handle(CommentsEvent $event) { |
46 | - if($event->getComment()->getObjectType() !== 'deckCard') { |
|
46 | + if ($event->getComment()->getObjectType() !== 'deckCard') { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $eventType = $event->getEvent(); |
51 | - if( $eventType === CommentsEvent::EVENT_ADD |
|
51 | + if ($eventType === CommentsEvent::EVENT_ADD |
|
52 | 52 | ) { |
53 | 53 | $this->notificationHandler($event); |
54 | 54 | $this->activityHandler($event); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | CommentsEvent::EVENT_UPDATE, |
61 | 61 | CommentsEvent::EVENT_DELETE, |
62 | 62 | ]; |
63 | - if(in_array($eventType, $applicableEvents)) { |
|
63 | + if (in_array($eventType, $applicableEvents)) { |
|
64 | 64 | $this->notificationHandler($event); |
65 | 65 | return; |
66 | 66 | } |
@@ -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 |
@@ -147,7 +147,7 @@ |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | - * @return array |
|
150 | + * @return integer |
|
151 | 151 | */ |
152 | 152 | private function getBoardPrerequisites() { |
153 | 153 | $groups = $this->groupManager->getUserGroupIds( |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function findAll($since = -1) { |
93 | 93 | $userInfo = $this->getBoardPrerequisites(); |
94 | 94 | $userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since); |
95 | - $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since); |
|
95 | + $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'], null, null, $since); |
|
96 | 96 | $complete = array_merge($userBoards, $groupBoards); |
97 | 97 | $result = []; |
98 | 98 | /** @var Board $item */ |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function find($boardId) { |
129 | 129 | |
130 | - if ( is_numeric($boardId) === false ) { |
|
130 | + if (is_numeric($boardId) === false) { |
|
131 | 131 | throw new BadRequestException('board id must be a number'); |
132 | 132 | } |
133 | 133 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function isArchived($mapper, $id) { |
178 | 178 | |
179 | - if (is_numeric($id) === false) { |
|
179 | + if (is_numeric($id) === false) { |
|
180 | 180 | throw new BadRequestException('id must be a number'); |
181 | 181 | } |
182 | 182 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | throw new BadRequestException('mapper must be provided'); |
211 | 211 | } |
212 | 212 | |
213 | - if (is_numeric($id) === false) { |
|
213 | + if (is_numeric($id) === false) { |
|
214 | 214 | throw new BadRequestException('id must be a number'); |
215 | 215 | } |
216 | 216 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @throws BadRequestException |
346 | 346 | */ |
347 | 347 | public function deleteForce($id) { |
348 | - if (is_numeric($id) === false) { |
|
348 | + if (is_numeric($id) === false) { |
|
349 | 349 | throw new BadRequestException('id must be a number'); |
350 | 350 | } |
351 | 351 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | throw new BadRequestException('color must be provided'); |
380 | 380 | } |
381 | 381 | |
382 | - if ( is_bool($archived) === false ) { |
|
382 | + if (is_bool($archived) === false) { |
|
383 | 383 | throw new BadRequestException('archived must be a boolean'); |
384 | 384 | } |
385 | 385 |
@@ -23,13 +23,9 @@ |
||
23 | 23 | |
24 | 24 | namespace OCA\Deck\Db; |
25 | 25 | |
26 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
27 | -use OCP\ICache; |
|
28 | 26 | use OCP\ICacheFactory; |
29 | 27 | use OCP\IDBConnection; |
30 | 28 | use OCP\IRequest; |
31 | -use OCP\IUserManager; |
|
32 | -use OCP\IGroupManager; |
|
33 | 29 | |
34 | 30 | class ChangeHelper { |
35 | 31 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function cardChanged($cardId, $updateCard = true) { |
60 | 60 | $time = time(); |
61 | 61 | $etag = md5($time . microtime()); |
62 | - $this->cache->set(self::TYPE_CARD . '-' .$cardId, $etag); |
|
62 | + $this->cache->set(self::TYPE_CARD . '-' . $cardId, $etag); |
|
63 | 63 | if ($updateCard) { |
64 | 64 | $sql = 'UPDATE `*PREFIX*deck_cards` SET `last_modified` = ? WHERE `id` = ?'; |
65 | 65 | $this->db->executeUpdate($sql, [time(), $cardId]); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function stackChanged($stackId, $updateBoard = true) { |
77 | 77 | $time = time(); |
78 | 78 | $etag = md5($time . microtime()); |
79 | - $this->cache->set(self::TYPE_CARD . '-' .$stackId, $etag); |
|
79 | + $this->cache->set(self::TYPE_CARD . '-' . $stackId, $etag); |
|
80 | 80 | if ($updateBoard) { |
81 | 81 | $sql = 'UPDATE `*PREFIX*deck_stacks` SET `last_modified` = ? WHERE `id` = ?'; |
82 | 82 | $this->db->executeUpdate($sql, [time(), $stackId]); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | public function getEtag($type, $id) { |
95 | - $entry = $this->cache->get($type . '-' .$id); |
|
95 | + $entry = $this->cache->get($type . '-' . $id); |
|
96 | 96 | if ($entry === 'null') { |
97 | 97 | return ''; |
98 | 98 | } |
@@ -31,76 +31,76 @@ |
||
31 | 31 | |
32 | 32 | class AttachmentApiController extends ApiController { |
33 | 33 | |
34 | - private $attachmentService; |
|
34 | + private $attachmentService; |
|
35 | 35 | |
36 | - public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
37 | - parent::__construct($appName, $request); |
|
38 | - $this->attachmentService = $attachmentService; |
|
39 | - } |
|
36 | + public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
37 | + parent::__construct($appName, $request); |
|
38 | + $this->attachmentService = $attachmentService; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * @NoAdminRequired |
43 | 43 | * @CORS |
44 | 44 | * @NoCSRFRequired |
45 | 45 | * |
46 | 46 | */ |
47 | - public function getAll() { |
|
48 | - $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
49 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
50 | - } |
|
47 | + public function getAll() { |
|
48 | + $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
49 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
52 | + /** |
|
53 | 53 | * @NoAdminRequired |
54 | 54 | * @CORS |
55 | 55 | * @NoCSRFRequired |
56 | 56 | * |
57 | 57 | */ |
58 | - public function display() { |
|
59 | - $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
58 | + public function display() { |
|
59 | + $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
60 | 60 | return $attachment; |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
63 | + /** |
|
64 | 64 | * @NoAdminRequired |
65 | 65 | * @CORS |
66 | 66 | * @NoCSRFRequired |
67 | 67 | * |
68 | 68 | */ |
69 | - public function create($type, $data) { |
|
70 | - $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
71 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
72 | - } |
|
69 | + public function create($type, $data) { |
|
70 | + $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
71 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
74 | + /** |
|
75 | 75 | * @NoAdminRequired |
76 | 76 | * @CORS |
77 | 77 | * @NoCSRFRequired |
78 | 78 | * |
79 | 79 | */ |
80 | - public function update($data) { |
|
81 | - $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
82 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
83 | - } |
|
80 | + public function update($data) { |
|
81 | + $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
82 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
85 | + /** |
|
86 | 86 | * @NoAdminRequired |
87 | 87 | * @CORS |
88 | 88 | * @NoCSRFRequired |
89 | 89 | * |
90 | 90 | */ |
91 | - public function delete() { |
|
92 | - $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
93 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
94 | - } |
|
91 | + public function delete() { |
|
92 | + $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
93 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * @NoAdminRequired |
98 | 98 | * @CORS |
99 | 99 | * @NoCSRFRequired |
100 | 100 | * |
101 | 101 | */ |
102 | - public function restore() { |
|
103 | - $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
104 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
105 | - } |
|
102 | + public function restore() { |
|
103 | + $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
104 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -23,16 +23,13 @@ |
||
23 | 23 | |
24 | 24 | namespace OCA\Deck\Controller; |
25 | 25 | |
26 | -use OCA\Deck\Service\DefaultBoardService; |
|
27 | 26 | use OCP\AppFramework\Http\DataResponse; |
28 | 27 | use OCP\AppFramework\Http\NotFoundResponse; |
29 | 28 | use OCP\IConfig; |
30 | 29 | use OCP\IGroup; |
31 | 30 | use OCP\IGroupManager; |
32 | 31 | use OCP\IRequest; |
33 | -use OCP\AppFramework\Http\TemplateResponse; |
|
34 | 32 | use OCP\AppFramework\Controller; |
35 | -use OCP\IL10N; |
|
36 | 33 | |
37 | 34 | class ConfigController extends Controller { |
38 | 35 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function index() { |
64 | 64 | $params = [ |
65 | 65 | 'user' => $this->userId, |
66 | - 'maxUploadSize' => (int)\OCP\Util::uploadLimit(), |
|
66 | + 'maxUploadSize' => (int) \OCP\Util::uploadLimit(), |
|
67 | 67 | 'canCreate' => $this->permissionService->canCreate() |
68 | 68 | ]; |
69 | 69 |