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

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