Code Duplication    Length = 18-22 lines in 2 locations

core/db_classes/EE_Ticket.class.php 2 locations

@@ 762-783 (lines=22) @@
759
     * @throws InvalidInterfaceException
760
     * @throws ReflectionException
761
     */
762
    public function increaseSold($qty = 1)
763
    {
764
        $qty = absint($qty);
765
        // increment sold and decrement reserved datetime quantities simultaneously
766
        // don't worry about failures, because they must have already had a spot reserved
767
        $this->increaseSoldForDatetimes($qty);
768
        // Increment and decrement ticket quantities simultaneously
769
        $success = $this->adjustNumericFieldsInDb(
770
            [
771
                'TKT_reserved' => $qty * -1,
772
                'TKT_sold' => $qty
773
            ]
774
        );
775
        do_action(
776
            'AHEE__EE_Ticket__increase_sold',
777
            $this,
778
            $qty,
779
            $this->sold(),
780
            $success
781
        );
782
        return $success;
783
    }
784
785
    /**
786
     * On each datetime related to this ticket, increases its sold count and decreases its reserved count by $qty.
@@ 822-839 (lines=18) @@
819
     * @throws InvalidInterfaceException
820
     * @throws ReflectionException
821
     */
822
    public function decreaseSold($qty = 1)
823
    {
824
        $qty = absint($qty);
825
        $this->decreaseSoldForDatetimes($qty);
826
        $success = $this->adjustNumericFieldsInDb(
827
            [
828
                'TKT_sold' => $qty * -1
829
            ]
830
        );
831
        do_action(
832
            'AHEE__EE_Ticket__decrease_sold',
833
            $this,
834
            $qty,
835
            $this->sold(),
836
            $success
837
        );
838
        return $success;
839
    }
840
841
842
    /**