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

@@ 150-165 (lines=16) @@
147
			->where('description', $desc)
148
			->get();
149
150
		if($exists->num_rows() < 1)
151
		{
152
			//Insert the item
153
			$this->db->set('task_id', $task_id)
154
				->set('description', $desc)
155
				->insert('checklist');
156
157
			//Return the row
158
			$return = $this->db->select('id, task_id, description, is_checked')
159
				->from('checklist')
160
				->where('task_id', $task_id)
161
				->where('description', $desc)
162
				->get();
163
164
			return $return->row_array();
165
		}
166
167
		return FALSE;
168
	}
@@ 1293-1307 (lines=15) @@
1290
			->get();
1291
1292
		//Check if there is an existing reminder for this task
1293
		if($query->num_rows() < 1)
1294
		{
1295
			$this->db->set('task_id', $task_id)
1296
				->set('reminder_time', $reminder_time)
1297
				->set('user_id', $user_id)
1298
				->insert('reminder');
1299
		}
1300
		else //If there is, update it.
1301
		{
1302
1303
			$this->db->set('reminder_time', $reminder_time)
1304
				->where('task_id', $task_id)
1305
				->where('user_id', $user_id)
1306
				->update('reminder');
1307
		}
1308
	}
1309
1310
	// --------------------------------------------------------------------------