Code Duplication    Length = 12-28 lines in 3 locations

includes/class-give-donate-form.php 3 locations

@@ 488-515 (lines=28) @@
485
	 *
486
	 * @return float  Price.
487
	 */
488
	public function get_price() {
489
490
		if ( ! isset( $this->price ) ) {
491
492
			$this->price = give_maybe_sanitize_amount(
493
				give_get_meta(
494
					$this->ID,
495
					'_give_set_price',
496
					true
497
				)
498
			);
499
500
			if ( ! $this->price ) {
501
				$this->price = 0;
502
			}
503
504
		}
505
506
		/**
507
		 * Override the donation form set price.
508
		 *
509
		 * @since 1.0
510
		 *
511
		 * @param string     $price The donation form price.
512
		 * @param string|int $id    The form ID.
513
		 */
514
		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
515
	}
516
517
	/**
518
	 * Retrieve the minimum price.
@@ 553-564 (lines=12) @@
550
	 *
551
	 * @return float  Maximum price.
552
	 */
553
	public function get_maximum_price() {
554
555
		if ( ! isset( $this->maximum_price ) ) {
556
			$this->maximum_price = give_get_meta( $this->ID, '_give_custom_amount_range_maximum', true, 999999.99 );
557
558
			if ( ! $this->is_custom_price_mode() ) {
559
				$this->maximum_price = give_get_highest_price_option( $this->ID );
560
			}
561
		}
562
563
		return apply_filters( 'give_get_set_maximum_price', $this->maximum_price, $this->ID );
564
	}
565
566
	/**
567
	 * Retrieve the variable prices
@@ 791-805 (lines=15) @@
788
	 *
789
	 * @return string Type of donation form, either 'set' or 'multi'.
790
	 */
791
	public function get_type() {
792
793
		if ( ! isset( $this->type ) ) {
794
795
			$this->type = give_get_meta( $this->ID, '_give_price_option', true );
796
797
			if ( empty( $this->type ) ) {
798
				$this->type = 'set';
799
			}
800
801
		}
802
803
		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
804
805
	}
806
807
	/**
808
	 * Get form tag classes.