Code Duplication    Length = 10-10 lines in 4 locations

framework/Web/UI/WebControls/TDataGrid.php 2 locations

@@ 491-500 (lines=10) @@
488
	/**
489
	 * @return TDataGridItem the selected item, null if no item is selected.
490
	 */
491
	public function getSelectedItem()
492
	{
493
		$index = $this->getSelectedItemIndex();
494
		$items = $this->getItems();
495
		if ($index >= 0 && $index < $items->getCount()) {
496
			return $items->itemAt($index);
497
		} else {
498
			return null;
499
		}
500
	}
501
502
	/**
503
	 * @return int the zero-based index of the selected item in {@link getItems Items}.
@@ 545-554 (lines=10) @@
542
	/**
543
	 * @return TDataGridItem the edit item
544
	 */
545
	public function getEditItem()
546
	{
547
		$index = $this->getEditItemIndex();
548
		$items = $this->getItems();
549
		if ($index >= 0 && $index < $items->getCount()) {
550
			return $items->itemAt($index);
551
		} else {
552
			return null;
553
		}
554
	}
555
556
	/**
557
	 * @return int the zero-based index of the edit item in {@link getItems Items}.

framework/Web/UI/WebControls/TDataList.php 2 locations

@@ 710-719 (lines=10) @@
707
	/**
708
	 * @return TControl the selected item, null if no item is selected.
709
	 */
710
	public function getSelectedItem()
711
	{
712
		$index = $this->getSelectedItemIndex();
713
		$items = $this->getItems();
714
		if ($index >= 0 && $index < $items->getCount()) {
715
			return $items->itemAt($index);
716
		} else {
717
			return null;
718
		}
719
	}
720
721
	/**
722
	 * @throws TInvalidOperationException if {@link getDataKeyField DataKeyField} is empty.
@@ 775-784 (lines=10) @@
772
	/**
773
	 * @return TControl the edit item
774
	 */
775
	public function getEditItem()
776
	{
777
		$index = $this->getEditItemIndex();
778
		$items = $this->getItems();
779
		if ($index >= 0 && $index < $items->getCount()) {
780
			return $items->itemAt($index);
781
		} else {
782
			return null;
783
		}
784
	}
785
786
	/**
787
	 * @return bool whether the header should be shown. Defaults to true.