Code Duplication    Length = 15-16 lines in 3 locations

application/models/friend_model.php 1 location

@@ 186-200 (lines=15) @@
183
				->where('confirmed', FRIEND_NOT_CONFIRMED)
184
				->update('user_friend_link');
185
		}
186
		else
187
		{
188
			//Check if the request already exists
189
			$request_check = $this->db->from('user_friend_link')
190
				->where('user_friend_id', $friend_id)
191
				->where('user_id', $user_id)
192
				->get();
193
194
			if($request_check->num_rows() > 0) return -1;
195
196
			//Add a friend request only if it doesn't already exist
197
			$this->db->set('user_id', $user_id)
198
				->set('user_friend_id', $friend_id)
199
				->insert('user_friend_link');
200
		}
201
202
		return $this->db->affected_rows();
203
	}

application/models/task_model.php 2 locations

@@ 157-172 (lines=16) @@
154
			->where('description', $desc)
155
			->get();
156
157
		if($exists->num_rows() < 1)
158
		{
159
			//Insert the item
160
			$this->db->set('task_id', $task_id)
161
				->set('description', $desc)
162
				->insert('checklist');
163
164
			//Return the row
165
			$return = $this->db->select('id, task_id, description, is_checked')
166
				->from('checklist')
167
				->where('task_id', $task_id)
168
				->where('description', $desc)
169
				->get();
170
171
			return $return->row_array();
172
		}
173
174
		return FALSE;
175
	}
@@ 1306-1320 (lines=15) @@
1303
			->get();
1304
1305
		//Check if there is an existing reminder for this task
1306
		if($query->num_rows() < 1)
1307
		{
1308
			$this->db->set('task_id', $task_id)
1309
				->set('reminder_time', $reminder_time)
1310
				->set('user_id', $user_id)
1311
				->insert('reminder');
1312
		}
1313
		else //If there is, update it.
1314
		{
1315
1316
			$this->db->set('reminder_time', $reminder_time)
1317
				->where('task_id', $task_id)
1318
				->where('user_id', $user_id)
1319
				->update('reminder');
1320
		}
1321
	}
1322
1323
	// --------------------------------------------------------------------------