Code Duplication    Length = 11-12 lines in 2 locations

core/helpers/EEH_Line_Item.helper.php 2 locations

@@ 476-487 (lines=12) @@
473
            ));
474
            $ticket_line_item->add_child_line_item($cancellation_line_item);
475
        }
476
        if ($ticket_line_item->save_this_and_descendants() > 0) {
477
            // decrement parent line item quantity
478
            $event_line_item = $ticket_line_item->parent();
479
            if ($event_line_item instanceof EE_Line_Item
480
                && $event_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
481
            ) {
482
                $event_line_item->set_quantity($event_line_item->quantity() - $qty);
483
                $event_line_item->save();
484
            }
485
            EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
486
            return true;
487
        }
488
        return false;
489
    }
490
@@ 556-566 (lines=11) @@
553
        }
554
        // increment ticket quantity
555
        $ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
556
        if ($ticket_line_item->save_this_and_descendants() > 0) {
557
            // increment parent line item quantity
558
            $event_line_item = $ticket_line_item->parent();
559
            if ($event_line_item instanceof EE_Line_Item
560
                && $event_line_item->OBJ_type() === EEM_Line_Item::OBJ_TYPE_EVENT
561
            ) {
562
                $event_line_item->set_quantity($event_line_item->quantity() + $qty);
563
            }
564
            EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
565
            return true;
566
        }
567
        return false;
568
    }
569