Code Duplication    Length = 10-10 lines in 2 locations

app/models/VisitorModel.php 2 locations

@@ 226-235 (lines=10) @@
223
		$oldPrograms = $this->getVisitorPrograms($ID_visitor);
224
225
		// update old data to new existing
226
		foreach($programBlocks as $programBlock) {
227
			$data = array('program' => $programs_data[$programBlock->id]);
228
			// read first value from array and shift it to the end
229
			$oldProgram = array_shift($oldPrograms);
230
231
			$result = $this->database
232
				->table('kk_visitor-program')
233
				->where('visitor ? AND id ?', $ID_visitor, (empty($oldProgram)) ? $oldProgram : $oldProgram->id)
234
				->update($data);
235
		}
236
237
		return $ID_visitor;
238
	}
@@ 274-283 (lines=10) @@
271
		$oldPrograms = $this->getVisitorPrograms($visitor->id);
272
273
		// update old data to new existing
274
		foreach($programBlocks as $programBlock) {
275
			$data = array('program' => $programs_data[$programBlock->id]);
276
			// read first value from array and shift it to the end
277
			$oldProgram = array_shift($oldPrograms);
278
279
			$result = $this->getDatabase()
280
				->table('kk_visitor-program')
281
				->where('visitor ? AND id ?', $visitor->id, (empty($oldProgram)) ? $oldProgram : $oldProgram->id)
282
				->update($data);
283
		}
284
285
		return $guid;
286
	}