Code Duplication    Length = 9-11 lines in 5 locations

core/db_classes/EE_Ticket.class.php 5 locations

@@ 757-767 (lines=11) @@
754
     * @return void
755
     * @throws \EE_Error
756
     */
757
	protected function _increase_sold_for_datetimes( $qty = 1 ) {
758
		$datetimes = $this->datetimes();
759
		if ( is_array( $datetimes ) ) {
760
			foreach ( $datetimes as $datetime ) {
761
				if ( $datetime instanceof EE_Datetime ) {
762
					$datetime->increase_sold( $qty );
763
					$datetime->save();
764
				}
765
			}
766
		}
767
	}
768
769
770
@@ 793-803 (lines=11) @@
790
     * @return void
791
     * @throws \EE_Error
792
     */
793
	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
794
		$datetimes = $this->datetimes();
795
		if ( is_array( $datetimes ) ) {
796
			foreach ( $datetimes as $datetime ) {
797
				if ( $datetime instanceof EE_Datetime ) {
798
					$datetime->decrease_sold( $qty );
799
					$datetime->save();
800
				}
801
			}
802
		}
803
	}
804
805
806
@@ 857-867 (lines=11) @@
854
     * @return void
855
     * @throws \EE_Error
856
     */
857
	protected function _increase_reserved_for_datetimes( $qty = 1 ) {
858
		$datetimes = $this->datetimes();
859
		if ( is_array( $datetimes ) ) {
860
			foreach ( $datetimes as $datetime ) {
861
				if ( $datetime instanceof EE_Datetime ) {
862
					$datetime->increase_reserved( $qty );
863
					$datetime->save();
864
				}
865
			}
866
		}
867
	}
868
869
870
@@ 896-906 (lines=11) @@
893
     * @return void
894
     * @throws \EE_Error
895
     */
896
	protected function _decrease_reserved_for_datetimes( $qty = 1 ) {
897
		$datetimes = $this->datetimes();
898
		if ( is_array( $datetimes ) ) {
899
			foreach ( $datetimes as $datetime ) {
900
				if ( $datetime instanceof EE_Datetime ) {
901
					$datetime->decrease_reserved( $qty );
902
					$datetime->save();
903
				}
904
			}
905
		}
906
	}
907
908
909
@@ 1018-1026 (lines=9) @@
1015
	 * @return void
1016
	 * @throws \EE_Error
1017
	 */
1018
	public function set_qty( $qty ) {
1019
		$datetimes = $this->datetimes();
1020
		foreach ( $datetimes as $datetime ) {
1021
			if ( $datetime instanceof EE_Datetime ) {
1022
				$qty = min( $qty, $datetime->reg_limit() );
1023
			}
1024
		}
1025
		$this->set( 'TKT_qty', $qty );
1026
	}
1027
1028
1029