Code Duplication    Length = 23-23 lines in 2 locations

classes/fields/currency.php 1 location

@@ 696-718 (lines=23) @@
693
	 * @param array $options
694
	 * @return int
695
	 */
696
	public function get_max_decimals( $options ) {
697
698
		$length = (int) pods_v( static::$type . '_max_length', $options, 12, true );
699
700
		if ( $length < 1 || 64 < $length ) {
701
			$length = 64;
702
		}
703
704
		$decimals = (int) pods_v( static::$type . '_decimals', $options, 2 );
705
706
		if ( $decimals < 1 ) {
707
			$decimals = 0;
708
		}
709
		elseif ( 30 < $decimals ) {
710
			$decimals = 30;
711
		}
712
713
		if ( $length < $decimals ) {
714
			$decimals = $length;
715
		}
716
717
		return $decimals;
718
	}
719
}
720

classes/fields/number.php 1 location

@@ 490-512 (lines=23) @@
487
     * @param array $options
488
     * @return int
489
     */
490
    public function get_max_decimals( $options ) {
491
492
	    $length = (int) pods_v( static::$type . '_max_length', $options, 12, true );
493
494
	    if ( $length < 1 || 64 < $length ) {
495
		    $length = 64;
496
	    }
497
498
	    $decimals = (int) pods_v( static::$type . '_decimals', $options, 0 );
499
500
	    if ( $decimals < 1 ) {
501
		    $decimals = 0;
502
	    }
503
	    elseif ( 30 < $decimals ) {
504
		    $decimals = 30;
505
	    }
506
507
	    if ( $length < $decimals ) {
508
		    $decimals = $length;
509
	    }
510
511
	    return $decimals;
512
    }
513
}
514