Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 82-88 (lines=7) @@
79
     */
80
    protected function _filter_zero_line_item(EEI_Line_Item $line_item)
81
    {
82
        if ($line_item->type() === EEM_Line_Item::type_line_item
83
            && $line_item->OBJ_type() === 'Ticket'
84
            && (int) $line_item->quantity() === 0
85
        ) {
86
            return null;
87
        }
88
        return $line_item;
89
    }
90
91

core/helpers/EEH_Line_Item.helper.php 1 location

@@ 1900-1905 (lines=6) @@
1897
     */
1898
    public static function non_empty_line_item(EE_Line_Item $line_item)
1899
    {
1900
        if ($line_item->type() === EEM_Line_Item::type_line_item
1901
            && $line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_TICKET
1902
            && $line_item->quantity() === 0
1903
        ) {
1904
            return null;
1905
        }
1906
        $new_li_fields = $line_item->model_field_array();
1907
        // don't set the total. We'll leave that up to the code that calculates it
1908
        unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);