Code Duplication    Length = 6-7 lines in 2 locations

core/libraries/line_item_filters/EE_Non_Zero_Line_Item_Filter.class.php 1 location

@@ 77-83 (lines=7) @@
74
	 * @return EEI_Line_Item
75
	 */
76
	protected function _filter_zero_line_item( EEI_Line_Item $line_item ) {
77
		if (
78
			$line_item->type() === EEM_Line_Item::type_line_item &&
79
			$line_item->OBJ_type() === 'Ticket' &&
80
			$line_item->quantity() == 0
81
		) {
82
			return null;
83
		}
84
		return $line_item;
85
	}
86

core/helpers/EEH_Line_Item.helper.php 1 location

@@ 1638-1643 (lines=6) @@
1635
	 * @throws \EE_Error
1636
	 */
1637
	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1638
		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1639
			$line_item->OBJ_type() === 'Ticket' &&
1640
			$line_item->quantity() === 0
1641
		) {
1642
			return null;
1643
		}
1644
		$new_li_fields = $line_item->model_field_array();
1645
		//don't set the total. We'll leave that up to the code that calculates it
1646
		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );