Code Duplication    Length = 9-11 lines in 5 locations

core/db_classes/EE_Ticket.class.php 5 locations

@@ 763-773 (lines=11) @@
760
     * @return void
761
     * @throws \EE_Error
762
     */
763
	protected function _increase_sold_for_datetimes( $qty = 1 ) {
764
		$datetimes = $this->datetimes();
765
		if ( is_array( $datetimes ) ) {
766
			foreach ( $datetimes as $datetime ) {
767
				if ( $datetime instanceof EE_Datetime ) {
768
					$datetime->increase_sold( $qty );
769
					$datetime->save();
770
				}
771
			}
772
		}
773
	}
774
775
776
@@ 805-815 (lines=11) @@
802
     * @return void
803
     * @throws \EE_Error
804
     */
805
	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
806
		$datetimes = $this->datetimes();
807
		if ( is_array( $datetimes ) ) {
808
			foreach ( $datetimes as $datetime ) {
809
				if ( $datetime instanceof EE_Datetime ) {
810
					$datetime->decrease_sold( $qty );
811
					$datetime->save();
812
				}
813
			}
814
		}
815
	}
816
817
818
@@ 875-885 (lines=11) @@
872
     * @return void
873
     * @throws \EE_Error
874
     */
875
	protected function _increase_reserved_for_datetimes( $qty = 1 ) {
876
		$datetimes = $this->datetimes();
877
		if ( is_array( $datetimes ) ) {
878
			foreach ( $datetimes as $datetime ) {
879
				if ( $datetime instanceof EE_Datetime ) {
880
					$datetime->increase_reserved( $qty );
881
					$datetime->save();
882
				}
883
			}
884
		}
885
	}
886
887
888
@@ 920-930 (lines=11) @@
917
     * @return void
918
     * @throws \EE_Error
919
     */
920
	protected function _decrease_reserved_for_datetimes( $qty = 1 ) {
921
		$datetimes = $this->datetimes();
922
		if ( is_array( $datetimes ) ) {
923
			foreach ( $datetimes as $datetime ) {
924
				if ( $datetime instanceof EE_Datetime ) {
925
					$datetime->decrease_reserved( $qty );
926
					$datetime->save();
927
				}
928
			}
929
		}
930
	}
931
932
933
@@ 1042-1050 (lines=9) @@
1039
	 * @return void
1040
	 * @throws \EE_Error
1041
	 */
1042
	public function set_qty( $qty ) {
1043
		$datetimes = $this->datetimes();
1044
		foreach ( $datetimes as $datetime ) {
1045
			if ( $datetime instanceof EE_Datetime ) {
1046
				$qty = min( $qty, $datetime->reg_limit() );
1047
			}
1048
		}
1049
		$this->set( 'TKT_qty', $qty );
1050
	}
1051
1052
1053