Code Duplication    Length = 19-24 lines in 2 locations

lib/Service/BoardService.php 1 location

@@ 356-374 (lines=19) @@
353
	 * @throws \OCA\Deck\NoPermissionException
354
	 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
355
	 */
356
	public function deleteUndo($id) {
357
358
		if (is_numeric($id) === false) {
359
			throw new BadRequestException('board id must be a number');
360
		}
361
362
		$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
363
		$board = $this->find($id);
364
		$board->setDeletedAt(0);
365
		$board = $this->boardMapper->update($board);
366
		$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $board, ActivityManager::SUBJECT_BOARD_RESTORE);
367
		$this->changeHelper->boardChanged($board->getId());
368
369
		$this->eventDispatcher->dispatch(
370
			'\OCA\Deck\Board::onUpdate', new GenericEvent(null, ['id' => $id, 'board' => $board])
371
		);
372
373
		return $board;
374
	}
375
376
	/**
377
	 * @param $id

lib/Service/StackService.php 1 location

@@ 247-270 (lines=24) @@
244
	 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
245
	 * @throws BadRequestException
246
	 */
247
	public function delete($id) {
248
249
		if (is_numeric($id) === false) {
250
			throw new BadRequestException('stack id must be a number');
251
		}
252
253
		$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
254
255
		$stack = $this->stackMapper->find($id);
256
		$stack->setDeletedAt(time());
257
		$stack = $this->stackMapper->update($stack);
258
259
		$this->activityManager->triggerEvent(
260
			ActivityManager::DECK_OBJECT_BOARD, $stack, ActivityManager::SUBJECT_STACK_DELETE
261
		);
262
		$this->changeHelper->boardChanged($stack->getBoardId());
263
		$this->enrichStackWithCards($stack);
264
265
		$this->eventDispatcher->dispatch(
266
			'\OCA\Deck\Stack::onDelete', new GenericEvent(null, ['id' => $id, 'stack' => $stack])
267
		);
268
269
		return $stack;
270
	}
271
272
	/**
273
	 * @param $id