Code Duplication    Length = 18-20 lines in 2 locations

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

@@ 638-657 (lines=20) @@
635
	 *
636
	 * @return bool
637
	 */
638
	public function is_single_price_mode() {
639
640
		$option = give_get_meta( $this->ID, '_give_price_option', true );
641
		$ret    = 0;
642
643
		if ( empty( $option ) || $option === 'set' ) {
644
			$ret = 1;
645
		}
646
647
		/**
648
		 * Override the price mode for a donation when checking if is in single price mode.
649
		 *
650
		 * @since 1.0
651
		 *
652
		 * @param bool       $ret Is donation form in single price mode?
653
		 * @param int|string $ID The ID of the donation form.
654
		 */
655
		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
656
657
	}
658
659
	/**
660
	 * Determine if custom price mode is enabled or disabled
@@ 737-754 (lines=18) @@
734
	 *
735
	 * @return bool
736
	 */
737
	public function has_variable_prices() {
738
739
		$option = give_get_meta( $this->ID, '_give_price_option', true );
740
		$ret    = 0;
741
742
		if ( $option === 'multi' ) {
743
			$ret = 1;
744
		}
745
746
		/**
747
		 * Filter: Override whether the donation form has variables prices.
748
		 *
749
		 * @param bool       $ret Does donation form have variable prices?
750
		 * @param int|string $ID  The ID of the donation form.
751
		 */
752
		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
753
754
	}
755
756
	/**
757
	 * Retrieve the donation form type, set or multi-level