Code Duplication    Length = 3-4 lines in 3 locations

core/helpers/EEH_Money.helper.php 2 locations

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

core/helpers/EEH_Template.helper.php 1 location

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