Completed
Push — master ( ba1cd7...836330 )
by Jamie
02:56
created

FrmEntryFactory::entry_formatter_instance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @since 2.03.11
5
 */
6
class FrmEntryFactory {
7
8
	/**
9
	 * Create an instance of the FrmEntryFormatter class
10
	 *
11
	 * @since 2.03.11
12
	 *
13
	 * @param array $atts
14
	 *
15
	 * @return FrmEntryFormatter|FrmProEntryFormatter
16
	 */
17
	public static function entry_formatter_instance( $atts ) {
18
		if ( FrmAppHelper::pro_is_installed() ) {
19
			$entry_formatter = new FrmProEntryFormatter( $atts );
20
		} else {
21
			$entry_formatter = new FrmEntryFormatter( $atts );
22
		}
23
24
		return $entry_formatter;
25
	}
26
27
	/**
28
	 * Create an intsance of the FrmEntryShortcodeFormatter class
29
	 *
30
	 * @since 2.03.11
31
	 *
32
	 * @param int|string $form_id
33
	 * @param string $format
34
	 *
35
	 * @return FrmEntryShortcodeFormatter|FrmProEntryShortcodeFormatter
36
	 */
37
	public static function entry_shortcode_formatter_instance( $form_id, $format ) {
38
		if ( FrmAppHelper::pro_is_installed() ) {
39
			$shortcode_formatter = new FrmProEntryShortcodeFormatter( $form_id, $format );
40
		} else {
41
			$shortcode_formatter = new FrmEntryShortcodeFormatter( $form_id, $format );
42
		}
43
44
		return $shortcode_formatter;
45
	}
46
}