Code Duplication    Length = 12-13 lines in 6 locations

application/models/History_Model.php 6 locations

@@ 38-50 (lines=13) @@
35
	 * 7: Favourite removed
36
	 */
37
38
	public function userAddTitle(int $chapterID, string $chapter, string $category) : bool {
39
		$success = $this->db->insert('tracker_user_history', [
40
			'chapter_id'  => $chapterID,
41
42
			'type'        => '1',
43
			'custom1'     => $chapter,
44
			'custom2'     => $category,
45
46
			'updated_at'  => date('Y-m-d H:i:s')
47
		]);
48
49
		return $success;
50
	}
51
	public function userUpdateTitle(int $chapterID, string $new_chapter) : bool {
52
		$success = $this->db->insert('tracker_user_history', [
53
			'chapter_id'  => $chapterID,
@@ 51-62 (lines=12) @@
48
49
		return $success;
50
	}
51
	public function userUpdateTitle(int $chapterID, string $new_chapter) : bool {
52
		$success = $this->db->insert('tracker_user_history', [
53
			'chapter_id'  => $chapterID,
54
55
			'type'        => '2',
56
			'custom1'     => $new_chapter,
57
58
			'updated_at'  => date('Y-m-d H:i:s')
59
		]);
60
61
		return $success;
62
	}
63
	public function userRemoveTitle(int $chapterID) : bool {
64
		$success = $this->db->insert('tracker_user_history', [
65
			'chapter_id'  => $chapterID,
@@ 74-85 (lines=12) @@
71
72
		return $success;
73
	}
74
	public function userUpdateTags(int $chapterID, string $new_tags) : bool {
75
		$success = $this->db->insert('tracker_user_history', [
76
			'chapter_id'  => $chapterID,
77
78
			'type'        => '4',
79
			'custom1'     => $new_tags,
80
81
			'updated_at'  => date('Y-m-d H:i:s')
82
		]);
83
84
		return $success;
85
	}
86
	public function userUpdateCategory(int $chapterID, string $new_category) : bool {
87
		$success = $this->db->insert('tracker_user_history', [
88
			'chapter_id'  => $chapterID,
@@ 86-97 (lines=12) @@
83
84
		return $success;
85
	}
86
	public function userUpdateCategory(int $chapterID, string $new_category) : bool {
87
		$success = $this->db->insert('tracker_user_history', [
88
			'chapter_id'  => $chapterID,
89
90
			'type'        => '5',
91
			'custom1'     => $new_category,
92
93
			'updated_at'  => date('Y-m-d H:i:s')
94
		]);
95
96
		return $success;
97
	}
98
	public function userAddFavourite(int $chapterID, string $chapter) : bool {
99
		$success = $this->db->insert('tracker_user_history', [
100
			'chapter_id'  => $chapterID,
@@ 98-109 (lines=12) @@
95
96
		return $success;
97
	}
98
	public function userAddFavourite(int $chapterID, string $chapter) : bool {
99
		$success = $this->db->insert('tracker_user_history', [
100
			'chapter_id'  => $chapterID,
101
102
			'type'        => '6',
103
			'custom1'     => $chapter,
104
105
			'updated_at'  => date('Y-m-d H:i:s')
106
		]);
107
108
		return $success;
109
	}
110
	public function userRemoveFavourite(int $chapterID, string $chapter) : bool {
111
		$success = $this->db->insert('tracker_user_history', [
112
			'chapter_id'  => $chapterID,
@@ 110-121 (lines=12) @@
107
108
		return $success;
109
	}
110
	public function userRemoveFavourite(int $chapterID, string $chapter) : bool {
111
		$success = $this->db->insert('tracker_user_history', [
112
			'chapter_id'  => $chapterID,
113
114
			'type'        => '7',
115
			'custom1'     => $chapter,
116
117
			'updated_at'  => date('Y-m-d H:i:s')
118
		]);
119
120
		return $success;
121
	}
122
123
	public function userGetHistory(int $page) : array {
124
		$rowsPerPage = 50;