Code Duplication    Length = 8-8 lines in 3 locations

core/helpers/EEH_Line_Item.helper.php 3 locations

@@ 357-364 (lines=8) @@
354
	 */
355
	public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
356
		// validate incoming line_item
357
		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
358
			throw new EE_Error(
359
				sprintf(
360
					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
361
					$ticket_line_item->type()
362
				)
363
			);
364
		}
365
		if ( $ticket_line_item->quantity() < $qty ) {
366
			throw new EE_Error(
367
				sprintf(
@@ 434-441 (lines=8) @@
431
	 */
432
	public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
433
		// validate incoming line_item
434
		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
435
			throw new EE_Error(
436
				sprintf(
437
					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
438
					$ticket_line_item->type()
439
				)
440
			);
441
		}
442
		// get cancellation sub line item
443
		$cancellation_line_item = EEH_Line_Item::get_descendants_of_type(
444
			$ticket_line_item,
@@ 707-714 (lines=8) @@
704
			);
705
		}
706
		$event = $first_datetime->event();
707
		if ( ! $event instanceof EE_Event ) {
708
			throw new EE_Error(
709
				sprintf(
710
					__( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ),
711
					$ticket->ID()
712
				)
713
			);
714
		}
715
		$events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event );
716
		if ( ! $events_sub_total instanceof EE_Line_Item ) {
717
			throw new EE_Error(