Code Duplication    Length = 8-8 lines in 4 locations

core/db_classes/EE_Base_Class.class.php 4 locations

@@ 815-822 (lines=8) @@
812
	 * @return array|EE_Base_Class[]
813
	 * @throws \EE_Error
814
	 */
815
	public function next_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
816
		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
817
			? $this->get_model()->get_primary_key_field()->get_name()
818
			: $field_to_order_by;
819
		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
820
		if ( empty( $field ) || empty( $current_value ) ) {
821
			return array();
822
		}
823
		return $this->get_model()->next_x( $current_value, $field, $limit, $query_params, $columns_to_select );
824
	}
825
@@ 840-847 (lines=8) @@
837
	 * @return array|EE_Base_Class[]
838
	 * @throws \EE_Error
839
	 */
840
	public function previous_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
841
		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
842
			? $this->get_model()->get_primary_key_field()->get_name()
843
			: $field_to_order_by;
844
		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
845
		if ( empty( $field ) || empty( $current_value ) ) {
846
			return array();
847
		}
848
		return $this->get_model()->previous_x( $current_value, $field, $limit, $query_params, $columns_to_select );
849
	}
850
@@ 864-871 (lines=8) @@
861
	 * @return array|EE_Base_Class
862
	 * @throws \EE_Error
863
	 */
864
	public function next( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
865
		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
866
			? $this->get_model()->get_primary_key_field()->get_name()
867
			: $field_to_order_by;
868
		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
869
		if ( empty( $field ) || empty( $current_value ) ) {
870
			return array();
871
		}
872
		return $this->get_model()->next( $current_value, $field, $query_params, $columns_to_select );
873
	}
874
@@ 888-895 (lines=8) @@
885
	 * @return array|EE_Base_Class
886
	 * @throws \EE_Error
887
	 */
888
	public function previous( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
889
		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
890
			? $this->get_model()->get_primary_key_field()->get_name()
891
			: $field_to_order_by;
892
		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
893
		if ( empty( $field ) || empty( $current_value ) ) {
894
			return array();
895
		}
896
		return $this->get_model()->previous( $current_value, $field, $query_params, $columns_to_select );
897
	}
898