Code Duplication    Length = 12-28 lines in 3 locations

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

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