Code Duplication    Length = 38-40 lines in 2 locations

core/services/address/formatters/InlineAddressFormatter.php 1 location

@@ 19-56 (lines=38) @@
16
 * @author        Brent Christensen
17
 * @since         4.8
18
 */
19
class InlineAddressFormatter extends AddressFormatter implements \EEI_Address_Formatter {
20
21
	/**
22
	 * @param string $address
23
	 * @param string $address2
24
	 * @param string $city
25
	 * @param string $state
26
	 * @param string $zip
27
	 * @param string $country
28
	 * @param string $CNT_ISO
29
	 * @return string
30
	 */
31
	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
32
		$address_formats = apply_filters(
33
			'FHEE__EE_Inline_Address_Formatter__address_formats',
34
			array(
35
				'CA' => "{address}%{address2}%{city}%{state}%{country}%{zip}",
36
				'GB' => "{address}%{address2}%{city}%{state}%{zip}%{country}",
37
				'US' => "{address}%{address2}%{city}%{state}%{zip}%{country}",
38
				'ZZZ' => "{address}%{address2}%{city}%{state}%{zip}%{country}",
39
			)
40
		);
41
		// if the incoming country has a set format, use that, else use the default
42
		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ]
43
			: $address_formats['ZZZ'];
44
		return $this->parse_formatted_address(
45
			$address,
46
			$address2,
47
			$city,
48
			$state,
49
			$zip,
50
			$country,
51
			$formatted_address,
52
			', '
53
		);
54
	}
55
56
}
57
// End of file InlineAddressFormatter.php
58
// Location: core/services/address/formatters/InlineAddressFormatter.php

core/services/address/formatters/MultiLineAddressFormatter.php 1 location

@@ 19-58 (lines=40) @@
16
 * @author        Brent Christensen
17
 * @since         4.8
18
 */
19
class MultiLineAddressFormatter extends AddressFormatter implements \EEI_Address_Formatter {
20
21
22
	/**
23
	 * @param string $address
24
	 * @param string $address2
25
	 * @param string $city
26
	 * @param string $state
27
	 * @param string $zip
28
	 * @param string $country
29
	 * @param string $CNT_ISO
30
	 * @return string
31
	 */
32
	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
33
		$address_formats = apply_filters(
34
			'FHEE__EE_MultiLine_Address_Formatter__address_formats',
35
			array(
36
				'CA' => "{address}%{address2}%{city}%{state}%{country}%{zip}",
37
				'GB' => "{address}%{address2}%{city}%{state}%{zip}%{country}",
38
				'US' => "{address}%{address2}%{city}%{state}%{zip}%{country}",
39
				'ZZ' => "{address}%{address2}%{city}%{state}%{zip}%{country}",
40
			)
41
		);
42
		// if the incoming country has a set format, use that, else use the default
43
		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ]
44
			: $address_formats['ZZ'];
45
		return $this->parse_formatted_address(
46
			$address,
47
			$address2,
48
			$city,
49
			$state,
50
			$zip,
51
			$country,
52
			$formatted_address,
53
			'<br />'
54
		);
55
	}
56
57
58
}
59
// End of file MultiLineAddressFormatter.php
60
// Location: core/services/address/formatters/MultiLineAddressFormatter.php