Code Duplication    Length = 6-7 lines in 4 locations

lib/Db/AclMapper.php 1 location

@@ 39-44 (lines=6) @@
36
		return $this->findEntities($sql, [$boardId], $limit, $offset);
37
	}
38
39
	public function isOwner($userId, $aclId) {
40
		$sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_board_acl` WHERE id = ?)';
41
		$stmt = $this->execute($sql, [$aclId]);
42
		$row = $stmt->fetch();
43
		return ($row['owner'] === $userId);
44
	}
45
46
	public function findBoardId($aclId) {
47
		$entity = $this->find($aclId);

lib/Db/StackMapper.php 1 location

@@ 72-77 (lines=6) @@
69
		return parent::delete($entity);
70
	}
71
72
	public function isOwner($userId, $stackId) {
73
		$sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id = ?)';
74
		$stmt = $this->execute($sql, [$stackId]);
75
		$row = $stmt->fetch();
76
		return ($row['owner'] === $userId);
77
	}
78
79
	public function findBoardId($stackId) {
80
		$entity = $this->find($stackId);

lib/Db/LabelMapper.php 1 location

@@ 97-102 (lines=6) @@
94
		$stmt->execute();
95
	}
96
97
	public function isOwner($userId, $labelId) {
98
		$sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_labels` WHERE id = ?)';
99
		$stmt = $this->execute($sql, [$labelId]);
100
		$row = $stmt->fetch();
101
		return ($row['owner'] === $userId);
102
	}
103
104
	public function findBoardId($labelId) {
105
		$entity = $this->find($labelId);

lib/Db/CardMapper.php 1 location

@@ 257-263 (lines=7) @@
254
		$qb->execute();
255
	}
256
257
	public function isOwner($userId, $cardId) {
258
259
		$sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id IN (SELECT stack_id FROM `*PREFIX*deck_cards` WHERE id = ?))';
260
		$stmt = $this->db->executeQuery($sql, [$cardId]);
261
		$row = $stmt->fetch();
262
		return ($row['owner'] === $userId);
263
	}
264
265
	public function findBoardId($cardId) {
266
		$sql = 'SELECT id FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id IN (SELECT stack_id FROM `*PREFIX*deck_cards` WHERE id = ?))';