Code Duplication    Length = 12-13 lines in 6 locations

application/models/History_Model.php 6 locations

@@ 71-83 (lines=13) @@
68
	 * 7: Favourite removed
69
	 */
70
71
	public function userAddTitle(int $chapterID, string $chapter, string $category) : bool {
72
		$success = $this->db->insert('tracker_user_history', [
73
			'chapter_id'  => $chapterID,
74
75
			'type'        => '1',
76
			'custom1'     => $chapter,
77
			'custom2'     => $category,
78
79
			'updated_at'  => date('Y-m-d H:i:s')
80
		]);
81
82
		return $success;
83
	}
84
	public function userUpdateTitle(int $chapterID, string $new_chapter) : bool {
85
		$success = $this->db->insert('tracker_user_history', [
86
			'chapter_id'  => $chapterID,
@@ 84-95 (lines=12) @@
81
82
		return $success;
83
	}
84
	public function userUpdateTitle(int $chapterID, string $new_chapter) : bool {
85
		$success = $this->db->insert('tracker_user_history', [
86
			'chapter_id'  => $chapterID,
87
88
			'type'        => '2',
89
			'custom1'     => $new_chapter,
90
91
			'updated_at'  => date('Y-m-d H:i:s')
92
		]);
93
94
		return $success;
95
	}
96
	public function userRemoveTitle(int $chapterID) : bool {
97
		$success = $this->db->insert('tracker_user_history', [
98
			'chapter_id'  => $chapterID,
@@ 107-118 (lines=12) @@
104
105
		return $success;
106
	}
107
	public function userUpdateTags(int $chapterID, string $new_tags) : bool {
108
		$success = $this->db->insert('tracker_user_history', [
109
			'chapter_id'  => $chapterID,
110
111
			'type'        => '4',
112
			'custom1'     => $new_tags,
113
114
			'updated_at'  => date('Y-m-d H:i:s')
115
		]);
116
117
		return $success;
118
	}
119
	public function userUpdateCategory(int $chapterID, string $new_category) : bool {
120
		$success = $this->db->insert('tracker_user_history', [
121
			'chapter_id'  => $chapterID,
@@ 119-130 (lines=12) @@
116
117
		return $success;
118
	}
119
	public function userUpdateCategory(int $chapterID, string $new_category) : bool {
120
		$success = $this->db->insert('tracker_user_history', [
121
			'chapter_id'  => $chapterID,
122
123
			'type'        => '5',
124
			'custom1'     => $new_category,
125
126
			'updated_at'  => date('Y-m-d H:i:s')
127
		]);
128
129
		return $success;
130
	}
131
	public function userAddFavourite(int $chapterID, string $chapter) : bool {
132
		$success = $this->db->insert('tracker_user_history', [
133
			'chapter_id'  => $chapterID,
@@ 131-142 (lines=12) @@
128
129
		return $success;
130
	}
131
	public function userAddFavourite(int $chapterID, string $chapter) : bool {
132
		$success = $this->db->insert('tracker_user_history', [
133
			'chapter_id'  => $chapterID,
134
135
			'type'        => '6',
136
			'custom1'     => $chapter,
137
138
			'updated_at'  => date('Y-m-d H:i:s')
139
		]);
140
141
		return $success;
142
	}
143
	public function userRemoveFavourite(int $chapterID, string $chapter) : bool {
144
		$success = $this->db->insert('tracker_user_history', [
145
			'chapter_id'  => $chapterID,
@@ 143-154 (lines=12) @@
140
141
		return $success;
142
	}
143
	public function userRemoveFavourite(int $chapterID, string $chapter) : bool {
144
		$success = $this->db->insert('tracker_user_history', [
145
			'chapter_id'  => $chapterID,
146
147
			'type'        => '7',
148
			'custom1'     => $chapter,
149
150
			'updated_at'  => date('Y-m-d H:i:s')
151
		]);
152
153
		return $success;
154
	}
155
156
	public function userGetHistory(int $page) : array {
157
		$rowsPerPage = 50;