Code Duplication    Length = 3-4 lines in 3 locations

core/helpers/EEH_Money.helper.php 2 locations

@@ 169-171 (lines=3) @@
166
		//if CNT_ISO passed lets try to get currency settings for it.
167
		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
168
		//default currency settings for site if not set
169
		if ( ! $currency_config instanceof EE_Currency_Config ) {
170
			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
171
		}
172
173
		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
174
@@ 142-144 (lines=3) @@
139
		//if CNT_ISO passed lets try to get currency settings for it.
140
		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
141
		//default currency settings for site if not set
142
		if ( ! $currency_config instanceof EE_Currency_Config ) {
143
			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
144
		}
145
146
		//first get the decimal place and number of places
147
		$format = "%'." . $currency_config->dec_plc . $format;

core/helpers/EEH_Template.helper.php 1 location

@@ 426-429 (lines=4) @@
423
			// was a country ISO code passed ? if so generate currency config object for that country
424
			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
			// verify results
426
			if ( ! $mny instanceof EE_Currency_Config ) {
427
				// set default config country currency settings
428
				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
429
			}
430
			// format float
431
			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
			// add formatting ?