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

FrmEntryFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A entry_formatter_instance() 0 9 2
A entry_shortcode_formatter_instance() 0 9 2
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
}