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

@@ 1627-1632 (lines=6) @@
1624
	 * @throws \EE_Error
1625
	 */
1626
	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1627
		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1628
			$line_item->OBJ_type() === 'Ticket' &&
1629
			$line_item->quantity() === 0
1630
		) {
1631
			return null;
1632
		}
1633
		$new_li_fields = $line_item->model_field_array();
1634
		//don't set the total. We'll leave that up to the code that calculates it
1635
		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );