Code Duplication    Length = 5-8 lines in 3 locations

class/list-table.php 3 locations

@@ 279-284 (lines=6) @@
276
				// Int index, can only fit by index position
277
				if (0 === $keys_title[0]) {
278
					$ar_data = &$this->aData;
279
					foreach ($keys_data as $k => $v)
280
						if (isset($keys_title[$k]))
281
							$ar_title[$k] = &$this->aTitle[$k];
282
						else
283
							// Use data's index name
284
							$ar_title[$k] = $v;
285
				}
286
				else {
287
					$ar_data = &$this->aData;
@@ 288-292 (lines=5) @@
285
				}
286
				else {
287
					$ar_data = &$this->aData;
288
					foreach ($keys_data as $k => $v)
289
						if (isset($this->aTitle[$v]))
290
							$ar_title[$v] = &$this->aTitle[$v];
291
						else
292
							$ar_title[$v] = $v;
293
				}
294
				break;
295
			case 2:
@@ 337-344 (lines=8) @@
334
					// Add as insert
335
					// need to merge keys first to keep order
336
					$keys_merge = array_merge($keys_title, $keys_data);
337
					foreach ($keys_merge as $k => $v)
338
						if (in_array($v, $keys_title))
339
							$ar_title[$v] = $this->aTitle[$v];
340
						else
341
							// Title items is fewer, need to fill
342
							// These infact is keys from data,
343
							// because of merge, so we can use $v directly
344
							$ar_title[$v] = $v;
345
				}
346
				$this->aTitle = &$ar_title;
347
				// Then use function itself to fit data to cutted title