Code Duplication    Length = 10-10 lines in 2 locations

app/models/VisitorModel.php 2 locations

@@ 232-241 (lines=10) @@
229
		$oldPrograms = $this->getVisitorPrograms($ID_visitor);
230
231
		// update old data to new existing
232
		foreach($programBlocks as $programBlock){
233
			$data = array('program' => $programs_data[$programBlock->id]);
234
			// read first value from array and shift it to the end
235
			$oldProgram = array_shift($oldPrograms);
236
237
			$result = $this->database
238
				->table('kk_visitor-program')
239
				->where('visitor ? AND id ?', $ID_visitor, (empty($oldProgram)) ? $oldProgram : $oldProgram->id)
240
				->update($data);
241
		}
242
243
		return $ID_visitor;
244
	}
@@ 285-294 (lines=10) @@
282
		$oldPrograms = $this->getVisitorPrograms($visitor->id);
283
284
		// update old data to new existing
285
		foreach($programBlocks as $programBlock){
286
			$data = array('program' => $programs_data[$programBlock->id]);
287
			// read first value from array and shift it to the end
288
			$oldProgram = array_shift($oldPrograms);
289
290
			$result = $this->getDatabase()
291
				->table('kk_visitor-program')
292
				->where('visitor ? AND id ?', $visitor->id, (empty($oldProgram)) ? $oldProgram : $oldProgram->id)
293
				->update($data);
294
		}
295
296
		return $guid;
297
	}