Code Duplication    Length = 18-22 lines in 2 locations

core/db_classes/EE_Ticket.class.php 2 locations

@@ 773-794 (lines=22) @@
770
     * @throws InvalidInterfaceException
771
     * @throws ReflectionException
772
     */
773
    public function increaseSold($qty = 1)
774
    {
775
        $qty = absint($qty);
776
        // increment sold and decrement reserved datetime quantities simultaneously
777
        // don't worry about failures, because they must have already had a spot reserved
778
        $this->increaseSoldForDatetimes($qty);
779
        // Increment and decrement ticket quantities simultaneously
780
        $success = $this->adjustNumericFieldsInDb(
781
            [
782
                'TKT_reserved' => $qty * -1,
783
                'TKT_sold' => $qty
784
            ]
785
        );
786
        do_action(
787
            'AHEE__EE_Ticket__increase_sold',
788
            $this,
789
            $qty,
790
            $this->sold(),
791
            $success
792
        );
793
        return $success;
794
    }
795
796
    /**
797
     * On each datetime related to this ticket, increases its sold count and decreases its reserved count by $qty.
@@ 833-850 (lines=18) @@
830
     * @throws InvalidInterfaceException
831
     * @throws ReflectionException
832
     */
833
    public function decreaseSold($qty = 1)
834
    {
835
        $qty = absint($qty);
836
        $this->decreaseSoldForDatetimes($qty);
837
        $success = $this->adjustNumericFieldsInDb(
838
            [
839
                'TKT_sold' => $qty * -1
840
            ]
841
        );
842
        do_action(
843
            'AHEE__EE_Ticket__decrease_sold',
844
            $this,
845
            $qty,
846
            $this->sold(),
847
            $success
848
        );
849
        return $success;
850
    }
851
852
853
    /**